Skip to content
Snippets Groups Projects
Commit 87bbbdc4 authored by Michael Hartung's avatar Michael Hartung
Browse files

node style change on select

parent aa71dd15
No related branches found
No related tags found
No related merge requests found
......@@ -18,8 +18,8 @@ export class NetworkSettings {
private static nonSeedHostColor = '#3070B3';
private static nonSeedVirusColor = '#87082c';
private static selectedBorderColor = NetworkSettings.Black;
private static selectBorderHighlightColor = NetworkSettings.Black;
private static selectedBorderColor = '#F8981D';
private static selectBorderHighlightColor = '#F8981D';
private static seedBorderColor = '#F8981D';
private static seedBorderHighlightColor = '#F8981D';
......@@ -184,6 +184,9 @@ export class NetworkSettings {
drugInTrial?: boolean,
gradient?: number): any {
if (!gradient) {
gradient = -1.0;
}
let nodeGroupObject;
if (node.group === 'default') {
nodeGroupObject = defaultConfig.nodeGroups.default;
......@@ -201,6 +204,9 @@ export class NetworkSettings {
// const nodeShape = node.shape;
// const nodeSize = 10;
// const nodeFont = node.font;
console.log("is selected")
console.log(isSelected)
if (isSeed) {
node.color = {
background: nodeColor,
......
......@@ -179,6 +179,8 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.showDetails = false;
this.analysis.subscribeList((items, selected) => {
console.log(selected)
console.log(items)
if (!this.nodeData.nodes) {
return;
}
......@@ -187,20 +189,25 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
return;
}
const updatedNodes = [];
for (const item of items) {
const node: Node = this.nodeData.nodes.get(item.id);
for (const wrapper of items) {
const node: Node = this.nodeData.nodes.get(wrapper.id);
if (!node) {
continue;
}
const pos = this.networkInternal.getPositions([item.id]);
node.x = pos[item.id].x;
node.y = pos[item.id].y;
// if (node.group == 'default') {
// Object.assign(node, this.myConfig.nodeGroups.default);
// } else {
// Object.assign(node, this.myConfig.nodeGroups[node.group]);
// }
Object.assign(node, this.myConfig.nodeGroups[node.group]);
const pos = this.networkInternal.getPositions([wrapper.id]);
node.x = pos[wrapper.id].x;
node.y = pos[wrapper.id].y;
const nodeStyled = NetworkSettings.getNodeStyle(
node,
this.myConfig,
false,
selected,
undefined,
undefined,
1.0
)
Object.assign(node, nodeStyled);
updatedNodes.push(node);
}
......@@ -604,40 +611,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
}
this.nodeData.nodes.update(updatedNodes);
})
// const params = new HttpParams().set('tissue', `${tissue.id}`).set('data', JSON.stringify(this.currentDataset));
// this.http.get<any>(
// `${environment.backend}tissue_expression/`, {params})
// .subscribe((levels) => {
// const updatedNodes = [];
// const maxExpr = Math.max(...levels.map(lvl => lvl.level));
// for (const lvl of levels) {
// const item = getWrapperFromNode(lvl.protein);
// const node = this.nodeData.nodes.get(item.nodeId);
// if (!node) {
// continue;
// }
// const gradient = lvl.level !== null ? (Math.pow(lvl.level / maxExpr, 1 / 3) * (1 - minExp) + minExp) : -1;
// const pos = this.network.getPositions([item.nodeId]);
// node.x = pos[item.nodeId].x;
// node.y = pos[item.nodeId].y;
// Object.assign(node,
// NetworkSettings.getNodeStyle(
// node.wrapper.type,
// node.isSeed,
// this.analysis.inSelection(item),
// undefined,
// undefined,
// gradient));
// node.wrapper = item;
// node.gradient = gradient;
// this.proteins.find(prot => getProteinNodeId(prot) === item.nodeId).expressionLevel = lvl.level;
// (node.wrapper.data as Protein).expressionLevel = lvl.level;
// updatedNodes.push(node);
// }
// this.nodeData.nodes.update(updatedNodes);
// });
}
this.currentViewSelectedTissue = this.selectedTissue;
......
......@@ -87,10 +87,7 @@ export class NetexControllerService {
* Returns the expression in the given tissue for given nodes and cancerNodes
*/
// slice prefix of netex id away for direct lookup in db, if node not mapped to db, replace by undefined
console.log("before genesBackendIds")
const genesBackendIds = nodes.map( (node: Node) => node.netexId ? node.netexId.slice(1) : undefined);
console.log("genesBackendIds")
console.log(genesBackendIds)
const params = new HttpParams()
.set('tissue', tissue.netexId)
.set('proteins', JSON.stringify(genesBackendIds));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment