Skip to content
Snippets Groups Projects
Commit 9a33cf67 authored by Maiykol's avatar Maiykol
Browse files

make nodes that are not mapped to network unavailable for selection

parent 4209322a
Branches
Tags
No related merge requests found
Pipeline #11031 failed
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</div> </div>
<app-toggle <app-toggle
*ngIf="wrapper.type !== 'drug'" *ngIf="wrapper.data.netexId && wrapper.data.netexId.startsWith('p')"
[value]="analysis.inSelection(wrapper)" [smallStyle]="smallStyle" [value]="analysis.inSelection(wrapper)" [smallStyle]="smallStyle"
(valueChange)="$event ? analysis.addItems([wrapper]) : analysis.removeItems([wrapper])" textOn="Selected" (valueChange)="$event ? analysis.addItems([wrapper]) : analysis.removeItems([wrapper])" textOn="Selected"
textOff="Deselected" tooltipOn="Add protein to selection." tooltipOff="Remove protein from selection."></app-toggle> textOff="Deselected" tooltipOn="Add protein to selection." tooltipOff="Remove protein from selection."></app-toggle>
......
...@@ -26,11 +26,13 @@ export interface NodeInteraction { ...@@ -26,11 +26,13 @@ export interface NodeInteraction {
from: string; from: string;
to: string; to: string;
group?: string; group?: string;
label?: string;
} }
export interface NetworkEdge { export interface NetworkEdge {
from: string; from: string;
to: string; to: string;
label: string;
} }
export interface Task { export interface Task {
......
...@@ -51,6 +51,7 @@ export class ProteinNetwork { ...@@ -51,6 +51,7 @@ export class ProteinNetwork {
if (typeof group === 'undefined' || typeof config.nodeGroups[group] === 'undefined') { if (typeof group === 'undefined' || typeof config.nodeGroups[group] === 'undefined') {
group = 'default'; group = 'default';
} }
console.log(config.nodeGroups[group])
let node = JSON.parse(JSON.stringify(config.nodeGroups[group])); let node = JSON.parse(JSON.stringify(config.nodeGroups[group]));
// update the node with custom node properties, including values fetched from backend // update the node with custom node properties, including values fetched from backend
...@@ -80,13 +81,23 @@ export class ProteinNetwork { ...@@ -80,13 +81,23 @@ export class ProteinNetwork {
if (typeof group === 'undefined' || typeof config.edgeGroups[group] === 'undefined') { if (typeof group === 'undefined' || typeof config.edgeGroups[group] === 'undefined') {
group = 'default'; group = 'default';
} }
const edge = JSON.parse(JSON.stringify(config.edgeGroups[group])); let edge = JSON.parse(JSON.stringify(config.edgeGroups[group]));
edge.from = customEdge.from; console.log("edge")
edge.to = customEdge.to;
console.log(edge)
console.log("customEdge")
console.log(customEdge)
edge = {
...edge,
...customEdge
}
return edge; return edge;
} }
public mapDataToNodes(config: IConfig): { nodes: any[], edges: any[]; } { public mapDataToNetworkInput(config: IConfig): { nodes: any[], edges: any[]; } {
const nodes = []; const nodes = [];
const edges = []; const edges = [];
......
...@@ -273,7 +273,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -273,7 +273,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.proteinData = new ProteinNetwork(this.proteins, this.edges); this.proteinData = new ProteinNetwork(this.proteins, this.edges);
this.proteinData.linkNodes(); this.proteinData.linkNodes();
const {nodes, edges} = this.proteinData.mapDataToNodes(this.myConfig); const {nodes, edges} = this.proteinData.mapDataToNetworkInput(this.myConfig);
this.nodeData.nodes = new vis.DataSet(nodes); this.nodeData.nodes = new vis.DataSet(nodes);
this.nodeData.edges = new vis.DataSet(edges); this.nodeData.edges = new vis.DataSet(edges);
...@@ -286,6 +286,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -286,6 +286,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
const nodeId = nodeIds[0]; const nodeId = nodeIds[0];
const node = this.nodeData.nodes.get(nodeId); const node = this.nodeData.nodes.get(nodeId);
const wrapper = getWrapperFromNode(node); const wrapper = getWrapperFromNode(node);
if (wrapper.data.netexId === undefined || !wrapper.data.netexId.startsWith('p')) {
// skip if node is not a protein mapped to backend
return
}
if (this.analysis.inSelection(node)) { if (this.analysis.inSelection(node)) {
this.analysis.removeItems([wrapper]); this.analysis.removeItems([wrapper]);
} else { } else {
......
...@@ -38,13 +38,22 @@ ...@@ -38,13 +38,22 @@
<network-expander id="netexp1" <network-expander id="netexp1"
config='{ config='{
"nodeGroups": {"0.5": {"type": "gene", "color": "rgb(204, 255, 51)", "groupName": "0.5", "shape": "circle"}, "patient_group": {"type": "patient", "color": "red", "groupName": "patient group", "shape": "circle"}}, "nodeGroups":{
"edgeGroups": {"dashes": {"color": "black", "groupName": "Dashes Group", "dashes": [1, 2]}}, "0.5":{"type":"gene","color":"#CCFF33FF","groupName":"0.5","shape":"circle"},
"identifier": "symbol" "1.5":{"type":"gene","color":"#66FF33FF","groupName":"1.5","shape":"circle"},
"2.0":{"type":"gene","color":"#33CC33FF","groupName":"2.0","shape":"circle"},
"patient_group":{"type":"gene","color":"#FF0000FF","groupName":"-2.0","shape":"circle"}
},
"edgeGroups":{
"custom":{"color":"black","groupName":"Custom Group"}
},
"identifier":"symbol",
"legendUrl":"https://exbio.wzw.tum.de/covex/assets/leg1.png"
}' }'
network='{ network='{
"nodes":[{"id":"TP53","group":"0.5"},{"id":"C5","group":"0.5"},{"id":"Patient","group":"patient_group"},{"label":"PTEN","id":"PTEN","group":0.5}], "nodes":[{"id":"TP53","group":"0.5"},{"id":"C5","group":"0.5"},{"id":"Patient","group":"patient_group"},{"label":"PTEN","id":"PTEN","group":0.5}],
"edges": [{"from": "TP53","to": "C5","group": "dashes"}] "edges":[]
}' }'
style="height: 100%; width: 100vw; display: block;" style="height: 100%; width: 100vw; display: block;"
></network-expander> ></network-expander>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment