diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b0174d9e3ba7f9f863a8a3284ce4eec31c61d7d7..0dbc0b0b6efe5e924e9b945f971159b4ae4d2ae8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,15 +14,6 @@ setup: script: - npm install -check:audit: - image: trion/ng-cli-karma - stage: check - script: - - npm install - - npm audit --production - dependencies: - - setup - check:lint: image: trion/ng-cli-karma stage: check @@ -51,7 +42,6 @@ build: - npm install - npm run build dependencies: - - check:audit - check:lint - check:test diff --git a/angular.json b/angular.json index 8b3458c4f7f3b0438169a8d20b21e12de1a04367..10b05b83ca1af92cce70ec6b0e7b478f9a663821 100644 --- a/angular.json +++ b/angular.json @@ -129,4 +129,4 @@ "cli": { "analytics": "bb00cc29-2ec5-4bd5-9235-62ac2e9e51b5" } -} \ No newline at end of file +} diff --git a/src/app/pages/explorer-page/explorer-page.component.html b/src/app/pages/explorer-page/explorer-page.component.html index ae186f154578ac8dc16b6dce2ca68dad827f59da..30faf00d6839be5b306cf638cba752c51692eb84 100644 --- a/src/app/pages/explorer-page/explorer-page.component.html +++ b/src/app/pages/explorer-page/explorer-page.component.html @@ -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> @@ -174,7 +174,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> diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts index fed34450d297fb91d65da74b9fe115e68c0c9843..3c030edd5784db3d7d4b8f9194791d597c69e704 100644 --- a/src/app/pages/explorer-page/explorer-page.component.ts +++ b/src/app/pages/explorer-page/explorer-page.component.ts @@ -186,11 +186,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); @@ -217,10 +225,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { this.network.on('click', (properties) => { const id: Array<string> = properties.nodes; // TODO use groupID - console.log(id); - console.log(this.watcher); 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); @@ -242,6 +247,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(); @@ -264,26 +270,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) { @@ -296,7 +308,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); @@ -304,11 +315,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() { diff --git a/src/main.ts b/src/main.ts index d9eac7e088b7e4b9b3a77b0e91ef02a00e7dab57..6e7e3153499e6ce1ad3530adf5c96478e86b4a87 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,4 +12,5 @@ if (environment.production) { } platformBrowserDynamic().bootstrapModule(AppModule) + // tslint:disable-next-line:no-console .catch(err => console.error(err)); diff --git a/tslint.json b/tslint.json index c8d70f15200546102f7f9f7192ec8290d9bb6d0a..8f6066bace2e689e1ebcebaf493d2578ac93f1c3 100644 --- a/tslint.json +++ b/tslint.json @@ -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 +}