Skip to content
Snippets Groups Projects
Commit 0994fd84 authored by Julian Späth's avatar Julian Späth Committed by Julian Matschinske
Browse files

Accumulate bait filters

parent 8ed9293e
No related branches found
No related tags found
No related merge requests found
......@@ -129,4 +129,4 @@
"cli": {
"analytics": "bb00cc29-2ec5-4bd5-9235-62ac2e9e51b5"
}
}
\ No newline at end of file
}
......@@ -74,7 +74,7 @@
<label class="checkbox">
<input type="checkbox" class="checkbox" [ngModel]="bait.checked"
(ngModelChange)="bait.checked = $event; filterNodes()">
Bait {{ bait.data.effectId }}
{{ bait.data.effectName }}
</label>
</div>
</div>
......@@ -173,7 +173,7 @@
<button class="button is-primary" *ngIf="!inSelection(currentProteinAc)"
(click)="addToSelection(currentProteinAc)">Select for analysis
</button>
<button class="button is-primary" *ngIf="inSelection(currentProteinAc)"
<button class="button is-danger" *ngIf="inSelection(currentProteinAc)"
(click)="removeFromSelection(currentProteinAc)">Remove from analysis
</button>
</div>
......
......@@ -157,11 +157,19 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.proteinData.linkNodes();
// Populate baits
const effectNames = [];
this.proteinData.effects.sort((a, b) => {
return a.effectName.localeCompare(b.effectName);
});
this.proteinData.effects.forEach((effect) => {
this.viralProteinCheckboxes.push({
checked: false,
data: effect,
});
const effectName = effect.effectName;
if (effectNames.indexOf(effectName) === -1) {
effectNames.push(effectName);
this.viralProteinCheckboxes.push({
checked: false,
data: effect,
});
}
});
const {nodes, edges} = this.mapDataToNodes(this.proteinData);
......@@ -188,9 +196,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.network.on('click', (properties) => {
const id: Array<string> = properties.nodes;
// TODO use groupID
console.log(id);
if (id.length > 0) {
console.log('clicked node:', id);
if (id[0].startsWith('pg_')) {
const protein = this.proteinData.getProtein(id[0].substr(3));
this.openSummary(protein, false);
......@@ -202,6 +208,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
if (this.dumpPositions) {
this.network.on('stabilizationIterationsDone', () => {
// tslint:disable-next-line:no-console
console.log(JSON.stringify(this.network.getPositions()));
});
this.network.stabilize();
......@@ -224,26 +231,32 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
const addNodes = new Map<string, Node>();
const showAll = !this.viralProteinCheckboxes.find((eff) => eff.checked);
console.log(showAll);
const connectedProteinAcs = new Set<string>();
this.viralProteinCheckboxes.forEach((bait) => {
const nodeId = `eff_${bait.data.effectId}`;
const found = visibleIds.has(nodeId);
if ((bait.checked || showAll) && !found) {
const node = this.mapEffectToNode(bait.data);
// this.nodeData.nodes.add(node);
addNodes.set(node.id, node);
} else if ((!showAll && !bait.checked) && found) {
// this.nodeData.nodes.remove(nodeId);
removeIds.add(nodeId);
}
if (bait.checked || showAll) {
bait.data.proteins.forEach((pg) => {
connectedProteinAcs.add(pg.proteinAc);
});
}
this.viralProteinCheckboxes.forEach((cb) => {
const effects = [];
this.proteinData.effects.forEach((effect) => {
if (effect.effectName === cb.data.effectName) {
effects.push(effect);
}
});
effects.forEach((effect) => {
const nodeId = `eff_${effect.effectId}`;
const found = visibleIds.has(nodeId);
if ((cb.checked || showAll) && !found) {
const node = this.mapEffectToNode(effect);
// this.nodeData.nodes.add(node);
addNodes.set(node.id, node);
} else if ((!showAll && !cb.checked) && found) {
// this.nodeData.nodes.remove(nodeId);
removeIds.add(nodeId);
}
if (cb.checked || showAll) {
effect.proteins.forEach((pg) => {
connectedProteinAcs.add(pg.proteinAc);
});
}
});
});
this.filteredProteins = [];
for (const protein of this.proteinData.proteins) {
......@@ -256,7 +269,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
if (contains && !found) {
const node = this.mapProteinToNode(protein);
// this.nodeData.nodes.add(node);
addNodes.set(node.id, node);
} else if (!contains && found) {
// this.nodeData.nodes.remove(nodeId);
......@@ -264,11 +276,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
}
}
this.nodeData.nodes.remove(Array.from(removeIds.values()));
this.nodeData.nodes.add(Array.from(addNodes.values()));
this.fillQueryItems();
}
}
public updatePhysicsEnabled() {
......
......@@ -12,4 +12,5 @@ if (environment.production) {
}
platformBrowserDynamic().bootstrapModule(AppModule)
// tslint:disable-next-line:no-console
.catch(err => console.error(err));
......@@ -44,14 +44,7 @@
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-console": true,
"no-empty": false,
"no-inferrable-types": [
true,
......@@ -88,4 +81,4 @@
"rulesDirectory": [
"codelyzer"
]
}
\ No newline at end of file
}
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