From 3b76f4fe15c34e526b519d679daa96b9039423c2 Mon Sep 17 00:00:00 2001
From: Maiykol <hartung.michael@outlook.com>
Date: Sun, 20 Jun 2021 18:24:27 +0200
Subject: [PATCH] rename node attribute name to label in user input; make node
 attrbitute label optional, defaults to ID; Double identifier might be
 problematic, if node label is e.g. gene symbol, then it will be displayed
 twice in detail information, once as label and once as symbol

---
 .../info-tile/info-tile.component.html          |  6 +++---
 src/app/main-network.ts                         | 17 +++++------------
 src/index.html                                  |  2 +-
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/app/components/info-tile/info-tile.component.html b/src/app/components/info-tile/info-tile.component.html
index 73c8bf37..43201efb 100644
--- a/src/app/components/info-tile/info-tile.component.html
+++ b/src/app/components/info-tile/info-tile.component.html
@@ -1,8 +1,8 @@
 <div *ngIf="wrapper">
   <div>
-    <p *ngIf="wrapper.data.name" [ngClass]="{'text-normal':smallStyle}">
-      <b><span>Name:</span></b>
-      <span class="is-capitalized"> {{ wrapper.data.name }}</span>
+    <p *ngIf="wrapper.data.label" [ngClass]="{'text-normal':smallStyle}">
+      <b><span>Label:</span></b>
+      <span class="is-capitalized"> {{ wrapper.data.label }}</span>
     </p>
     <p *ngIf="wrapper.data.symbol" [ngClass]="{'text-normal':smallStyle}">
       <b><span>Symbol:</span></b>
diff --git a/src/app/main-network.ts b/src/app/main-network.ts
index 63d349fb..869a372e 100644
--- a/src/app/main-network.ts
+++ b/src/app/main-network.ts
@@ -53,6 +53,9 @@ export class ProteinNetwork {
     }
     let node = JSON.parse(JSON.stringify(config.nodeGroups[group]));
 
+    // remove group name
+    delete node.name
+
     // node.name is actually group name since it comes from the group configuration
     // this property is already stored in the wrapper object
     // instead, node.name should reflect the actual node name
@@ -64,22 +67,12 @@ export class ProteinNetwork {
     }
 
     // label is only used for network visualization
-    let nodeLabel = customNode.name;
-    if (customNode.name.length === 0) {
-      nodeLabel = customNode.userId;
-    }
+    node.label = customNode.label ? customNode.label : customNode.id;
 
     if (node.image) {
       node.shape = 'image';
     }
-    node.label = nodeLabel;
-    // node.id = customNode.id;
-    // node.x = customNode.x;
-    // node.y = customNode.y;
-    // node.uniprotAc = customNode.uniprotAc;
-    // node.netexId = customNode.netexId;
-    // node.ensg = customNode.ensg;
-    // console.log(node)
+    
     return node;
   }
 
diff --git a/src/index.html b/src/index.html
index 65f8f542..f8606382 100644
--- a/src/index.html
+++ b/src/index.html
@@ -44,7 +44,7 @@
                       "legendUrl": "https://exbio.wzw.tum.de/covex/assets/leg1.png"
                     }'
                     network='{
-                      "nodes": [{"name": "ENSG00000171862", "id": "ENSG00000171862", "group": "0.5"}, {"name": "ENSG00000284792", "id": "ENSG00000284792", "group": 0.5}],
+                      "nodes": [{"id": "ENSG00000171862", "group": "0.5"}, {"label": "ENSG00000284792", "id": "ENSG00000284792", "group": 0.5}],
                       "edges": []
                     }'
                     style="height: 100%; width: 100vw; display: block;"
-- 
GitLab