Skip to content

Commit

Permalink
Merge branch 'release-2.12.x' into TASK-5864
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Apr 14, 2024
2 parents 5d85521 + dcec92f commit a4f70f0
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 50 deletions.
8 changes: 2 additions & 6 deletions src/core/bioinfo/bioinfo-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default class BioinfoUtils {
case "SO":
return this.getSequenceOntologyLink(ontologyTermId);
case "OMIM":
return this.getOmimOntologyLink(id);
return this.getOmimLink(id);
case "ORPHA":
return this.getOrphanetLink(id);
case "MONDO":
Expand All @@ -281,15 +281,11 @@ export default class BioinfoUtils {
return `https://hpo.jax.org/app/browse/term/${hpoTerm}`;
}

static getOmimLink(omimEntry) {
return `https://www.omim.org/entry/${omimEntry}`;
}

static getSequenceOntologyLink(soTerm) {
return `http://www.sequenceontology.org/browser/current_svn/term/${soTerm}`;
}

static getOmimOntologyLink(soTerm) {
static getOmimLink(soTerm) {
return `https://omim.org/entry/${soTerm}"`;
}

Expand Down
2 changes: 1 addition & 1 deletion src/webcomponents/clinical/clinical-analysis-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default class ClinicalAnalysisView extends LitElement {
template: "${disorder.name} (${disorder.id})",
link: {
"disorder.id": id => id.startsWith("OMIM:") ?
BioinfoUtils.getOmimOntologyLink(id) :
BioinfoUtils.getOmimLink(id) :
"",
},
},
Expand Down
11 changes: 8 additions & 3 deletions src/webcomponents/variant/variant-browser-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import {LitElement, html} from "lit";
import {html, LitElement, nothing} from "lit";
import UtilsNew from "../../core/utils-new.js";
import "../commons/filters/cadd-filter.js";
import "../commons/filters/biotype-filter.js";
Expand Down Expand Up @@ -340,17 +340,22 @@ export default class VariantBrowserFilter extends LitElement {
case "study":
content = html`
<study-filter
.value="${this.preparedQuery.study}"
.opencgaSession="${this.opencgaSession}"
@filterChange="${e => this.onFilterChange("study", e.detail.value)}">
</study-filter>`;
break;
case "sample":
const multiStudySelected = this.preparedQuery?.study?.split(",")?.length > 1;
content = html`
<catalog-search-autocomplete
${multiStudySelected ? html`
<div class="alert alert-warning" role="alert">You cannot select samples with more than one study</div>
` : nothing}
<catalog-search-autocomplete title=${multiStudySelected ? "You cannot select samples with more than one study" : null}
.value="${this.preparedQuery.sample}"
.opencgaSession="${this.opencgaSession}"
.resource="${"SAMPLE"}"
.config="${{multiple: true, maxItems: 3}}"
.config="${{multiple: true, maxItems: 3, disabled: multiStudySelected}}"
@filterChange="${e => this.onFilterChange("sample", e.detail.value)}">
</catalog-search-autocomplete>`;
break;
Expand Down
80 changes: 40 additions & 40 deletions src/webcomponents/variant/variant-grid-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1190,28 +1190,59 @@ export default class VariantGridFormatter {
</div>
<div>
${
hotspot.variants
.map(variant => `
<span
class="help-block"
style="margin: 5px 1px">${AMINOACID_CODE[hotspot.aminoacidReference]}${hotspot.aminoacidPosition}${AMINOACID_CODE[variant.aminoacidAlternate]}: ${variant.count} sample(s)
</span>`)
.join("")
}
hotspot.variants
.map(variant => `
<span
class="help-block"
style="margin: 5px 1px">${AMINOACID_CODE[hotspot.aminoacidReference]}${hotspot.aminoacidPosition}${AMINOACID_CODE[variant.aminoacidAlternate]}: ${variant.count} sample(s)
</span>`)
.join("")
}
</div>
</div>`;
}

if (cancerHotspotsHtml.size > 0) {
return `
<a class="hotspots-tooltip" tooltip-title='Info' tooltip-text='${tooltipText}' tooltip-position-at="left bottom" tooltip-position-my="right top">
<a class="hotspots-tooltip" tooltip-title='Info' tooltip-text='${tooltipText}' tooltip-position-at="left bottom" tooltip-position-my="right top">
<span style="color: green">${cancerHotspotsHtml.size} ${cancerHotspotsHtml.size === 1 ? "variant" : "variants"}</span>
</a>`;
}
}
return "<span title='No clinical records found for this variant'><i class='fa fa-times' style='color: gray'></i></span>";
}

static clinicalOmimFormatter(value, row) {
const entries = (row?.annotation?.geneTraitAssociation || [])
.filter(item => (item?.id || "").startsWith("OMIM:"))
.map(item => item.id.replace("OMIM:", ""));

if (entries?.length > 0) {
const uniqueEntries = new Set(entries);
const entriesLinks = Array.from(uniqueEntries)
.map(entry => {
return `
<div style="">
<a href="${BioinfoUtils.getOmimLink(entry)}" target="_blank">${entry}</a>
</div>
`;
});
const tooltipText = entriesLinks.join("");

return `
<a class="omim-tooltip" tooltip-title='Info' tooltip-text='${tooltipText}' tooltip-position-at="left bottom" tooltip-position-my="right top">
<span style='color:green;'>${uniqueEntries.size}<br>${uniqueEntries.size === 1 ? "entry" : "entries"}</span>
</a>
`;
} else {
return `
<span title='No clinical records found for this variant'>
<i class='fa fa-times' style='color: gray'></i>
</span>
`;
}
}

static clinicalTableDetail(value, row, index) {
const clinvar = [];
const cosmic = [];
Expand Down Expand Up @@ -1517,35 +1548,4 @@ export default class VariantGridFormatter {
return "-";
}


static clinicalOmimFormatter(value, row) {
const entries = (row?.annotation?.geneTraitAssociation || [])
.filter(item => (item?.id || "").startsWith("OMIM:"))
.map(item => item.id.replace("OMIM:", ""));

if (entries.length > 0) {
const uniqueEntries = new Set(entries);
const entriesLinks = Array.from(uniqueEntries).map(entry => {
return `
<div style="">
<a href="${BioinfoUtils.getOmimLink(entry)}" target="_blank">${entry}</a>
</div>
`;
});
const tooltipText = entriesLinks.join("");

return `
<a class="hotspots-tooltip" tooltip-title='Info' tooltip-text='${tooltipText}' tooltip-position-at="left bottom" tooltip-position-my="right top">
<span style='color:green;'>${uniqueEntries.size}<br>${uniqueEntries.size === 1 ? "entry" : "entries"}</span>
</a>
`;
} else {
return `
<span title='No clinical records found for this variant'>
<i class='fa fa-times' style='color: gray'></i>
</span>
`;
}
}

}

0 comments on commit a4f70f0

Please sign in to comment.