Skip to content
Snippets Groups Projects
Commit b9ab2cc9 authored by Hartung, Michael's avatar Hartung, Michael
Browse files

link-out for drugs

parent 78e723aa
No related branches found
No related tags found
No related merge requests found
<p <p
*ngIf="!wrapper.data.drugstoneId && wrapper.data.label" *ngIf="!_wrapper.data.drugstoneId && _wrapper.data.label"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Label:</span></b> <b><span>Label:</span></b>
<span class="is-capitalized"> {{ wrapper.data.label }}</span> <span class="is-capitalized"> {{ _wrapper.data.label }}</span>
</p> </p>
<p <p
*ngIf="wrapper.data.proteinName" *ngIf="_wrapper.data.proteinName"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Name:</span></b> <b><span>Name:</span></b>
<span class="is-capitalized"> {{ wrapper.data.proteinName }}</span> <span class="is-capitalized"> {{ _wrapper.data.proteinName }}</span>
</p> </p>
<p <p
*ngIf="wrapper.data.symbol" *ngIf="_wrapper.data.symbol"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Symbol:</span></b> <b><span>Symbol:</span></b>
<a <a
class="is-capitalized" class="is-capitalized"
href="https://www.genecards.org/cgi-bin/carddisp.pl?gene={{ href="https://www.genecards.org/cgi-bin/carddisp.pl?gene={{
wrapper.data.symbol _wrapper.data.symbol
}}" }}"
target="_blank" target="_blank"
> >
{{ wrapper.data.symbol }} {{ _wrapper.data.symbol }}
</a> </a>
</p> </p>
<p <p
*ngIf="wrapper.data.uniprot" *ngIf="_wrapper.data.uniprot"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Uniprot:</span></b> <b><span>Uniprot:</span></b>
<a <a
*ngFor="let uniprot of wrapper.data.uniprot" *ngFor="let uniprot of _wrapper.data.uniprot"
href="https://www.uniprot.org/uniprot/{{ uniprot }}" href="https://www.uniprot.org/uniprot/{{ uniprot }}"
target="_blank" target="_blank"
> >
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
</a> </a>
</p> </p>
<p <p
*ngIf="wrapper.data.ensg" *ngIf="_wrapper.data.ensg"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Ensembl:</span></b> <b><span>Ensembl:</span></b>
<a <a
*ngFor="let ensg of wrapper.data.ensg" *ngFor="let ensg of _wrapper.data.ensg"
href="https://www.ensembl.org/Homo_sapiens/Gene/Summary?g={{ ensg }}" href="https://www.ensembl.org/Homo_sapiens/Gene/Summary?g={{ ensg }}"
target="_blank" target="_blank"
> >
...@@ -55,12 +55,12 @@ ...@@ -55,12 +55,12 @@
</a> </a>
</p> </p>
<p <p
*ngIf="wrapper.data.entrez" *ngIf="_wrapper.data.entrez"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Entrez:</span></b> <b><span>Entrez:</span></b>
<a <a
*ngFor="let entrez of wrapper.data.entrez" *ngFor="let entrez of _wrapper.data.entrez"
href="https://www.ncbi.nlm.nih.gov/gene/{{ entrez }}" href="https://www.ncbi.nlm.nih.gov/gene/{{ entrez }}"
target="_blank" target="_blank"
> >
...@@ -89,50 +89,50 @@ ...@@ -89,50 +89,50 @@
</span> </span>
</p> </p>
<p <p
*ngIf="wrapper.data.drugId || wrapper.data.disorderId" *ngIf="_wrapper.data.drugId || _wrapper.data.disorderId"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Name:</span></b> <b><span>Name:</span></b>
<span class="is-capitalized"> {{ wrapper.data.label }}</span> <span class="is-capitalized"> {{ _wrapper.data.label }}</span>
</p> </p>
<p <p
*ngIf="wrapper.data.icd10" *ngIf="_wrapper.data.icd10"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>ICD10:</span></b> <b><span>ICD10:</span></b>
<span class="is-capitalized"> <span class="is-capitalized">
{{ {{
wrapper.data.icd10.length === 0 || _wrapper.data.icd10.length === 0 ||
(wrapper.data.icd10.length === 1 && wrapper.data.icd10[0].length === 0) (_wrapper.data.icd10.length === 1 && _wrapper.data.icd10[0].length === 0)
? "-" ? "-"
: wrapper.data.icd10 : _wrapper.data.icd10
}}</span }}</span
> >
</p> </p>
<p <p
*ngIf="wrapper.data.drugId" *ngIf="_wrapper.data.drugId"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>DrugBank:</span></b> <b><span>DrugBank:</span></b>
<a <a
href="https://go.drugbank.com/drugs/{{ wrapper.data.drugId }}" href="https://go.drugbank.com/drugs/{{ _wrapper.data.drugId }}"
target="_blank" target="_blank"
> >
<span class="is-capitalized"> {{ wrapper.data.drugId }}</span> <span class="is-capitalized"> {{ _wrapper.data.drugId }}</span>
</a> </a>
</p> </p>
<p <p
*ngIf="wrapper.data.disorderId" *ngIf="_wrapper.data.disorderId"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Mondo:</span></b> <b><span>Mondo:</span></b>
<a <a
href="https://www.ebi.ac.uk/ols/ontologies/mondo/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FMONDO_{{ href="https://www.ebi.ac.uk/ols/ontologies/mondo/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FMONDO_{{
writeZeros(7 - ('' + wrapper.data.disorderId).length) writeZeros(7 - ('' + _wrapper.data.disorderId).length)
}}{{ wrapper.data.disorderId }}" }}{{ _wrapper.data.disorderId }}"
target="_blank" target="_blank"
> >
<span class="is-capitalized"> MONDO:{{ wrapper.data.disorderId }}</span> <span class="is-capitalized"> MONDO:{{ _wrapper.data.disorderId }}</span>
</a> </a>
</p> </p>
<p <p
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
> >
</p> </p>
<p <p
*ngIf="showLinks()" *ngIf="_showLinks"
[ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }" [ngClass]="{ 'text-normal': drugstoneConfig.smallStyle }"
> >
<b><span>Links:</span></b> <b><span>Links:</span></b>
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
*ngIf="showLinkout(target.key)" *ngIf="showLinkout(target.key)"
[href]="getLinkoutURL(target.key)" [href]="getLinkoutURL(target.key)"
target="_blank" target="_blank"
class="link-icon-margin"
> >
<app-image <app-image
_class="link-icon" _class="link-icon"
...@@ -181,10 +182,9 @@ ...@@ -181,10 +182,9 @@
></app-image> ></app-image>
</a> </a>
</span> </span>
&nbsp;
<a <a
class="is-capitalized" class="link-icon-margin"
href="https://clinicaltrials.gov/ct2/results?term={{ wrapper.data.symbol }}" href="https://clinicaltrials.gov/ct2/results?term={{ _wrapper.data.symbol }}"
target="_blank" target="_blank"
> >
<app-image <app-image
...@@ -197,10 +197,10 @@ ...@@ -197,10 +197,10 @@
</p> </p>
<app-toggle <app-toggle
*ngIf="wrapper.data.drugstoneId && wrapper.data.drugstoneType === 'protein'" *ngIf="_wrapper.data.drugstoneId && _wrapper.data.drugstoneType === 'protein'"
[value]="analysis.inSelection(wrapper)" [value]="analysis.inSelection(_wrapper)"
(valueChange)=" (valueChange)="
$event ? analysis.addItems([wrapper]) : analysis.removeItems([wrapper]) $event ? analysis.addItems([_wrapper]) : analysis.removeItems([_wrapper])
" "
textOn="Selected" textOn="Selected"
textOff="Off" textOff="Off"
......
.link-icon-margin {
margin: 0 2px;
}
\ No newline at end of file
import {Component, Input, OnInit} from '@angular/core'; import { Component, Input, OnInit } from "@angular/core";
import {DrugstoneConfigService} from 'src/app/services/drugstone-config/drugstone-config.service'; import { DrugstoneConfigService } from "src/app/services/drugstone-config/drugstone-config.service";
import {Wrapper} from '../../interfaces'; import { Wrapper } from "../../interfaces";
import {AnalysisService} from '../../services/analysis/analysis.service'; import { AnalysisService } from "../../services/analysis/analysis.service";
import {NetworkHandlerService} from '../../services/network-handler/network-handler.service'; import { NetworkHandlerService } from "../../services/network-handler/network-handler.service";
import {validateComponent} from 'codelyzer/walkerFactory/walkerFn'; import { validateComponent } from "codelyzer/walkerFactory/walkerFn";
@Component({ @Component({
selector: 'app-info-tile', selector: "app-info-tile",
templateUrl: './info-tile.component.html', templateUrl: "./info-tile.component.html",
styleUrls: ['./info-tile.component.scss', '../../pages/explorer-page/explorer-page.component.scss'] styleUrls: [
"./info-tile.component.scss",
"../../pages/explorer-page/explorer-page.component.scss",
],
}) })
export class InfoTileComponent implements OnInit { export class InfoTileComponent implements OnInit {
@Input() public wrapper: Wrapper; @Input() set wrapper(wrapperObject: Wrapper) {
this._wrapper = wrapperObject;
this.checkIfShowLinks();
}
@Input() public expressions: any; @Input() public expressions: any;
public linkoutMap = {iid: 'IID'}; public linkoutMap = { iid: "IID" };
constructor(public drugstoneConfig: DrugstoneConfigService, public analysis: AnalysisService, public networkHandler: NetworkHandlerService) { public _showLinks: boolean = false;
public _wrapper?: Wrapper ;
} constructor(
public drugstoneConfig: DrugstoneConfigService,
public analysis: AnalysisService,
public networkHandler: NetworkHandlerService
) {}
ngOnInit(): void { ngOnInit(): void {}
}
public getExpressionScore() { public getExpressionScore() {
return this.expressions[this.wrapper.id]; return this.expressions[this._wrapper.id];
} }
public beautify(url: string): string { public beautify(url: string): string {
if (url.startsWith('https://')) { if (url.startsWith("https://")) {
url = url.substr('https://'.length); url = url.substr("https://".length);
} else if (url.startsWith('http://')) { } else if (url.startsWith("http://")) {
url = url.substr('http://'.length); url = url.substr("http://".length);
} }
const slashPos = url.indexOf('/'); const slashPos = url.indexOf("/");
if (slashPos !== -1) { if (slashPos !== -1) {
return url.substr(0, slashPos); return url.substr(0, slashPos);
} }
...@@ -42,43 +51,57 @@ export class InfoTileComponent implements OnInit { ...@@ -42,43 +51,57 @@ export class InfoTileComponent implements OnInit {
} }
writeZeros(n: number) { writeZeros(n: number) {
let out = ''; let out = "";
while (n > 0) { while (n > 0) {
out += '0'; out += "0";
n--; n--;
} }
return out; return out;
} }
showLinks() { public checkIfShowLinks() {
const idSpace = this.drugstoneConfig.currentConfig().identifier; const idSpace = this.drugstoneConfig.currentConfig().identifier;
const iidActive = (['symbol', 'uniprot', 'entrez'].includes(idSpace) && this.wrapper.data[idSpace] != null) || this.wrapper.data.uniprot != null; this._showLinks =
return iidActive; (["symbol", "uniprot", "entrez"].includes(idSpace) &&
this._wrapper.data[idSpace] != null) ||
this._wrapper.data.uniprot != null ||
this._wrapper.data.type === "drug";
} }
showLinkout(target) { showLinkout(target) {
const idSpace = this.drugstoneConfig.currentConfig().identifier; const idSpace = this.drugstoneConfig.currentConfig().identifier;
switch (target) { switch (target) {
case 'iid': case "iid":
return (['symbol', 'uniprot', 'entrez'].includes(idSpace) && this.wrapper.data[idSpace] != null) || this.wrapper.data.uniprot != null; return (
(["symbol", "uniprot", "entrez"].includes(idSpace) &&
this._wrapper.data[idSpace] != null) ||
this._wrapper.data.uniprot != null
);
} }
return false; return false;
} }
getIIDQuery() { getIIDQuery() {
const idSpace = this.drugstoneConfig.currentConfig().identifier; const idSpace = this.drugstoneConfig.currentConfig().identifier;
if (['symbol', 'uniprot', 'entrez'].includes(idSpace) && this.wrapper.data[idSpace] != null) { if (
return this.wrapper.data[idSpace][0]; ["symbol", "uniprot", "entrez"].includes(idSpace) &&
this._wrapper.data[idSpace] != null
) {
return this._wrapper.data[idSpace][0];
} }
return this.wrapper.data.uniprot[0]; return this._wrapper.data.uniprot[0];
} }
getLinkoutURL(target) { getLinkoutURL(target) {
// const idSpace = this.drugstoneConfig.currentConfig().identifier; // const idSpace = this.drugstoneConfig.currentConfig().identifier;
switch (target) { switch (target) {
case 'iid': case "iid":
return 'http://iid.ophid.utoronto.ca/SearchPPIs/protein/' + this.getIIDQuery(); return (
"http://iid.ophid.utoronto.ca/SearchPPIs/protein/" +
this.getIIDQuery()
);
} }
return ''; return "";
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment