Skip to content

Commit

Permalink
NN-608 add create subset button in parameter filtering dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
anlisha-maharjan committed Dec 5, 2024
1 parent 9ae486a commit b36ce04
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 6 deletions.
6 changes: 2 additions & 4 deletions frontend/src/components/enrichment/PathwaySet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ export default {
sort_alph: "",
set_dict: new Set(),
search_raw: "",
layer: 0,
loading_state: false,
focus_subset_id: null
};
Expand All @@ -239,7 +238,6 @@ export default {
return regex.test(set.name);
}
});
console.log(filtered);
}
if (com.sort_alph == "asc") {
Expand Down Expand Up @@ -332,6 +330,7 @@ export default {
save_subset() {
var com = this;
let genes;
let count = new Set(com.$store.state.favourite_subsets)?.size || 0;
if (com.mode == "protein") {
genes = com.$store.state.active_subset;
} else if (com.mode == "term") {
Expand All @@ -343,7 +342,7 @@ export default {
if (!genes) return;
this.$store.commit("assign_subset", {
name: `subset ${com.layer}`,
name: `subset ${count}`,
genes: genes,
terms: null,
view: com.mode,
Expand All @@ -353,7 +352,6 @@ export default {
actions: false,
stats: null,
});
com.layer += 1;
},
remove_set(entry) {
if (entry.status) this.emitter.emit("enrichTerms", null);
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/components/toolbar/modules/KeywordList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<h6 v-if="filt_keyword.length === 0" class="text-center text-slate-300">
No available data
</h6>

<Button v-if="filt_keyword.length !== 0" label="Create subset" severity="secondary" size="small" fluid type="button" class="mt-4 !rounded-lg"
@click="save_subset()">
</Button>
</template>

<script>
Expand All @@ -43,6 +47,32 @@ export default {
var com = this;
com.emitter.emit("searchSubset", { subset: subset, mode: this.mode });
},
save_subset() {
var com = this;
let genes;
let count = new Set(com.$store.state.favourite_subsets)?.size || 0;
if (com.mode == "protein") {
genes = com.$store.state.active_subset;
} else if (com.mode == "term") {
genes = com.$store.state.p_active_subset;
} else {
genes = com.$store.state.c_active_subset;
}
if (!genes) return;
this.$store.commit("assign_subset", {
name: `subset ${count}`,
genes: genes,
terms: null,
view: com.mode,
abstracts: null,
status: false,
information: false,
actions: false,
stats: null,
});
},
},
computed: {
regex() {
Expand Down
30 changes: 28 additions & 2 deletions frontend/src/components/toolbar/modules/ProteinList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To find multiple nodes separate each node with comma (<span class="leading-[0] text-primary-400 text-4xl">,</span>)
</h6>
<Textarea v-model="raw_text" rows="4" fluid autofocus placeholder="Search by gene..." />
<Button label="Apply" severity="secondary" size="small" fluid type="button" class="mt-2.5 !rounded-lg"
<Button label="Apply & Create subset" severity="secondary" size="small" fluid type="button" class="mt-2.5 !rounded-lg"
@click="highlight(raw_text)">
</Button>
</template>
Expand All @@ -29,9 +29,35 @@ export default {
subset.push(node);
}
});
com.save_subset();
com.emitter.emit("searchSubset", { subset: subset, mode: this.mode });
},
save_subset() {
var com = this;
let genes;
let count = new Set(com.$store.state.favourite_subsets)?.size || 0;
if (com.mode == "protein") {
genes = com.$store.state.active_subset;
} else if (com.mode == "term") {
genes = com.$store.state.p_active_subset;
} else {
genes = com.$store.state.c_active_subset;
}
if (!genes) return;
this.$store.commit("assign_subset", {
name: `subset ${count}`,
genes: genes,
terms: null,
view: com.mode,
abstracts: null,
status: false,
information: false,
actions: false,
stats: null,
});
},
},
};
</script>
30 changes: 30 additions & 0 deletions frontend/src/components/toolbar/modules/SelectionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
</li>
</ul>

<Button label="Create subset" severity="secondary" size="small" fluid type="button" class="mt-4 !rounded-lg"
@click="save_subset()">
</Button>

<!-- <div class="tool-item">
<div id="selection_highlight" class="window-menu selection">
<div id="selection_highlight_header" class="window-header">
Expand Down Expand Up @@ -339,6 +343,32 @@ export default {
};
}
},
save_subset() {
var com = this;
let genes;
let count = new Set(com.$store.state.favourite_subsets)?.size || 0;
if (com.mode == "protein") {
genes = com.$store.state.active_subset;
} else if (com.mode == "term") {
genes = com.$store.state.p_active_subset;
} else {
genes = com.$store.state.c_active_subset;
}
if (!genes) return;
this.$store.commit("assign_subset", {
name: `subset ${count}`,
genes: genes,
terms: null,
view: com.mode,
abstracts: null,
status: false,
information: false,
actions: false,
stats: null,
});
},
// create_de() {
// var com = this;
// Object.entries(com.dcoloumns).forEach(([index, coloumn]) => {
Expand Down

0 comments on commit b36ce04

Please sign in to comment.