Skip to content

Commit

Permalink
Merge branch 'master' into feature-display-uri-descriptions-2
Browse files Browse the repository at this point in the history
  • Loading branch information
oganm committed Jun 20, 2024
2 parents 913ce4d + e3a0c3f commit 03f242d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 216 deletions.
18 changes: 5 additions & 13 deletions src/components/CodeSnippet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
{
label: "gemma.R",
language: "r",
instructions: `Install the [gemma.R](https://github.com/PavlidisLab/gemma.R) package from GitHub and run the following code in an R console:`
instructions: `Install the [gemma.R](https://bioconductor.org/packages/release/bioc/html/gemma.R.html) package from GitHub and run the following code in an R console:`
},
{
label: "curl",
Expand Down Expand Up @@ -142,19 +142,11 @@ export default {
if (sort !== undefined) {
queryGemmapy.push(`, sort=${this.escapePythonString(sort)}`);
}
queryGemmapy.push(", offset=offset, limit=limit)");
queryGemmapy.unshift(`import gemmapy\n` +
`api_instance = gemmapy.GemmaPy()\n` +
`all_datasets = []\n` +
`limit = ${MAX_DATASETS}\n` +
`for offset in range(0, ${this.totalNumberOfExpressionExperiments}, limit):\n` +
`\tapi_response = api_instance.get_datasets_by_ids([], `);
queryGemmapy.push(`)\n` +
`\tif api_response.data:\n` +
`\t\tall_datasets.extend(api_response.data)\n` +
`\telse:\n` +
`\t\tbreak`);
`api = gemmapy.GemmaPy()\n` +
`data = api.get_all_pages(api.get_datasets,`);
queryGemmapy.push(`)\n`)
}
tabs[0].content = queryGemmapy.join("");
Expand All @@ -173,7 +165,7 @@ export default {
if (sort !== undefined) {
queryGemmaR.push(`, sort = ${this.escapeRString(sort)}`);
}
queryGemmaR.unshift(`devtools::install_github("PavlidisLab/gemma.R")\n` +
queryGemmaR.unshift(`BiocManager::install("gemma.R")\n` +
`library(gemma.R)\n` +
`library(dplyr)\n` +
`data <- get_datasets(`);
Expand Down
6 changes: 4 additions & 2 deletions src/components/DatasetPreview.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="py-3">
<h3> <a v-bind:href="datasetUrl">{{ dataset.shortName }}</a>: {{ dataset.name }}</h3>
<h3> <a v-bind:href="datasetUrl" target="_blank">{{ dataset.shortName }}</a>: {{ dataset.name }}</h3>
<v-chip v-for="term in includedTerms" :key="getId(term)"
@[getClickEventName(term)]="handleChipClick(term)"
small :color="getChipColor(term.objectClass)"
Expand Down Expand Up @@ -123,8 +123,10 @@ export default {
getTitle(term) {
let n = this.getNumberOfExpressionExperiments(term);
if (term.termUri !== null) { // if the term is not free text
if (n > 0) {
if (n > 0 && this.isSelectable(term)) {
return `${term.className.charAt(0).toUpperCase() + term.className.slice(1)}: ${term.termUri} via ${term.objectClass}; click to add terms to filter (associated with ${n} datasets)`;
} else if (n > 0 && this.isUnselectable(term)){
return `${term.className.charAt(0).toUpperCase() + term.className.slice(1)}: ${term.termUri} via ${term.objectClass}; click to remove terms from filter (associated with ${n} datasets)`;
} else {
return `${term.className.charAt(0).toUpperCase() + term.className.slice(1)}: ${term.termUri} via ${term.objectClass}`;
}
Expand Down
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,inferredTermLabelsByCat
}
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}
2 changes: 1 addition & 1 deletion src/views/Browser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<span v-else :key="h.value">{{ h.text }}</span>
</template>
<template v-slot:item.shortName="{item}">
<a :href="getUrl(item)">
<a :href="getUrl(item)" target="_blank">
{{ item.shortName }}
</a>
</template>
Expand Down

0 comments on commit 03f242d

Please sign in to comment.