Skip to content

Commit

Permalink
fixes #106, moves platform related constants with out of component us…
Browse files Browse the repository at this point in the history
…e to their own file
  • Loading branch information
oganm committed Jun 11, 2024
1 parent f6de95a commit 5caa25b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 1 addition & 8 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 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 5caa25b

Please sign in to comment.