Skip to content
Snippets Groups Projects
Commit 2cd3feb5 authored by Hartung, Michael's avatar Hartung, Michael
Browse files

allow no group object in groups and config

parent 75ae5ff8
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,10 @@
.is-text-align-justify {
text-align: justify
}
.modal-card {
border-top-left-radius: 6px;
border-top-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
......@@ -5,6 +5,8 @@
bottom: 0;
z-index: $privacy-banner-z;
width: 100%;
padding-left: 0;
padding-right: 0;
&.disabled {
display: none;
}
......
......@@ -66,7 +66,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
}
this._groups = groups;
if (this.id !== null) {
this.activateConfig();
this.activateConfig(true);
}
}
......@@ -80,7 +80,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
} catch {
console.log('ERROR: Failed parsing input network');
}
this.activateConfig();
this.activateConfig(true);
}
@Output()
......@@ -188,7 +188,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
}
}
public activateConfig() {
public activateConfig(updateNetworkFlag=false) {
let configObj = typeof this._config === 'string' ? this._config.length === 0 ? {} : JSON5.parse(this._config) : this._config;
const groupsObj = typeof this._groups === 'string' ? this._groups.length === 0 ? {} : JSON5.parse(this._groups) : this._groups;
......@@ -201,7 +201,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
// update Drugst.One according to the settings
// check if config updates affect network
let updateNetworkFlag = false;
for (const key of Object.keys(configObj)) {
if (key === 'nodeGroups') {
this.setConfigNodeGroup(key, configObj[key]);
......@@ -232,6 +231,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.networkHandler.updateAdjacentNodes();
});
}
}
analysisWindowChanged($event: [any[], [Node[], Tissue], NodeInteraction[]]) {
......@@ -255,7 +255,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
*/
public async createNetwork() {
this.analysis.resetSelection();
this.networkHandler.activeNetwork.selectedWrapper = null;
// getNetwork synchronizes the input network with the database
await this.getNetwork();
......@@ -308,7 +307,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
if (!this.drugstoneConfig.selfReferences) {
edges = edges.filter(el => el.from !== el.to);
}
this.nodeData.nodes = new vis.DataSet(nodes);
this.nodeData.edges = new vis.DataSet(edges);
const container = this.networkHandler.activeNetwork.networkEl.nativeElement;
......@@ -473,9 +471,9 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
*/
public setConfigNodeGroup(key: string, nodeGroups: { [key: string]: NodeGroup } | {}) {
// make sure that return-groups (seeds, drugs, found nodes) are set
const defaultNodeGroups = JSON.parse(JSON.stringify(defaultConfig.nodeGroups));
// const defaultNodeGroups = JSON.parse(JSON.stringify(defaultConfig.nodeGroups));
// user merge function to do deep merge
nodeGroups = merge(defaultNodeGroups, nodeGroups);
// nodeGroups = merge(defaultNodeGroups, nodeGroups);
// make sure all keys are set
Object.entries(nodeGroups).forEach(([key, group]) => {
......@@ -535,8 +533,8 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
*/
public setConfigEdgeGroup(key: string, edgeGroups: { [key: string]: EdgeGroup }) {
// make sure that default-groups are set
const defaultNodeGroups = JSON.parse(JSON.stringify(defaultConfig.edgeGroups));
edgeGroups = merge(defaultNodeGroups, edgeGroups);
// const defaultNodeGroups = JSON.parse(JSON.stringify(defaultConfig.edgeGroups));
// edgeGroups = merge(defaultNodeGroups, edgeGroups);
// // do not allow '_' in node Group names since it causes problems with backend
// edgeGroups = removeUnderscoreFromKeys(edgeGroups)
......
......@@ -116,11 +116,11 @@ Export As Graphml Button<br>
<!-- network='{"nodes": [{"id":"PSEN1","group":"Protein","label":"PSEN1"},{"id":"PSEN2","group":"Protein","label":"PSEN2"},{"id":"APP","group":"Protein","label":"APP"},{"id":"APOE","group":"Protein","label":"APOE"},{"id":"RNF32","group":"Protein","label":"RNF32"},{"id":"STX5","group":"Protein","label":"STX5"},{"id":"TRAF3IP1","group":"Protein","label":"TRAF3IP1"},{"id":"PHB1","group":"Protein","label":"PHB1"},{"id":"MAPT","group":"Protein","label":"MAPT"},{"id":"ESR1","group":"Protein","label":"ESR1"},{"id":"IRF3","group":"Protein","label":"IRF3"},{"id":"DYNC1H1","group":"Protein","label":"DYNC1H1"},{"id":"CUL3","group":"Protein","label":"CUL3"},{"id":"HMGB1","group":"Protein","label":"HMGB1"},{"id":"DNAJC7","group":"Protein","label":"DNAJC7"},{"id":"NEFM","group":"Protein","label":"NEFM"},{"id":"DISC1","group":"Protein","label":"DISC1"},{"id":"PPP5C","group":"Protein","label":"PPP5C"},{"id":"CTNNB1","group":"Protein","label":"CTNNB1"},{"id":"KRAS","group":"Protein","label":"KRAS"}]}'-->
<!-- ></drugst-one>-->
<drugst-one id="netexp1"
<drugst-one id="netexp1"
pluginId="2"
groups='{"nodeGroups":{"patient":{"type":"patient","color":"#000000","font":{"color":"#000000"},"groupName":"Patient","shape":"image","image":"https://static.thenounproject.com/png/22780-200.png"},"condition":{"type":"condition","color":"#000000","font":{"color":"#000000"},"groupName":"Condition","shape":"text"},"important":{"type":"gene","color":"#ff881f","font":{"color":"#000000"},"groupName":"Important Gene","shape":"star"},"gene":{"type":"gene","color":"#ff084e","font":{"color":"#000000"},"groupName":"Gene","shape":"diamond"},"foundDrug":{"type":"drug","color":"#F12590","font":{"color":"#000000"},"groupName":"Drug","shape":"diamond"}},"edgeGroups":{"genotype":{"color":"#000000","groupName":"Relevant Gene"},"has-condition":{"color":"#000000","groupName":"Has Condition","dashes":[2,2]},"default":{"color":"#000000","groupName":"default edge"},"ggi":{"color":"#000000","groupName":"Interaction","dashes":[3,2]}}}'
config='{"identifier":"entrez","title":"Breast cancer example network","nodeShadow":true,"edgeShadow":false,"autofillEdges":true,"interactionProteinProtein":"STRING","licensedDatasets":true,"selfReferences":false,"nodeGroups":{"patient":{"type":"patient","color":"#000000","font":{"color":"#000000"},"groupName":"Patient","shape":"image","image":"https://static.thenounproject.com/png/22780-200.png"},"condition":{"type":"condition","color":"#000000","font":{"color":"#000000"},"groupName":"Condition","shape":"text"},"important":{"type":"gene","color":"#ff881f","font":{"color":"#000000"},"groupName":"Important Gene","shape":"star"},"gene":{"type":"gene","color":"#ff084e","font":{"color":"#000000"},"groupName":"Gene","shape":"diamond"},"foundDrug":{"type":"drug","color":"#F12590","font":{"color":"#000000"},"groupName":"Drug","shape":"diamond"}}}'
network='{"nodes":[{"id":"7040","group":"gene","label":"7040"},{"id":"7132","group":"gene","label":"7132"},{"id":"51164","group":"gene","label":"51164"},{"id":"6338","group":"gene","label":"6338"},{"id":"6337","group":"gene","label":"6337"},{"id":"6340","group":"gene","label":"6340"},{"id":"2212","group":"gene","label":"2212"},{"id":"2022","group":"gene","label":"2022"},{"id":"6804","group":"gene","label":"6804"},{"id":"1080","group":"gene","label":"1080"},{"id":"22802","group":"gene","label":"22802"}],"edges":[{"from":"BRCA1","to":"BRCA2","group":"ggi"},{"from":"ATM","to":"BARD1","group":"ggi"},{"from":"BRCA1","to":"CHEK2","group":"ggi"},{"from":"RAD51C","to":"RAD51D","group":"ggi"},{"from":"STK11","to":"TP53","group":"ggi"},{"from":"TP53","to":"PALB2","group":"ggi"},{"from":"TP53","to":"RAD51D","group":"ggi"},{"from":"TP53","to":"NF1","group":"ggi"},{"from":"TP53","to":"BRCA1","group":"ggi"},{"from":"TP53","to":"BRCA2","group":"ggi"},{"from":"PTEN","to":"BRCA1","group":"ggi"},{"from":"PTEN","to":"BRCA2","group":"ggi"},{"from":"TP53","to":"PTEN","group":"ggi"},{"from":"ATM","to":"PTEN","group":"ggi"},{"from":"CDH1","to":"RAD51D","group":"ggi"},{"from":"CDH1","to":"PALB2","group":"ggi"},{"from":"NBN","to":"BRIP1","group":"ggi"},{"from":"BRIP1","to":"PTEN","group":"ggi"},{"from":"patient-1","to":"BRCA1","group":"genotype"},{"from":"patient-1","to":"TP53","group":"genotype"},{"from":"patient-1","to":"BRCA2","group":"genotype"},{"from":"patient-1","to":"PTEN","group":"genotype"},{"from":"patient-2","to":"TP53","group":"genotype"},{"from":"patient-2","to":"NF1","group":"genotype"},{"from":"patient-2","to":"BARD1","group":"genotype"},{"from":"patient-3","to":"TP53","group":"genotype"},{"from":"patient-3","to":"PTEN","group":"genotype"},{"from":"patient-3","to":"NBN","group":"genotype"},{"from":"patient-1","to":"subtype-1","group":"has-condition"},{"from":"patient-2","to":"subtype-1","group":"has-condition"},{"from":"patient-3","to":"subtype-2","group":"has-condition"}]}'>
groups='{}'
config='{"identifier":"entrez","title":"Breast cancer example network","nodeShadow":true,"edgeShadow":false,"autofillEdges":true,"interactionProteinProtein":"STRING","licensedDatasets":true,"selfReferences":false}'
network='{"nodes":[{"id":"7040","label":"7040"}]}'>
</drugst-one>
......
......@@ -63,7 +63,7 @@ $b-text-smaller-font-size: 12px;
$text-normal-font-size: 12px;
$text-small-font-size: 11px;
$privacy-banner-z: 100;
$privacy-banner-z: 40;
$fullscreen-z: 2147483646;
$toast-z: 2147483647;
......
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