Last active
January 12, 2016 16:43
-
-
Save emepyc/c99e9b3cc6809904cd0d to your computer and use it in GitHub Desktop.
Ensembl gene tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<!-- D3 --> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<!-- TnT --> | |
<link rel="stylesheet" href="http://tntvis.github.io/tnt.tree/build/tnt.tree.css" type="text/css" /> | |
<script src="http://tntvis.github.io/tnt.tree/build/tnt.tree.min.js"></script> | |
<!-- TnT Rest --> | |
<script src="http://tntvis.github.io/tnt.rest/build/tnt.rest.min.js"></script> | |
</head> | |
<body> | |
<h1>Ensembl gene tree</h1> | |
<div id="mydiv"></div> | |
<script> | |
// gene tree | |
var rest = tnt.rest() | |
.domain("rest.ensembl.org"); | |
var url = rest.url() | |
.endpoint("genetree/id/:id") | |
.parameters({ | |
id: "ENSGT00390000003602" | |
}); | |
rest.call(url) | |
.then (function (resp) { | |
var tree = resp.body.tree; | |
var tree_vis = tnt.tree() | |
.data(tree) | |
.label(tnt.tree.label.text() | |
.fontsize(10) | |
.height(20) | |
.text(function (node) { | |
var data = node.data(); | |
if (data.id && data.id.accession) { | |
return data.id.accession; | |
} | |
return ""; | |
}) | |
); | |
tree_vis(document.getElementById("mydiv")); | |
}); | |
</script> | |
<footer> | |
<aside>Released under <a href="http://www.opensource.org/licenses/apache2.0.php">Apache 2.0</a>.</aside> | |
Copyright 2014-2016 <a href="http://www.ebi.ac.uk/~mp" rel="author">Miguel Pignatelli</a> | |
</footer> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment