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

query node in analysis network and more query term

parent e9eea220
No related branches found
No related tags found
No related merge requests found
<div class="content">
<ng-select [items]="queryItems" bindLabel="label" bindValue="data" [virtualScroll]="true" class="custom"
<ng-select [items]="queryItems" bindLabel="data.label" bindValue="data.label" [virtualScroll]="true" class="custom"
placeholder="Search..." [hideSelected]="true" [searchFn]="querySearch" (change)="select($event)" pTooltip="Find nodes in the network." tooltipPosition="top">
<ng-template ng-option-tmp let-item="item">
<p>{{item.data.label}}</p>
<span>{{item.data.label}}</span>
</ng-template>
</ng-select>
</div>
ng-select {
font-family: roboto;
}
\ No newline at end of file
......@@ -14,14 +14,22 @@ export class QueryTileComponent {
querySearch(term: string, item: Wrapper) {
term = term.toLowerCase();
const data = item.data as Node;
if (data.netexId === undefined) {
return data.label.toLowerCase().indexOf(term) > -1 || data.id.toLowerCase().indexOf(term) > -1
} else {
data.ensg = data.ensg.map(x => x.toLowerCase())
return data.symbol.toLowerCase().indexOf(term) > -1 || data.uniprotAc.toLowerCase().indexOf(term) > -1 ||
data.label.toLowerCase().indexOf(term) > -1 || data.ensg.includes(term) || data.id.toLowerCase().indexOf(term) > -1 ;
}
const data = JSON.parse(JSON.stringify(item.data));
// add possible missing attributes to not throw errors
if (data.ensg === undefined) {data.ensg = []};
if (data.groupName === undefined) {data.groupName = ''};
if (data.type === undefined) {data.type = ''};
if (data.symbol === undefined) {data.symbol = ''};
if (data.proteinName === undefined) {data.proteinName = ''};
if (data.uniprotAc === undefined) {data.uniprotAc = ''};
if (data.drugId === undefined) {data.drugId = ''};
data.ensg = data.ensg.map(x => x.toLowerCase())
return data.symbol.toLowerCase().indexOf(term) > -1 || data.uniprotAc.toLowerCase().indexOf(term) > -1 ||
data.label.toLowerCase().indexOf(term) > -1 || data.ensg.includes(term) || data.id.toLowerCase().indexOf(term) > -1
|| data.proteinName.toLowerCase().indexOf(term) > -1 || data.type.toLowerCase().indexOf(term) > -1 ||
data.groupName.toLowerCase().indexOf(term) > -1 || data.drugId.toLowerCase().indexOf(term) > -1;
}
select(item) {
......
@charset "utf-8";
@import url('https://fonts.googleapis.com/css?family=Varela+Round');
@import "~@ng-select/ng-select/themes/material.theme.css";
@import "~bulma/bulma.sass";
@import '~bulma-tooltip';
@import "~animate.css/animate.min";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment