Skip to content
Snippets Groups Projects
Commit c995bea8 authored by AndiMajore's avatar AndiMajore
Browse files

fixed rendering issues

parent 1d793bac
No related branches found
No related tags found
No related merge requests found
...@@ -200,7 +200,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit ...@@ -200,7 +200,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit
this.nodeData.edges = new vis.DataSet(edges); this.nodeData.edges = new vis.DataSet(edges);
const container = this.networkHandler.activeNetwork.networkEl.nativeElement; const container = this.networkHandler.activeNetwork.networkEl.nativeElement;
const isBig = nodes.length > 100 || edges.length > 100; const isBig = nodes.length > 100 || edges.length > 100;
const options = NetworkSettings.getOptions(isBig ? 'analysis-big' : 'analysis', this.myConfig.physicsOn); const options = NetworkSettings.getOptions(isBig ? 'analysis-big' : 'analysis', this.myConfig);
// @ts-ignore // @ts-ignore
options.groups = this.drugstoneConfig.config.nodeGroups; options.groups = this.drugstoneConfig.config.nodeGroups;
// @ts-ignore // @ts-ignore
...@@ -208,7 +208,6 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit ...@@ -208,7 +208,6 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit
// @ts-ignore // @ts-ignore
delete g.renderer delete g.renderer
} }
console.log(options)
this.drugstoneConfig.config.physicsOn = !isBig; this.drugstoneConfig.config.physicsOn = !isBig;
this.networkHandler.activeNetwork.networkInternal = new vis.Network(container, this.nodeData, options); this.networkHandler.activeNetwork.networkInternal = new vis.Network(container, this.nodeData, options);
this.networkHandler.activeNetwork.networkInternal.on('stabilizationIterationsDone', () => { this.networkHandler.activeNetwork.networkInternal.on('stabilizationIterationsDone', () => {
...@@ -321,6 +320,8 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit ...@@ -321,6 +320,8 @@ export class AnalysisPanelComponent implements OnInit, OnChanges, AfterViewInit
const updatedNodes = []; const updatedNodes = [];
this.nodeData.nodes.forEach((node) => { this.nodeData.nodes.forEach((node) => {
const isSeed = this.networkHandler.activeNetwork.highlightSeeds ? this.networkHandler.activeNetwork.seedMap[node.id] : false; const isSeed = this.networkHandler.activeNetwork.highlightSeeds ? this.networkHandler.activeNetwork.seedMap[node.id] : false;
if (!isSeed)
return
const nodeStyled = NetworkSettings.getNodeStyle( const nodeStyled = NetworkSettings.getNodeStyle(
node, node,
this.myConfig, this.myConfig,
......
...@@ -107,6 +107,7 @@ export class NetworkComponent implements OnInit { ...@@ -107,6 +107,7 @@ export class NetworkComponent implements OnInit {
updateQueryItems() { updateQueryItems() {
this.queryItems = []; this.queryItems = [];
if (this.currentViewNodes)
this.currentViewNodes.forEach((protein) => { this.currentViewNodes.forEach((protein) => {
this.queryItems.push(getWrapperFromNode(protein)); this.queryItems.push(getWrapperFromNode(protein));
}); });
...@@ -364,7 +365,7 @@ export class NetworkComponent implements OnInit { ...@@ -364,7 +365,7 @@ export class NetworkComponent implements OnInit {
NetworkSettings.getNodeStyle( NetworkSettings.getNodeStyle(
node, node,
this.drugstoneConfig.config, this.drugstoneConfig.config,
false, node.isSeed && this.networkHandler.activeNetwork.highlightSeeds,
this.analysis.inSelection(getWrapperFromNode(node)), this.analysis.inSelection(getWrapperFromNode(node)),
1.0, 1.0,
this.nodeRenderer this.nodeRenderer
...@@ -428,7 +429,7 @@ export class NetworkComponent implements OnInit { ...@@ -428,7 +429,7 @@ export class NetworkComponent implements OnInit {
NetworkSettings.getNodeStyle( NetworkSettings.getNodeStyle(
node, node,
this.drugstoneConfig.config, this.drugstoneConfig.config,
node.isSeed, node.isSeed && this.networkHandler.activeNetwork.highlightSeeds,
this.analysis.inSelection(wrapper), this.analysis.inSelection(wrapper),
gradient, gradient,
this.nodeRenderer)); this.nodeRenderer));
......
...@@ -116,7 +116,6 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges { ...@@ -116,7 +116,6 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
config: this.drugstoneConfig.config, config: this.drugstoneConfig.config,
input_network: this.networkHandler.activeNetwork.inputNetwork input_network: this.networkHandler.activeNetwork.inputNetwork
}; };
console.log(parameters)
parameters.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein; parameters.ppi_dataset = this.drugstoneConfig.config.interactionProteinProtein;
parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein; parameters.pdi_dataset = this.drugstoneConfig.config.interactionDrugProtein;
parameters.licenced = this.drugstoneConfig.config.licensedDatasets; parameters.licenced = this.drugstoneConfig.config.licensedDatasets;
......
...@@ -60,24 +60,29 @@ export class NetworkSettings { ...@@ -60,24 +60,29 @@ export class NetworkSettings {
stabilization: true stabilization: true
}; };
static getOptions(network: 'main' | 'analysis' | 'analysis-big', physicsOn) { static getOptions(network: 'main' | 'analysis' | 'analysis-big', config) {
const physicsOn = config.physicsOn;
const groups = config.nodeGroups;
if (network === 'main') { if (network === 'main') {
return { return {
layout: this.mainLayout, layout: this.mainLayout,
edges: this.mainEdges, edges: this.mainEdges,
physics: physicsOn || this.mainPhysics, physics: physicsOn || this.mainPhysics,
groups,
}; };
} else if (network === 'analysis') { } else if (network === 'analysis') {
return { return {
layout: this.analysisLayout, layout: this.analysisLayout,
edges: this.analysisEdges, edges: this.analysisEdges,
physics: physicsOn || this.analysisPhysics, physics: physicsOn || this.analysisPhysics,
groups,
}; };
} else if (network === 'analysis-big') { } else if (network === 'analysis-big') {
return { return {
layout: this.analysisLayout, layout: this.analysisLayout,
edges: this.analysisEdges, edges: this.analysisEdges,
physics: physicsOn || this.analysisBigPhysics, physics: physicsOn || this.analysisBigPhysics,
groups,
}; };
} }
} }
...@@ -92,15 +97,6 @@ export class NetworkSettings { ...@@ -92,15 +97,6 @@ export class NetworkSettings {
// delete possible old styles // delete possible old styles
Object.keys(config.nodeGroups.default).forEach(e => delete node[e]); Object.keys(config.nodeGroups.default).forEach(e => delete node[e]);
// set group styles
// if (node.group === 'default') {
// node = merge(node, config.nodeGroups.default);
// } else {
// node = merge(node, config.nodeGroups[node.group]);
// if (node.label === 'F11R' || node.label === 'GNAI1')
// console.log(node)
// }
// note that seed and selected node style are applied after the node style is fetched. // note that seed and selected node style are applied after the node style is fetched.
// this allows to overwrite only attributes of interest, therefore in e.g. seedNode group // this allows to overwrite only attributes of interest, therefore in e.g. seedNode group
// certain attributes like shape can remain undefined // certain attributes like shape can remain undefined
...@@ -109,6 +105,17 @@ export class NetworkSettings { ...@@ -109,6 +105,17 @@ export class NetworkSettings {
if (node._group) if (node._group)
// @ts-ignore // @ts-ignore
node.group = node._group node.group = node._group
// @ts-ignore
if (node._shadow) { // @ts-ignore
node.shadow = node._shadow
}else{
if (config.nodeGroups[node.group].shadow) {
node.shadow = {enabled: config.nodeGroups[node.group].shadow}
node.shadow.color = 'rgba(0,0,0,0.5)'
} else {
node.shadow = {color: 'rgba(0,0,0,0.5)'}
}
}
if (isSeed) { if (isSeed) {
// apply seed node style to node // apply seed node style to node
// @ts-ignore // @ts-ignore
...@@ -121,42 +128,46 @@ export class NetworkSettings { ...@@ -121,42 +128,46 @@ export class NetworkSettings {
node._group = node.group node._group = node.group
// apply selected node style to node // apply selected node style to node
node.group = 'selectedNode' node.group = 'selectedNode'
if (config.nodeGroups[node.group].shadow) {
node.shadow = {enabled: config.nodeGroups[node.group].shadow}
node.shadow.color = '#000000'
} else {
node.shadow = {color: '#000000'}
} }
}
// show image if image url is given. If seed nodes are highlighted, ignore image property // show image if image url is given. If seed nodes are highlighted, ignore image property
if (node.image && !isSeed) { if (node.image && !isSeed) {
node.shape = 'image'; node.shape = 'image';
} }
// use opactiy as gradient
// if (gradient === null) {
// node.opacity = 0
// } else {
// node.opacity = gradient
// }
// custom ctx renderer for e.g. pie chart // custom ctx renderer for e.g. pie chart
if (renderer !== null) { if (renderer !== null) {
// @ts-ignore // @ts-ignore
node._shape = node.shape
node.shape = 'custom'; node.shape = 'custom';
node.color = {opacity: gradient} node.color = {opacity: gradient}
node.opacity = gradient node.opacity = gradient
if (isSeed) {
// apply seed node style to node
// @ts-ignore // @ts-ignore
node.color = config.nodeGroups[node.group].color
}else{
delete node.color
}
// @ts-ignore
node._shadow = node.shadow
if (config.nodeGroups[node.group].shadow) { if (config.nodeGroups[node.group].shadow) {
node.shadow = {enabled: config.nodeGroups[node.group].shadow} node.shadow = {enabled: config.nodeGroups[node.group].shadow}
node.shadow.color = '#000000' node.shadow.color = 'rgba(0,0,0,0.5)'
} else { } else {
node.shadow = {color: '#000000'} node.shadow = {color: 'rgba(0,0,0,0.5)'}
} }
node.ctxRenderer = renderer; node.ctxRenderer = renderer;
} else { } else {
node.opacity = undefined node.opacity = undefined
// @ts-ignore delete node.ctxRenderer;
if (node._shape) {
// @ts-ignore
node.shape = node._shape;
} else
delete node.shape
delete node.ctxRenderer
} }
return node; return node;
} }
} }
......
...@@ -164,19 +164,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -164,19 +164,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
updatedNodes.push(nodeStyled); updatedNodes.push(nodeStyled);
} }
this.nodeData.nodes.update(updatedNodes); this.nodeData.nodes.update(updatedNodes);
} else {
const updatedNodes = [];
this.nodeData.nodes.forEach((node) => {
// const nodeSelected = this.analysis.idInSelection(node.id);
// if (node.group == 'default') {
// Object.assign(node, this.drugstoneConfig.config.nodeGroups.default);
// } else {
// Object.assign(node, this.drugstoneConfig.config.nodeGroups[node.group]);
// };
Object.assign(node, this.drugstoneConfig.config.nodeGroups[node.group]);
});
this.nodeData.nodes.update(updatedNodes);
} }
}); });
} }
...@@ -262,7 +249,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -262,7 +249,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
// getNetwork synchronizes the input network with the database // getNetwork synchronizes the input network with the database
await this.getNetwork(); await this.getNetwork();
this.proteinData = new ProteinNetwork(this.networkHandler.activeNetwork.inputNetwork.nodes, this.networkHandler.activeNetwork.inputNetwork.edges); this.proteinData = new ProteinNetwork(this.networkHandler.activeNetwork.inputNetwork.nodes, this.networkHandler.activeNetwork.inputNetwork.edges);
if (this.networkHandler.activeNetwork.networkPositions) { if (this.networkHandler.activeNetwork.networkPositions) {
this.proteinData.updateNodePositions(this.networkHandler.activeNetwork.networkPositions); this.proteinData.updateNodePositions(this.networkHandler.activeNetwork.networkPositions);
} }
...@@ -311,7 +297,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -311,7 +297,7 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.nodeData.edges = new vis.DataSet(edges); this.nodeData.edges = new vis.DataSet(edges);
const container = this.networkHandler.activeNetwork.networkEl.nativeElement; const container = this.networkHandler.activeNetwork.networkEl.nativeElement;
const options = NetworkSettings.getOptions('main', this.drugstoneConfig.config.physicsOn); const options = NetworkSettings.getOptions('main', this.drugstoneConfig.config);
this.networkHandler.activeNetwork.networkInternal = new vis.Network(container, this.nodeData, options); this.networkHandler.activeNetwork.networkInternal = new vis.Network(container, this.nodeData, options);
...@@ -410,7 +396,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -410,7 +396,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
network.nodes.forEach((node) => { network.nodes.forEach((node) => {
// set node label to original id before node id will be set to netex id // set node label to original id before node id will be set to netex id
node.label = node.label ? node.label : node.id; node.label = node.label ? node.label : node.id;
}); });
// adjust edge labels accordingly and filter // adjust edge labels accordingly and filter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment