Skip to content

Commit

Permalink
Merge pull request #104 from PavlidisLab/platforms-treeview-fix
Browse files Browse the repository at this point in the history
Fixing #94 and #106
  • Loading branch information
arteymix authored Jun 11, 2024
2 parents 19fe25e + 5caa25b commit 54d4372
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 200 deletions.
181 changes: 0 additions & 181 deletions src/components/PlatformSelector.vue

This file was deleted.

9 changes: 5 additions & 4 deletions src/components/SearchSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
class="mb-1"/>
<TechnologyTypeSelector
v-if="searchSettings.resultTypes.indexOf(platformResultType) === -1"
v-model="searchSettings.platforms"
v-model="selectedTech"
:platforms="platforms"
:selected-technology-types.sync="searchSettings.technologyTypes"
:selectedPlatforms.sync="searchSettings.platforms"
:selectedTechnologyTypes.sync="searchSettings.technologyTypes"
:disabled="platformDisabled"
:loading="platformLoading"
class="mb-1"/>
Expand Down Expand Up @@ -108,6 +109,7 @@ export default {
emits: ["input"],
data() {
return {
selectedTech: [],
searchSettings: this.value,
platformResultType: ArrayDesignType,
selectedTaxa: this.value ? [this.value] : []
Expand All @@ -134,10 +136,9 @@ export default {
},
methods: {
clearAllSelections() {
this.selectedTech = []
this.searchSettings.annotations = [];
this.searchSettings.platforms = [];
this.searchSettings.taxon = [];
this.searchSettings.technologyTypes = [];
this.searchSettings.query = undefined;
}
},
Expand Down
24 changes: 11 additions & 13 deletions src/components/TechnologyTypeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,8 @@
import { chain, isEqual } from "lodash";
import { formatNumber } from "@/lib/utils";
import { mapState } from "vuex";
import { TECHNOLOGY_TYPES, TOP_TECHNOLOGY_TYPES} from "@/lib/platformConstants";
const MICROARRAY_TECHNOLOGY_TYPES = ["ONECOLOR", "TWOCOLOR", "DUALMODE"];
const RNA_SEQ_TECHNOLOGY_TYPES = ["SEQUENCING"];
const OTHER_TECHNOLOGY_TYPES = ["GENELIST", "OTHER"];
const TECHNOLOGY_TYPES = MICROARRAY_TECHNOLOGY_TYPES + RNA_SEQ_TECHNOLOGY_TYPES + OTHER_TECHNOLOGY_TYPES;
const TOP_TECHNOLOGY_TYPES = [
["RNA_SEQ", "RNA-Seq", RNA_SEQ_TECHNOLOGY_TYPES],
["MICROARRAY", "Microarray", MICROARRAY_TECHNOLOGY_TYPES],
["OTHER", "Other", OTHER_TECHNOLOGY_TYPES]];
export default {
name: "TechnologyTypeSelector",
Expand All @@ -59,10 +52,18 @@ export default {
events: ["input"],
data() {
return {
selectedValues: this.value.map(t => t.id)
};
},
computed: {
selectedValues:
{
get(){
return this.value
},
set(val){
this.$emit('input',val)
}
},
technologyTypes() {
return TOP_TECHNOLOGY_TYPES
.filter(([id]) => id !== "OTHER" || this.debug)
Expand Down Expand Up @@ -104,9 +105,6 @@ export default {
}
},
watch: {
value(newVal) {
this.selectedValues = newVal.map(t => t.id);
},
selectedValues(newVal, oldVal) {
let ids = new Set(newVal.filter(id => !TECHNOLOGY_TYPES.includes(id)));
let selectedTechnologyTypes = this.computeSelectedTechnologyTypes(ids);
Expand All @@ -115,7 +113,7 @@ export default {
let oldSelectedTechnologyTypes = this.computeSelectedTechnologyTypes(oldIds);
let oldSelectedPlatforms = this.computeSelectedPlatforms(oldIds, oldSelectedTechnologyTypes);
if (!isEqual(selectedPlatforms.map(p => p.id), oldSelectedPlatforms.map(p => p.id))) {
this.$emit("input", selectedPlatforms);
this.$emit("update:selectedPlatforms", selectedPlatforms);
}
if (!isEqual(selectedTechnologyTypes, oldSelectedTechnologyTypes)) {
this.$emit("update:selectedTechnologyTypes", selectedTechnologyTypes);
Expand Down
8 changes: 6 additions & 2 deletions src/lib/filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { SearchSettings } from "@/lib/models";
import { chain, sumBy } from "lodash";
import { getCategoryId, pluralize } from "@/lib/utils";
import { MICROARRAY_TECHNOLOGY_TYPES, RNA_SEQ_TECHNOLOGY_TYPES, OTHER_TECHNOLOGY_TYPES} from "@/lib/platformConstants";




const MAX_URIS_IN_CLAUSE = 200;

Expand Down Expand Up @@ -159,10 +163,10 @@ export function generateFilterDescription(searchSettings, inferredTermsByCategor
}
if (searchSettings.platforms.length > 0 || searchSettings.technologyTypes.length > 0) {
const platformValues = searchSettings.platforms.map(platforms => platforms.name);
if (searchSettings.technologyTypes && searchSettings.technologyTypes.includes("RNASEQ")) {
if (searchSettings.technologyTypes && RNA_SEQ_TECHNOLOGY_TYPES.every(tech=>searchSettings.technologyTypes.includes(tech))) {
platformValues.unshift("RNA-Seq");
}
if (searchSettings.technologyTypes && searchSettings.technologyTypes.length >= 3 && searchSettings.platforms.length === 0) {
if (searchSettings.technologyTypes && MICROARRAY_TECHNOLOGY_TYPES.every(tech=>searchSettings.technologyTypes.includes(tech))) {
platformValues.unshift("Microarray");
}
filter.push({ key: "Platforms", value: platformValues });
Expand Down
11 changes: 11 additions & 0 deletions src/lib/platformConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const MICROARRAY_TECHNOLOGY_TYPES = ["ONECOLOR", "TWOCOLOR", "DUALMODE"];
const RNA_SEQ_TECHNOLOGY_TYPES = ["SEQUENCING"];
const OTHER_TECHNOLOGY_TYPES = ["GENELIST", "OTHER"];
const TECHNOLOGY_TYPES = MICROARRAY_TECHNOLOGY_TYPES + RNA_SEQ_TECHNOLOGY_TYPES + OTHER_TECHNOLOGY_TYPES;
const TOP_TECHNOLOGY_TYPES = [
["RNA_SEQ", "RNA-Seq", RNA_SEQ_TECHNOLOGY_TYPES],
["MICROARRAY", "Microarray", MICROARRAY_TECHNOLOGY_TYPES],
["OTHER", "Other", OTHER_TECHNOLOGY_TYPES]];


export {MICROARRAY_TECHNOLOGY_TYPES, RNA_SEQ_TECHNOLOGY_TYPES, OTHER_TECHNOLOGY_TYPES, TECHNOLOGY_TYPES, TOP_TECHNOLOGY_TYPES}

0 comments on commit 54d4372

Please sign in to comment.