Commit ba2b45c7 authored by Maxime Chazalviel's avatar Maxime Chazalviel

Allow to remove SC & Highlight seeds & hide reaction names & fix label for metabolites

parent ae014de3
......@@ -3073,14 +3073,7 @@ metExploreD3.GraphNetwork = {
d3.selectAll("g.node").filter(n=>n.getBiologicalType()==="reaction").each(function(r){
d3.select(this).select("text").style("opacity", 0)
})
// dupliquer les side compouunds
var sideCompounds = ["M_adp_m", "M_adp_c", "M_amp_c", "M_amp_m", "M_amp_r", "M_amp_x", "M_atp_x", "M_atp_r", "M_atp_m", "M_atp_c", "M_hco3_c", "M_hco3_m", "M_co2_c", "M_co2_x", "M_co2_m", "M_ppi_c", "M_ppi_x", "M_ppi_r", "M_ppi_m", "M_fad_m", "M_fadh2_m", "M_gtp_c", "M_h2o2_x", "M_pi_m", "M_pi_c", "M_nad_x", "M_nad_c", "M_nad_m", "M_nadh_x", "M_nadh_m", "M_nadh_c", "M_nadp_m", "M_nadp_r", "M_nadp_x", "M_nadph_x", "M_nadph_r", "M_nadph_m", "M_o2_x", "M_o2_r", "M_o2_m", "M_h_r", "M_h_x", "M_h_l", "M_h_m", "M_h_c", "M_h_e", "M_so4_l", "M_h2o_x", "M_h2o_l", "M_h2o_m", "M_h2o_r", "M_h2o_e", "M_h2o_c"];
metExploreViz.GraphNode.loadSideCompounds(sideCompounds);
metExploreViz.GraphNetwork.duplicateSideCompounds();
//////////////////
var linkStyle = metExploreD3.getLinkStyle();
metExploreD3.GraphLink.refreshDataLink(panelLinked, sessionLinked);
......
......@@ -87,6 +87,11 @@ metExploreD3.GraphNode = {
}
});
metExploreD3.GraphNetwork.updateNetwork("viz", _metExploreViz.getSessionById("viz"));
// dupliquer les side compouunds
var sideCompounds = ["M_adp", "M_amp", "M_atp", "M_hco3", "M_co", "M_ppi", "M_fad", "M_fadh2", "M_gtp", "M_h2o2", "M_pi", "M_nad", "M_nadh", "M_nadp", "M_nadph", "M_o2", "M_h", "M_so4", "M_h2o"];
metExploreD3.GraphNode.loadSideCompounds(sideCompounds);
metExploreD3.GraphNetwork.duplicateSideCompounds();
},
showDirectedNeighbours: function(node, outgoing){
......@@ -161,6 +166,11 @@ metExploreD3.GraphNode = {
});
metExploreD3.GraphNetwork.updateNetwork("viz", _metExploreViz.getSessionById("viz"));
// dupliquer les side compouunds
var sideCompounds = ["M_adp", "M_amp", "M_atp", "M_hco3", "M_co", "M_ppi", "M_fad", "M_fadh2", "M_gtp", "M_h2o2", "M_pi", "M_nad", "M_nadh", "M_nadp", "M_nadph", "M_o2", "M_h", "M_so4", "M_h2o"];
metExploreD3.GraphNode.loadSideCompounds(sideCompounds);
metExploreD3.GraphNetwork.duplicateSideCompounds();
},
hideNeighbours: function(node){
......@@ -1423,7 +1433,7 @@ metExploreD3.GraphNode = {
.call(node_drag);
metExploreD3.GraphNode.node = d3.select("#" + metExploreD3.GraphNode.panelParent)
.select("#D3viz").select("#graphComponent").selectAll("g.node");
.select("#D3viz").select("#graphComponent").selectAll("g.node");
metExploreD3.GraphNode.updatedNodes
.filter(function (node) {
......@@ -1529,6 +1539,7 @@ metExploreD3.GraphNode = {
})
.addNodeText(metaboliteStyle);
// We define the text for a metabolie WITH the coresponding SVG image
// Text definition
metExploreD3.GraphNode.updatedNodes
......@@ -1672,7 +1683,10 @@ metExploreD3.GraphNode = {
metExploreD3.GraphNode.updatedNodes
.each(function (d) {
// set corresponding event handler
var name = reactionStyle.getDisplayLabel(d, reactionStyle.getLabel());
if(d.getBiologicalType()=="metabolite")
var name = metaboliteStyle.getDisplayLabel(d, metaboliteStyle.getLabel());
else
var name = reactionStyle.getDisplayLabel(d, reactionStyle.getLabel());
metExploreD3.GraphStyleEdition.changeNodeLabel(d, parent, name);
......@@ -1782,7 +1796,7 @@ metExploreD3.GraphNode = {
//----------------------------------------------------------------------------------------------------------------------------------------------------<TEST----------------------------------------------
d3.selectAll("g.node").filter(m=>m.getBiologicalType()==="metabolite").each(function(n){
if(n.getMappingDatas().map(m=>m.getMappingName()).includes("rank.txt(json)")){
console.log(n.getMappingDataByNameAndCond("rank.txt(json)", "outrank"));
if (n.getMappingDataByNameAndCond("rank.txt(json)", "inrank").getMapValue() <25){
if(n.getMappingDataByNameAndCond("rank.txt(json)", "outrank").getMapValue() <25){
d3.select(this).selectAll("rect").style("stroke", 'purple');
......@@ -1797,6 +1811,33 @@ metExploreD3.GraphNode = {
}
})
d3.selectAll("g.node").filter(m=>m.getBiologicalType()==="metabolite").each(function(n){
if(n.getMappingDatas().map(m=>m.getMappingName()).includes("seed")){
d3.select(this).selectAll("rect").style("stroke", '#3baa82');
var strokeNotCreated = !d3.select(this).select(".stroke").node();
console.log(strokeNotCreated);
if(strokeNotCreated)
{
d3.select(this)
.attr("seed","true")
.insert("rect", ":first-child")
.attr("class", "stroke")
.attr("width", parseInt(d3.select(this).select(".metabolite").attr("width"))+10)
.attr("height", parseInt(d3.select(this).select(".metabolite").attr("height"))+10)
.attr("rx", parseInt(d3.select(this).select(".metabolite").attr("rx"))+5)
.attr("ry",parseInt(d3.select(this).select(".metabolite").attr("ry"))+5)
.attr("transform", "translate(-" + parseInt(parseInt(d3.select(this).select(".metabolite").attr("width"))+10) / 2 + ",-"
+ parseInt(parseInt(d3.select(this).select(".metabolite").attr("height"))+10) / 2
+ ")")
.style("opacity", '0.7')
.style("fill", '#3baa82');
}
}
})
//----------------------------------------------------------------------------------------------------------------------------------------------------TEST>----------------------------------------------
},
......
Markdown is supported
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