Skip to content
Snippets Groups Projects
Commit 062a19bd authored by Ibrahim Roshan Kunnakkattu's avatar Ibrahim Roshan Kunnakkattu
Browse files

remove highlight if the higlight atoms are empty

parent c214be12
No related branches found
No related tags found
1 merge request!5Refactored code for diplaying aggregated ligand interactions
......@@ -112,32 +112,31 @@ class Depiction {
* @memberof Depiction
*/
public highlightSubgraph(atoms: Array<string>, color: string = undefined) {
if (!this.atoms || !atoms) return;
if (!this.atoms) return;
this.highlight.selectAll('*').remove();
color = color ? color : "#BFBFBF";
let atomsToHighlight = this.atoms.filter(x => atoms.includes(x.name));
this.highlight.selectAll()
.data(atomsToHighlight)
.enter()
.append('circle')
.attr('r', '16.12')
.attr('cx', x => x.position.x)
.attr('cy', x => x.position.y)
.attr('style', `fill:${color};fill-rule:evenodd;stroke:${color};stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1`);
let bondsToHighlight = this.bonds.filter(x => atoms.includes(x.bgn.name) && atoms.includes(x.end.name))
this.highlight.selectAll()
.data(bondsToHighlight)
.enter()
.append('path')
.attr('d', x => `M ${x.bgn.position.x},${x.bgn.position.y} ${x.end.position.x},${x.end.position.y}`)
.attr('style', `fill:none;fill-rule:evenodd;stroke:${color};stroke-width:22px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1`)
}
if(atoms){
color = color ? color : "#BFBFBF";
let atomsToHighlight = this.atoms.filter(x => atoms.includes(x.name));
this.highlight.selectAll()
.data(atomsToHighlight)
.enter()
.append('circle')
.attr('r', '16.12')
.attr('cx', x => x.position.x)
.attr('cy', x => x.position.y)
.attr('style', `fill:${color};fill-rule:evenodd;stroke:${color};stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1`);
let bondsToHighlight = this.bonds.filter(x => atoms.includes(x.bgn.name) && atoms.includes(x.end.name))
this.highlight.selectAll()
.data(bondsToHighlight)
.enter()
.append('path')
.attr('d', x => `M ${x.bgn.position.x},${x.bgn.position.y} ${x.end.position.x},${x.end.position.y}`)
.attr('style', `fill:none;fill-rule:evenodd;stroke:${color};stroke-width:22px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1`)
}
}
/**
* Adds circles around atoms corresponding to the value of
* their weights.The size, color and number of crcles around
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment