forked from enviPath/enviPy
App Domain Pathway Prediction (#47)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#47
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
console.log("loaded")
|
||||
console.log("loaded pw.js")
|
||||
|
||||
|
||||
function predictFromNode(url) {
|
||||
@ -144,6 +144,16 @@ function draw(pathway, elem) {
|
||||
function node_popup(n) {
|
||||
popupContent = "<a href='" + n.url +"'>" + n.name + "</a><br>";
|
||||
popupContent += "Depth " + n.depth + "<br>"
|
||||
|
||||
if (appDomainViewEnabled) {
|
||||
if(n.app_domain != null) {
|
||||
popupContent += "This compound is " + (n.app_domain['inside_app_domain'] ? "inside" : "outside") + " the Applicability Domain derived from the chemical (PCA) space constructed using the training data." + "<br>"
|
||||
if (n.app_domain['uncovered_functional_groups']) {
|
||||
popupContent += "Compound contains functional groups not covered by the training set <br>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popupContent += "<img src='" + n.image + "' width='"+ 20 * nodeRadius +"'><br>"
|
||||
if (n.scenarios.length > 0) {
|
||||
popupContent += '<b>Half-lives and related scenarios:</b><br>'
|
||||
@ -162,6 +172,18 @@ function draw(pathway, elem) {
|
||||
|
||||
function edge_popup(e) {
|
||||
popupContent = "<a href='" + e.url +"'>" + e.name + "</a><br>";
|
||||
|
||||
if(e.app_domain){
|
||||
adcontent = "<p>";
|
||||
if(e.app_domain["times_triggered"]) {
|
||||
adcontent += "This rule triggered " + e.app_domain["times_triggered"] + " times in the training set<br>";
|
||||
}
|
||||
adcontent += "Reliability " + e.app_domain["reliability"].toFixed(2) + " (" + (e.app_domain["reliability"] > e.app_domain["reliability_threshold"] ? ">" : "<") + " Reliability Threshold of " + e.app_domain["reliability_threshold"] + ")<br>";
|
||||
adcontent += "Local Compatibility " + e.app_domain["local_compatibility"].toFixed(2) + " (" + (e.app_domain["local_compatibility"] > e.app_domain["local_compatibility_threshold"] ? ">" : "<") + " Local Compatibility Threshold of " + e.app_domain["local_compatibility_threshold"] + ")<br>";
|
||||
adcontent += "</p>";
|
||||
}
|
||||
popupContent += adcontent;
|
||||
|
||||
popupContent += "<img src='" + e.image + "' width='"+ 20 * nodeRadius +"'><br>"
|
||||
if (e.reaction_probability) {
|
||||
popupContent += '<b>Probability:</b><br>' + e.reaction_probability.toFixed(3) + '<br>';
|
||||
@ -233,13 +255,12 @@ function draw(pathway, elem) {
|
||||
.enter().append("line")
|
||||
// Check if target is pseudo and draw marker only if not pseudo
|
||||
.attr("class", d => d.target.pseudo ? "link_no_arrow" : "link")
|
||||
// .on("mouseover", (event, d) => {
|
||||
// tooltip.style("visibility", "visible")
|
||||
// .text(`Link: ${d.source.id} → ${d.target.id}`)
|
||||
// .style("top", `${event.pageY + 5}px`)
|
||||
// .style("left", `${event.pageX + 5}px`);
|
||||
// })
|
||||
// .on("mouseout", () => tooltip.style("visibility", "hidden"));
|
||||
.attr("marker-end", d => d.target.pseudo ? '' : 'url(#arrow)')
|
||||
|
||||
// add element to links array
|
||||
link.each(function(d) {
|
||||
d.el = this; // attach the DOM element to the data object
|
||||
});
|
||||
|
||||
pop_add(link, "Reaction", edge_popup);
|
||||
|
||||
@ -255,16 +276,6 @@ function draw(pathway, elem) {
|
||||
.on("click", function (event, d) {
|
||||
d3.select(this).select("circle").classed("highlighted", !d3.select(this).select("circle").classed("highlighted"));
|
||||
})
|
||||
// .on("mouseover", (event, d) => {
|
||||
// if (d.pseudo) {
|
||||
// return
|
||||
// }
|
||||
// tooltip.style("visibility", "visible")
|
||||
// .text(`Node: ${d.id} Depth: ${d.depth}`)
|
||||
// .style("top", `${event.pageY + 5}px`)
|
||||
// .style("left", `${event.pageX + 5}px`);
|
||||
// })
|
||||
// .on("mouseout", () => tooltip.style("visibility", "hidden"));
|
||||
|
||||
// Kreise für die Knoten hinzufügen
|
||||
node.append("circle")
|
||||
@ -280,5 +291,10 @@ function draw(pathway, elem) {
|
||||
.attr("width", nodeRadius * 2)
|
||||
.attr("height", nodeRadius * 2);
|
||||
|
||||
pop_add(node, "Compound", node_popup);
|
||||
// add element to nodes array
|
||||
node.each(function(d) {
|
||||
d.el = this; // attach the DOM element to the data object
|
||||
});
|
||||
|
||||
pop_add(node, "Compound", node_popup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user