Example of TnT Genome showing how to display tooltips on genes when clicked. The tooltips are provided by TnT Tooltip
Last active
January 12, 2016 16:51
-
-
Save emepyc/4f8c66571c7cc09c5943 to your computer and use it in GitHub Desktop.
Tooltips on genes
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> | |
<meta charset="utf-8"> | |
<div id="body"> | |
<!-- D3 --> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<!-- TnT --> | |
<link rel="stylesheet" href="http://tntvis.github.io/tnt.genome/build/tnt.genome.css" type="text/css"/> | |
<script src="http://tntvis.github.io/tnt.genome/build/tnt.genome.min.js"></script> | |
<!-- TnT Tooltips --> | |
<link rel="stylesheet" href="http://tntvis.github.io/tnt.tooltip/build/tnt.tooltip.css" type="text/css"/> | |
<script src="http://tntvis.github.io/tnt.tooltip/build/tnt.tooltip.min.js"></script> | |
<div id="genomeBrowser"></div> | |
<script> | |
var gene_track = tnt.board.track() | |
.height(200) | |
.color("white") | |
.display(tnt.board.track.feature.genome.gene() | |
.color("#550055") | |
.on("click", function (d) { | |
tnt.tooltip.table() | |
.width(120) | |
.call(this, { | |
header : d.external_name, | |
rows : [ | |
{"label": "id", "value": d.gene_id}, | |
{"label": "desc", "value": d.description}, | |
{"label": "Coords", "value": ""}, | |
{"label": "chr", "value": d.seq_region_name}, | |
{"label": "start", "value": d.start}, | |
{"label": "end", "value": d.end} | |
] | |
}) | |
}) | |
) | |
.data(tnt.board.track.data.genome.gene()); | |
var genome = tnt.board.genome().species("human").gene("brca2").width(950); | |
genome | |
.zoom_in(100) | |
.add_track(gene_track); | |
genome (document.getElementById("genomeBrowser")); | |
genome.start(); | |
</script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment