diff --git a/src/components/PlatformSelector.vue b/src/components/PlatformSelector.vue deleted file mode 100644 index eb31e58..0000000 --- a/src/components/PlatformSelector.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/SearchSettings.vue b/src/components/SearchSettings.vue index 27772e6..550e4b8 100644 --- a/src/components/SearchSettings.vue +++ b/src/components/SearchSettings.vue @@ -37,9 +37,10 @@ class="mb-1"/> @@ -108,6 +109,7 @@ export default { emits: ["input"], data() { return { + selectedTech: [], searchSettings: this.value, platformResultType: ArrayDesignType, selectedTaxa: this.value ? [this.value] : [] @@ -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; } }, diff --git a/src/components/TechnologyTypeSelector.vue b/src/components/TechnologyTypeSelector.vue index 5ae351c..5eb146d 100644 --- a/src/components/TechnologyTypeSelector.vue +++ b/src/components/TechnologyTypeSelector.vue @@ -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", @@ -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) @@ -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); @@ -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); diff --git a/src/lib/filter.js b/src/lib/filter.js index 177b4b5..5e03a7a 100644 --- a/src/lib/filter.js +++ b/src/lib/filter.js @@ -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; @@ -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 }); diff --git a/src/lib/platformConstants.js b/src/lib/platformConstants.js new file mode 100644 index 0000000..902357a --- /dev/null +++ b/src/lib/platformConstants.js @@ -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} \ No newline at end of file