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"> <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"> 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"> <ng-template ng-option-tmp let-item="item">
<p>{{item.data.label}}</p> <span>{{item.data.label}}</span>
</ng-template> </ng-template>
</ng-select> </ng-select>
</div> </div>
ng-select {
font-family: roboto;
}
\ No newline at end of file
...@@ -14,14 +14,22 @@ export class QueryTileComponent { ...@@ -14,14 +14,22 @@ export class QueryTileComponent {
querySearch(term: string, item: Wrapper) { querySearch(term: string, item: Wrapper) {
term = term.toLowerCase(); term = term.toLowerCase();
const data = item.data as Node; const data = JSON.parse(JSON.stringify(item.data));
if (data.netexId === undefined) { // add possible missing attributes to not throw errors
return data.label.toLowerCase().indexOf(term) > -1 || data.id.toLowerCase().indexOf(term) > -1 if (data.ensg === undefined) {data.ensg = []};
} else { 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()) data.ensg = data.ensg.map(x => x.toLowerCase())
return data.symbol.toLowerCase().indexOf(term) > -1 || data.uniprotAc.toLowerCase().indexOf(term) > -1 || 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.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) { select(item) {
......
@charset "utf-8"; @charset "utf-8";
@import url('https://fonts.googleapis.com/css?family=Varela+Round'); @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/bulma.sass";
@import '~bulma-tooltip'; @import '~bulma-tooltip';
@import "~animate.css/animate.min"; @import "~animate.css/animate.min";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment