From 2ebbcadf3834f12861bcead2e9f854df51ba693b Mon Sep 17 00:00:00 2001
From: AndiMajore <andi.majore@googlemail.com>
Date: Tue, 28 Sep 2021 12:55:26 +0200
Subject: [PATCH] allowing also objects as config or network and not only
 strings

---
 .../launch-analysis/launch-analysis.component.ts  |  6 +++---
 .../explorer-page/explorer-page.component.ts      | 15 +++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/app/dialogs/launch-analysis/launch-analysis.component.ts b/src/app/dialogs/launch-analysis/launch-analysis.component.ts
index a4436c8f..38ef3ecd 100644
--- a/src/app/dialogs/launch-analysis/launch-analysis.component.ts
+++ b/src/app/dialogs/launch-analysis/launch-analysis.component.ts
@@ -120,9 +120,9 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
     parameters.target = this.target === 'drug' ? 'drug' : 'drug-target';
     // pass network data to reconstruct network in analysis result to connect non-proteins to results
     // drop interactions in nodes beforehand to no cause cyclic error, information is contained in edges
-    // this.inputNetwork.nodes.forEach(node => {
-    //   delete node.interactions
-    // });
+    this.inputNetwork.nodes.forEach(node => {
+      delete node.interactions
+    });
 
     if (this.algorithm === 'trustrank') {
       parameters.damping_factor = this.trustrankDampingFactor;
diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts
index 1fec33d4..d5ac088e 100644
--- a/src/app/pages/explorer-page/explorer-page.component.ts
+++ b/src/app/pages/explorer-page/explorer-page.component.ts
@@ -26,7 +26,7 @@ import domtoimage from 'dom-to-image';
 import {NetworkSettings} from '../../network-settings';
 import {defaultConfig, EdgeGroup, IConfig, InteractionDatabase, NodeGroup} from '../../config';
 import {NetexControllerService} from 'src/app/services/netex-controller/netex-controller.service';
-import {downLoadFile, removeDuplicateObjectsFromList} from '../../utils'
+import {downLoadFile, removeDuplicateObjectsFromList} from '../../utils';
 import * as merge from 'lodash/fp/merge';
 import {AnalysisPanelComponent} from 'src/app/components/analysis-panel/analysis-panel.component';
 
@@ -53,8 +53,8 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
   public id: undefined | string;
 
   @Input()
-  public set config(config: string | undefined) {
-    if (typeof config === 'undefined') {
+  public set config(config: string | undefined |object) {
+    if (config== null) {
       return;
     }
     if (this.id == null)
@@ -62,7 +62,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
         this.config = config;
       }, 200);
     // add settings to config
-    const configObj = JSON.parse(config);
+    const configObj = typeof config === 'object' ? config : JSON.parse(config);
     this.myConfig = merge(this.myConfig, configObj);
 
     // update Drugst.One according to the settings
@@ -108,12 +108,11 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
   }
 
   @Input()
-  public set network(network: string | undefined) {
-    if (typeof network === 'undefined') {
+  public set network(network: string | undefined | object) {
+    if (network == null) {
       return;
     }
-
-    this.networkJSON = network;
+    this.networkJSON = typeof network === 'object' ? JSON.stringify(network) : network ;
     this.createNetwork();
   }
 
-- 
GitLab