Skip to content
Snippets Groups Projects
Commit 3c3ad9bf authored by Mhaned Oubounyt's avatar Mhaned Oubounyt
Browse files

Merge branch 'master' into 'selection'

# Conflicts:
#   src/app/pages/explorer-page/explorer-page.component.ts
parents 57a56d34 b7316203
No related branches found
No related tags found
No related merge requests found
...@@ -14,15 +14,6 @@ setup: ...@@ -14,15 +14,6 @@ setup:
script: script:
- npm install - npm install
check:audit:
image: trion/ng-cli-karma
stage: check
script:
- npm install
- npm audit --production
dependencies:
- setup
check:lint: check:lint:
image: trion/ng-cli-karma image: trion/ng-cli-karma
stage: check stage: check
...@@ -51,7 +42,6 @@ build: ...@@ -51,7 +42,6 @@ build:
- npm install - npm install
- npm run build - npm run build
dependencies: dependencies:
- check:audit
- check:lint - check:lint
- check:test - check:test
......
...@@ -129,4 +129,4 @@ ...@@ -129,4 +129,4 @@
"cli": { "cli": {
"analytics": "bb00cc29-2ec5-4bd5-9235-62ac2e9e51b5" "analytics": "bb00cc29-2ec5-4bd5-9235-62ac2e9e51b5"
} }
} }
\ No newline at end of file
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" class="checkbox" [ngModel]="bait.checked" <input type="checkbox" class="checkbox" [ngModel]="bait.checked"
(ngModelChange)="bait.checked = $event; filterNodes()"> (ngModelChange)="bait.checked = $event; filterNodes()">
Bait {{ bait.data.effectId }} {{ bait.data.effectName }}
</label> </label>
</div> </div>
</div> </div>
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
<button class="button is-primary" *ngIf="!inSelection(currentProteinAc)" <button class="button is-primary" *ngIf="!inSelection(currentProteinAc)"
(click)="addToSelection(currentProteinAc)">Select for analysis (click)="addToSelection(currentProteinAc)">Select for analysis
</button> </button>
<button class="button is-primary" *ngIf="inSelection(currentProteinAc)" <button class="button is-danger" *ngIf="inSelection(currentProteinAc)"
(click)="removeFromSelection(currentProteinAc)">Remove from analysis (click)="removeFromSelection(currentProteinAc)">Remove from analysis
</button> </button>
</div> </div>
......
...@@ -186,11 +186,19 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -186,11 +186,19 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.proteinData.linkNodes(); this.proteinData.linkNodes();
// Populate baits // Populate baits
const effectNames = [];
this.proteinData.effects.sort((a, b) => {
return a.effectName.localeCompare(b.effectName);
});
this.proteinData.effects.forEach((effect) => { this.proteinData.effects.forEach((effect) => {
this.viralProteinCheckboxes.push({ const effectName = effect.effectName;
checked: false, if (effectNames.indexOf(effectName) === -1) {
data: effect, effectNames.push(effectName);
}); this.viralProteinCheckboxes.push({
checked: false,
data: effect,
});
}
}); });
const {nodes, edges} = this.mapDataToNodes(this.proteinData); const {nodes, edges} = this.mapDataToNodes(this.proteinData);
...@@ -217,10 +225,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -217,10 +225,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.network.on('click', (properties) => { this.network.on('click', (properties) => {
const id: Array<string> = properties.nodes; const id: Array<string> = properties.nodes;
// TODO use groupID // TODO use groupID
console.log(id);
console.log(this.watcher);
if (id.length > 0) { if (id.length > 0) {
console.log('clicked node:', id);
if (id[0].startsWith('pg_')) { if (id[0].startsWith('pg_')) {
const protein = this.proteinData.getProtein(id[0].substr(3)); const protein = this.proteinData.getProtein(id[0].substr(3));
this.openSummary(protein, false); this.openSummary(protein, false);
...@@ -242,6 +247,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -242,6 +247,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
if (this.dumpPositions) { if (this.dumpPositions) {
this.network.on('stabilizationIterationsDone', () => { this.network.on('stabilizationIterationsDone', () => {
// tslint:disable-next-line:no-console
console.log(JSON.stringify(this.network.getPositions())); console.log(JSON.stringify(this.network.getPositions()));
}); });
this.network.stabilize(); this.network.stabilize();
...@@ -264,26 +270,32 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -264,26 +270,32 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
const addNodes = new Map<string, Node>(); const addNodes = new Map<string, Node>();
const showAll = !this.viralProteinCheckboxes.find((eff) => eff.checked); const showAll = !this.viralProteinCheckboxes.find((eff) => eff.checked);
console.log(showAll);
const connectedProteinAcs = new Set<string>(); const connectedProteinAcs = new Set<string>();
this.viralProteinCheckboxes.forEach((bait) => { this.viralProteinCheckboxes.forEach((cb) => {
const nodeId = `eff_${bait.data.effectId}`; const effects = [];
const found = visibleIds.has(nodeId); this.proteinData.effects.forEach((effect) => {
if ((bait.checked || showAll) && !found) { if (effect.effectName === cb.data.effectName) {
const node = this.mapEffectToNode(bait.data); effects.push(effect);
// this.nodeData.nodes.add(node); }
addNodes.set(node.id, node); });
} else if ((!showAll && !bait.checked) && found) { effects.forEach((effect) => {
// this.nodeData.nodes.remove(nodeId); const nodeId = `eff_${effect.effectId}`;
removeIds.add(nodeId); const found = visibleIds.has(nodeId);
} if ((cb.checked || showAll) && !found) {
if (bait.checked || showAll) { const node = this.mapEffectToNode(effect);
bait.data.proteins.forEach((pg) => { // this.nodeData.nodes.add(node);
connectedProteinAcs.add(pg.proteinAc); 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 = []; this.filteredProteins = [];
for (const protein of this.proteinData.proteins) { for (const protein of this.proteinData.proteins) {
...@@ -296,7 +308,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -296,7 +308,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
if (contains && !found) { if (contains && !found) {
const node = this.mapProteinToNode(protein); const node = this.mapProteinToNode(protein);
// this.nodeData.nodes.add(node); // this.nodeData.nodes.add(node);
addNodes.set(node.id, node); addNodes.set(node.id, node);
} else if (!contains && found) { } else if (!contains && found) {
// this.nodeData.nodes.remove(nodeId); // this.nodeData.nodes.remove(nodeId);
...@@ -304,11 +315,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -304,11 +315,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
} }
} }
this.nodeData.nodes.remove(Array.from(removeIds.values())); this.nodeData.nodes.remove(Array.from(removeIds.values()));
this.nodeData.nodes.add(Array.from(addNodes.values())); this.nodeData.nodes.add(Array.from(addNodes.values()));
this.fillQueryItems(); this.fillQueryItems();
} }
public updatePhysicsEnabled() { public updatePhysicsEnabled() {
......
...@@ -12,4 +12,5 @@ if (environment.production) { ...@@ -12,4 +12,5 @@ if (environment.production) {
} }
platformBrowserDynamic().bootstrapModule(AppModule) platformBrowserDynamic().bootstrapModule(AppModule)
// tslint:disable-next-line:no-console
.catch(err => console.error(err)); .catch(err => console.error(err));
...@@ -44,14 +44,7 @@ ...@@ -44,14 +44,7 @@
} }
], ],
"no-consecutive-blank-lines": false, "no-consecutive-blank-lines": false,
"no-console": [ "no-console": true,
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false, "no-empty": false,
"no-inferrable-types": [ "no-inferrable-types": [
true, true,
...@@ -88,4 +81,4 @@ ...@@ -88,4 +81,4 @@
"rulesDirectory": [ "rulesDirectory": [
"codelyzer" "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