diff --git a/frontend/src/components/enrichment/PathwayTools.vue b/frontend/src/components/enrichment/PathwayTools.vue index 6b152b9e..aa382510 100644 --- a/frontend/src/components/enrichment/PathwayTools.vue +++ b/frontend/src/components/enrichment/PathwayTools.vue @@ -22,6 +22,7 @@
-
+
@@ -19,7 +19,7 @@ import SnapshotGraph from '@/components/enrichment/graph/SnapshotGraph.vue' export default { name: 'PathwayGraphs', - props: ['gephi_data','filtered_terms', 'bookmark_off'], + props: ['gephi_data','filtered_terms', 'bookmark_off','mode'], components: { SnapshotGraph, }, @@ -31,13 +31,20 @@ export default { term_graphs: new Set(), favourite_graphs: new Set(), activeGraphIndex: -1, - graph_number: 0, + graph_number: -1, + species: null } }, mounted(){ - this.emitter.on("generateGraph", (set) => { - this.get_term_data(set) - }); + if(this.mode !='term') { + this.emitter.on("generateGraph", (set) => { + this.get_term_data(set) + }); + } + }, + activated(){ + this.term_graphs = new Set(this.$store.state.term_graph_dict) + this.favourite_graphs = this.$store.state.favourite_graph_dict }, methods: { get_term_data(set) { @@ -54,7 +61,7 @@ export default { if(response.data){ this.graph_number += 1 if(this.term_graphs.size < 1) this.$store.commit('assign_term_graph', response.data) - this.$store.commit('assign_new_term_graph', {label: `Graph ${this.graph_number}`, graph: response.data}) + this.$store.commit('assign_new_term_graph', {id: this.graph_number, label: `Graph ${this.graph_number}`, graph: response.data}) this.term_graphs.add({ id: this.graph_number, label: `Graph ${this.graph_number}`, graph: response.data}); } }) @@ -62,24 +69,27 @@ export default { }, switch_graph(entry) { this.$store.commit('assign_term_graph', entry.graph) - this.$router.push("terms") + if(this.mode == 'term') this.emitter.emit('graphChanged') + else this.$router.push("terms") + }, remove_graph(entry) { - if (!this.favourite_graphs.has(entry)) { + if (!this.favourite_graphs.has(entry.id)) { // Checkbox is checked, add its state to the object - this.favourite_graphs.delete(entry) + this.favourite_graphs.delete(entry.id) + this.$store.commit('assign_favourite_graph', this.favourite_graphs) } this.term_graphs.delete(entry) this.$store.commit('remove_snapshotPathway', entry.id) + this.$store.commit('remove_term_graph', entry) }, add_graph(entry){ - if (!this.favourite_graphs.has(entry)) { - // Checkbox is checked, add its state to the object - this.favourite_graphs.add(entry) + if (!this.favourite_graphs.has(entry.id)) { + this.favourite_graphs.add(entry.id) } else { - // Checkbox is unchecked, remove its state from the object - this.favourite_graphs.delete(entry) + this.favourite_graphs.delete(entry.id) } + this.$store.commit('assign_favourite_graph', this.favourite_graphs) }, }, computed: { @@ -89,7 +99,7 @@ export default { if (!com.bookmark_off){ filtered = filtered.filter(function(term) { - return com.favourite_graphs.has(term) + return com.favourite_graphs.has(term.id) }); } diff --git a/frontend/src/components/enrichment/graph/SnapshotGraph.vue b/frontend/src/components/enrichment/graph/SnapshotGraph.vue index c7c47d9e..9821c149 100644 --- a/frontend/src/components/enrichment/graph/SnapshotGraph.vue +++ b/frontend/src/components/enrichment/graph/SnapshotGraph.vue @@ -16,6 +16,9 @@ export default { updated(){ if(this.findSnapshot()) this.initializeSnapshot(this.findSnapshot().snapshot) }, + activated(){ + if(this.findSnapshot()) this.initializeSnapshot(this.findSnapshot().snapshot) + }, mounted(){ if(!this.findSnapshot()) this.initializeSnapshot(this.getSnapshot(this.propValue.graph)) else this.initializeSnapshot(this.findSnapshot().snapshot) diff --git a/frontend/src/components/pathwaytools/PathwayGraphGraphs.vue b/frontend/src/components/pathwaytools/PathwayGraphGraphs.vue index 57a8e4d2..3363310e 100644 --- a/frontend/src/components/pathwaytools/PathwayGraphGraphs.vue +++ b/frontend/src/components/pathwaytools/PathwayGraphGraphs.vue @@ -1,35 +1,15 @@ @@ -37,14 +17,12 @@ diff --git a/frontend/src/components/pathwaytools/PathwayGraphMenu.vue b/frontend/src/components/pathwaytools/PathwayGraphMenu.vue index 2f92fd9d..f96e69ed 100644 --- a/frontend/src/components/pathwaytools/PathwayGraphMenu.vue +++ b/frontend/src/components/pathwaytools/PathwayGraphMenu.vue @@ -6,11 +6,12 @@
+
@@ -18,54 +19,21 @@ diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 553a4869..cb0bdf86 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -16,6 +16,7 @@ export const store = createStore({ test_sample: "Gnai3;Klf6;Xpo6;Gmpr;Trim25;Tbrg4;Mx1;Pdgfb;Zfp385a;Gpcr2;Clcn4-2;Myo18a;Heatr6;Ccl3;Nhp2;Poldip2;Ckb;Smg5;Tubb5;Ell2;Ergic1;Brpf1;Ubl3;Il16;Tcirg1;Rtcb;Rac1;Nfix;Blvra;Celf2;Sf3a1;Ppard;Daxx;Ipo4;Ccdc97;Lcp2;Cse1l;Il17ra;Pnkp;Apoe;Hbp1;Klf4;Ap1m1;Ppp5c;Hck;Keap1;Prkcsh;Ier3;Klc4;Man1a;Nfat5;Stat3;Psap;Ptpn6;Coro1c;Arhgef40;Chn2;Arid3b;Ly9;Cd244;Emr1;Ulk2;Grap;Dtx2;Prkacb;Cstb;Wdr1;Man2b1;Txn2;Hmox1;Por;Trim28;Mef2c;Snx6;Reep5;Nr2c2;Tpr;Dhx34;Inpp5k;Fblim1;Tep1;Tmbim1;Ggt5;Neurl1a;Aprt;Pknox1;B4galnt1;Sod2;M6pr;Tgfbr1;Bcl2l1;Zmiz1;Ctsd;Phax;Snrpb2;Ubc;Sertad1;Vav2;Ubp1;Nuak2;Rassf1;Slc3a2;Tmem86a;Ifi35;Rdm1;Psen2;Vac14;Gltp;Rps5;Etv5;Ptprs;Cacybp;Mertk;Dguok;Csf1;Lrrk1;Actn1;Sirt2;Abca1;Gadd45b;Zdhhc12;Cybb;Atf6b;Hivep2;Nat9;Hspa8;Cers2;Anp32e;Tab2;Rxra;Fcgr1;Ncf1;Cacna1d;Fli1;Slmo2;Slc25a5;Mapkapk2;Lamp2;Pacsin2;Plcg1;Sdc4;Plxdc1;Wsb1;Tha1;Pgs1;Myo1c;Pitpna;Mlx;Ppp2r5c;B4galt5;Med13l;Vmp1;Pmp22;Kansl1;C1qbp;Slc13a3;Kdm6b;Trpv2;Sparc;Ikzf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b1;Phka2", highlighted_edges: new Set(), snapshot_pathways: [], + favourite_graph_dict: new Set(), snapshot_heatmaps: [], node_cluster_index: {}, node_modul_index: new Set(), @@ -62,6 +63,13 @@ export const store = createStore({ assign_new_term_graph(state, value) { state.term_graph_dict.push(value) }, + remove_term_graph(state, value) { + const index = state.term_graph_dict.indexOf(value) + state.term_graph_dict.splice(index,1) + }, + assign_favourite_graph(state, value) { + state.favourite_graph_dict = value + }, assign_highlightedSet(state, value) { state.highlighted_edges = value }, diff --git a/frontend/src/views/ProteinView.vue b/frontend/src/views/ProteinView.vue index cff79bd5..f2ed8810 100644 --- a/frontend/src/views/ProteinView.vue +++ b/frontend/src/views/ProteinView.vue @@ -99,7 +99,6 @@ export default { const term = this.$store.state.enrichment const all_terms = this.$store.state.current_enrichment_terms - console.log(all_terms) if(term != null){ for (var idx in all_terms) { var node = all_terms[idx]; diff --git a/frontend/src/views/TermView.vue b/frontend/src/views/TermView.vue index 5b9a4c3c..4f013449 100644 --- a/frontend/src/views/TermView.vue +++ b/frontend/src/views/TermView.vue @@ -127,20 +127,7 @@ export default { }, activated() { - - this.term_data = this.$store.state.term_graph_data - - const term_node = this.$store.state.active_node_enrichment - if(term_node != null){ - console.log(this.term_data) - for (var idx in this.term_data.nodes) { - var node = this.term_data.nodes[idx]; - if(node.attributes["Ensembl ID"] == term_node.id){ - this.active_node = this.term_data.nodes[idx] - } - } - this.$store.commit('assign_active_enrichment_node', null) - } + this.change_graph() }, mounted() { const com = this; @@ -181,6 +168,27 @@ export default { const maingraph = new Set(com.term_data.subgraph) com.unconnected_nodes = com.term_data.nodes.filter(item => !maingraph.has(item.id)); + + this.emitter.on("graphChanged", () => { + this.change_graph() + }); + + }, + methods:{ + change_graph(){ + this.term_data = this.$store.state.term_graph_data + + const term_node = this.$store.state.active_node_enrichment + if(term_node != null){ + for (var idx in this.term_data.nodes) { + var node = this.term_data.nodes[idx]; + if(node.attributes["Ensembl ID"] == term_node.id){ + this.active_node = this.term_data.nodes[idx] + } + } + this.$store.commit('assign_active_enrichment_node', null) + } + } } }