Skip to content

Commit

Permalink
NN-588 Frontend bugfix & new Stuff
Browse files Browse the repository at this point in the history
-added sizeable verticalpane
-fixed filter unwillingly closing
-added auto hiding labels
-fixed filter not correctly resetting on graph switch
-fixed overlapping node pane statistics
-fixed correct subset/term/citation switch to other view
  • Loading branch information
TripZz committed Sep 19, 2024
1 parent 46bfcce commit b74e5a6
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 173 deletions.
31 changes: 17 additions & 14 deletions frontend/src/components/PersistentWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
{{ element.id }}
</span>
</div>
<p>{{ msg.text }}</p>

<div v-if="msg.ref">
<span class="small-tag blue" @click="searchRef(msg.ref)">
reference
</span>
</div>
<p>{{ msg.text }}</p>
</div>
</div>

Expand Down Expand Up @@ -75,7 +74,7 @@ export default {
api: {
chatbot: "api/subgraph/chatbot",
},
controller:null
controller: null,
};
},
computed: {
Expand Down Expand Up @@ -115,21 +114,27 @@ export default {
},
searchInput(tag) {
if (tag.type == "protein") {
this.$router.push(tag.mode);
this.emitter.emit("searchNode", { node: tag.data, mode: tag.mode });
this.$router.push(tag.mode).then(() => {
this.emitter.emit("searchNode", { node: tag.data, mode: tag.mode });
});
} else if (tag.type == "term") {
this.emitter.emit("searchEnrichment", tag.data);
} else if (tag.type == "subset") {
this.$router.push(tag.mode);
this.emitter.emit("searchSubset", { subset: tag.data, mode: tag.mode });
this.$router.push(tag.mode).then(() => {
this.emitter.emit("searchSubset", {
subset: tag.data,
mode: tag.mode,
});
});
}
},
searchRef(ref) {
if (this.$store.state.citation_graph_data) {
this.$router.push("citation");
this.emitter.emit("searchSubset", {
subset: this.pmid_nodes(ref),
mode: "citation",
this.$router.push("citation").then(() => {
this.emitter.emit("searchfavouriteSubset", {
subset: this.pmid_nodes(ref),
mode: "citation",
});
});
} else {
alert("no citation graph");
Expand Down Expand Up @@ -231,7 +236,7 @@ export default {
// Create a new AbortController instance
this.controller = new AbortController();
const signal = this.controller.signal; // Get the signal
const botMessage = {
sender: "Bot",
text: "Waiting for response...", // Initially empty, will be updated progressively
Expand Down Expand Up @@ -268,9 +273,7 @@ export default {
stream: !done,
});
// Parse the chunk as JSON to extract "messages" and "pmids"
console.log(chunk);
let parsedChunk = JSON.parse(chunk);
console.log(parsedChunk);
// Check if it's a message part or pmids
if (parsedChunk.message) {
// Append message chunks to the fullText
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/components/enrichment/PathwayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default {
watch: {
terms() {
this.filter_options(this.terms);
this.init_categories();
},
},
computed: {
Expand Down Expand Up @@ -261,6 +262,18 @@ export default {
this.category = "Filter";
this.active_categories_set = new Set();
},
init_categories() {
for (let element of this.filter_terms) {
let checkCategory = element.label;
if (
checkCategory !== "GOCC" &&
checkCategory !== "GOMF" &&
checkCategory !== "GOBP"
)
this.active_categories(checkCategory);
}
this.category = [...this.active_categories_set].join(", ");
},
filter_options(terms) {
var com = this;
com.filter_terms = [];
Expand Down
41 changes: 25 additions & 16 deletions frontend/src/components/enrichment/PathwaySet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default {
id: `${subset.view}:${subset.name}`,
mode: subset.view,
type: "subset",
data: this.activate_genes(subset.genes),
data: this.activate_genes(subset.genes, subset.view),
});
},
save_subset() {
Expand Down Expand Up @@ -240,25 +240,34 @@ export default {
if (layer != entry) layer.status = false;
}
this.$router.push(entry.view);
if (!entry.status) {
this.emitter.emit("searchSubset", {
subset: this.activate_genes(entry.genes),
mode: entry.view,
});
this.emitter.emit("enrichTerms", entry.terms);
} else {
this.emitter.emit("searchSubset", { subset: null, mode: entry.view });
this.emitter.emit("enrichTerms", null);
}
entry.status = !entry.status;
this.$router.push(entry.view).then(() => {
if (!entry.status) {
this.emitter.emit("searchSubset", {
subset: this.activate_genes(entry.genes, entry.view),
mode: entry.view,
});
this.emitter.emit("enrichTerms", entry.terms);
} else {
this.emitter.emit("searchSubset", { subset: null, mode: entry.view });
this.emitter.emit("enrichTerms", null);
}
entry.status = !entry.status;
});
},
activate_genes(genes) {
var com = this;
activate_genes(genes, view) {
var subset = [];
var genes_set = new Set(genes);
let data;
if (view === "citation") {
data = this.$store.state.citation_graph_data.graph;
} else if (view === "term") {
data = this.$store.state.term_graph_data.graph;
} else if (view === "protein") {
data = this.$store.state.gephi_json.data;
}
com.gephi_data.nodes.forEach((node) => {
data.nodes.forEach((node) => {
if (genes_set.has(node.attributes["Name"])) {
subset.push(node);
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/enrichment/PathwayTools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export default {
}
.tool-buttons {
min-width: 2rem;
padding: 0.2vw 0 0.2vw 0;
border-radius: 0;
cursor: pointer;
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/interface/NetworkValues.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ export default {
#network-values {
width: 5%;
height: 3.98%;
left: 25vw;
bottom: 1vw;
top: 1%;
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
position: relative;
/* border-radius: 5px; */
-webkit-backdrop-filter: blur(7.5px);
transition: left 0.5s ease-in-out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default {
#statistics .network-results {
overflow: scroll;
height: 100%;
}
.network-results::-webkit-scrollbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export default {
if (com.active_term == null) {
return;
}
const { category, clean, fdr_rate, p_value } = com.active_term;
com.statistics = { category, clean, fdr_rate, p_value };
const { name, category, clean, fdr_rate, p_value } = com.active_term;
com.statistics = { name, category, clean, fdr_rate, p_value };
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/toolbar/CitationToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default {
protein_active: false,
selection_active: false,
mode: "citation",
label_check: false,
label_check: true,
};
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/toolbar/MainToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default {
tools_active: false,
protein_active: false,
selection_active: false,
label_check: false,
label_check: true,
mode: "protein",
};
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/toolbar/TermToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
tools_active: false,
protein_active: false,
selection_active: false,
label_check: false,
label_check: true,
mode: "term",
};
},
Expand Down
Loading

0 comments on commit b74e5a6

Please sign in to comment.