Cytoscape test3: Difference between revisions
From FANTOM5_SSTAR
No edit summary |
No edit summary |
||
Line 70: | Line 70: | ||
$(function(){ | $(function(){ | ||
var z_min = 0; | |||
var z_max = 1; | |||
var edge_type = ""; | |||
var t; | |||
var selected = false; | |||
function setEdgeFilter(type) { | |||
edge_type = type; | |||
vis.filter("edges", function(edge) { | |||
return ((edge_type == "") || (edge.data.type == edge_type)); | |||
}, true); | |||
} | |||
function graphClick(event) { | |||
var target = event.target; | |||
var lurl = "https://fantom5-collaboration.gsc.riken.jp/resource_browser/RB_SearchResults?sq="+target.data["id"]; | |||
//window.location = lurl; | |||
alert(lurl); | |||
} | |||
function nodeClick(event) { | |||
var target = event.target; | |||
//alert(target.data["id"]); | |||
//selectFirstNeighbors(target.data["id"]); | |||
var fn = vis.firstNeighbors([target.data["id"]]); | |||
var nodes = fn.neighbors.concat(fn.rootNodes); | |||
vis.deselect(); | |||
vis.select(nodes); | |||
//alert(nodes.length); | |||
} | |||
function graphSelect() { | |||
var edges = vis.selected("edges"); | |||
var nodes = vis.selected("nodes"); | |||
//if (edges.length == 0 && nodes.length == 1) { | |||
//selectFirstNeighbors(nodes[0]); | |||
//return; | |||
//} | |||
var html = "<tr><th>node</th><th>type</th></tr>"; | |||
//var sel = vis.selected(); | |||
for (var i in nodes) { | |||
var data = nodes[i].data; | |||
html += "<tr><td>"+data.label+"</td><td>"+data.type+"</td></tr>"; | |||
//selectFirstNeighbors(nodes[i]); | |||
} | |||
//($("#nodes_list").innerHTML); | |||
$("#nodes_list").html(html); | |||
html = "<tr><th>Source TF</th><th>Target TF</th><th>Promoter</th><th>Z-Score</th></tr>"; | |||
//var sel = vis.selected(); | |||
for (var i in edges) { | |||
var data = edges[i].data; | |||
html += "<tr><td>"+data.source+"</td><td>"+data.target+"</td><td>"+(data.promoter ? data.promoter : "na")+"</td><td>"+(data.zscore ? data.zscore : "na")+"</td></tr>"; | |||
} | |||
$("#edges_list").html(html); | |||
selected = ((edges.length > 0) || (nodes.length > 0)); | |||
vis.visualStyle(visual_style); | |||
//if ((edges.length > 0) && (nodes.length > 0)) { | |||
// selected = true; | |||
//} | |||
} | |||
function layoutChange() { | |||
vis.layout($("#cyto_layout").val()); | |||
} | |||
function clearFirstNeighborsHighligh() { | |||
setTimeout(function() { | |||
if (_mouseOverNode == null) { | |||
vis.visualStyleBypass({}); | |||
} | |||
}, 400); | |||
} | |||
function selectFirstNeighbors(node) { | |||
var fn = vis.firstNeighbors([node]); | |||
var nodes = fn.neighbors.concat(fn.rootNodes); | |||
var edges = fn.edges; | |||
vis.deselect(); | |||
vis.select(nodes); | |||
vis.select(edges); | |||
} | |||
$("#cyto_layout").change(function(){ | |||
layoutChange(); | |||
return false; | |||
}); | |||
$("#cyto_recalc").click(function(){ | |||
layoutChange(); | |||
return false; | |||
}); | |||
$("#cyto_tf_motif_filter").click(function(){ | |||
setEdgeFilter("has_motif"); | |||
return false; | |||
}); | |||
$("#cyto_motif_tf_filter").click(function(){ | |||
setEdgeFilter("promotes"); | |||
return false; | |||
}); | |||
$("#cyto_all_filter").click(function(){ | |||
setEdgeFilter(""); | |||
return false; | |||
}); | |||
var colorMapper = { | |||
attrName: "type", | |||
entries: [ { attrValue: "motif", value: "#ff9900" }, | |||
{ attrValue: "tf", value: "#0099ff" } ] | |||
}; | |||
var shapeMapper = { | |||
attrName: "type", | |||
entries: [ { attrValue: "motif", value: "rectangle" }, | |||
{ attrValue: "tf", value: "ELLIPSE" } ] | |||
}; | |||
var edgeColorMapper = { | |||
attrName: "type", | |||
entries: [ { attrValue: "has_motif", value: "#ff9900" }, { attrValue: "promotes", value: "#0099ff" } ] | |||
}; | |||
var edgeArrowMapper = { | |||
attrName: "type", | |||
entries: [ { attrValue: "has_motif", value: "arrow" }, { attrValue: "promotes", value: "delta" } ] | |||
}; | |||
var edgeTooltipMapper = { | |||
attrName: "type", | |||
entries: [ { attrValue: "has_motif", value: "" }, { attrValue: "promotes", value: "<b>Promoter: ${promoter}</b><br />Z-Score: ${zscore}" } ] | |||
}; | |||
// id of Cytoscape Web container div | // id of Cytoscape Web container div | ||
Line 82: | Line 231: | ||
}, | }, | ||
nodes: { | nodes: { | ||
label: { passthroughMapper: { attrName: "id" } }, | |||
tooltipText: "<b>${type}: ${label}</b>", | tooltipText: "<b>${type}: ${label}</b>", | ||
shape: { defaultValue: "ellipse", discreteMapper: shapeMapper }, | |||
borderWidth: 1, | borderWidth: 1, | ||
borderColor: "#000000", | borderColor: "#000000", | ||
size: 30, | size: 30, | ||
color: "#ffffff", | //color: "#ffffff", | ||
color: { defaultValue: "#ff9900", discreteMapper: colorMapper }, | |||
opacity: 0.8, | //opacity: 0.8, | ||
opacity: { customMapper: { functionName: "customOpacity" } }, | |||
selectionOpacity: 0.8, | selectionOpacity: 0.8, | ||
hoverOpacity: 0.8, | hoverOpacity: 0.8, | ||
Line 98: | Line 247: | ||
}, | }, | ||
edges: { | edges: { | ||
width: { passthroughMapper: { attrName: "zscore" } }, | |||
label: { passthroughMapper: { attrName: "promoter" } }, | |||
tooltipText: "<b>Promoter: ${promoter}</b><br />Z-Score: ${zscore}", | |||
tooltipText: { defaultValue: "", discreteMapper: edgeTooltipMapper }, | |||
color: "#011e59", | //color: "#011e59", | ||
color: { defaultValue: "#011e59", discreteMapper: edgeColorMapper }, | |||
targetArrowShape: { defaultValue: "delta", discreteMapper: edgeArrowMapper }, | |||
sourceArrowShape: "", | sourceArrowShape: "", | ||
labelGlowOpacity: 0.8, | labelGlowOpacity: 0.8, | ||
opacity: 0.8, | //opacity: 0.8, | ||
opacity: { customMapper: { functionName: "customOpacity" } }, | |||
selectionOpacity: 0.8, | selectionOpacity: 0.8, | ||
hoverOpacity: 0.8, | hoverOpacity: 0.8, |
Revision as of 13:47, 8 May 2012
FF:10717-109I6, TF to Motif to TF network
Mouseover nodes and edges to see attributes. Motifs are shown in orange, TFs are shown in blue. Promoter and z-score are attributes of the Motif to TF edges (blue arrow). TF to Motif edges are shown in orange.
Motifs shown are the top (maximum 30) motifs in the sample. TFs shown have at least one CAGE promoter with at at least 10 TPM expression (RLE normalized) in the sample. Edges shown have a z-score of at least 1.5 (based on correlation between motif activity and promoter expression).
Cytoscape Web will replace the contents of this div with your graph.
TF | Motif |
---|
Source TF | Target TF | Promoter | Z-Score |
---|