var render = function() { "use strict"; var height = 30; var tree = tnt.tree(); var board = tnt.board(); var sequence_feature = function () { var fontsize = 10; // 'Inherit' from tnt.board.track.feature var feature = tnt.board.track.feature() .index (function (d) { return d.pos; }); feature.create (function (new_nts, xScale) { var track = this; new_nts .append("text") .attr("fill", track.color()) .style('font-size', fontsize + "px") .attr("x", function (d) { return xScale (d.pos) ; }) .attr("y", function (d) { return ~~(track.height() / 2) + 5; }) .style("font-family", '"Lucida Console", Monaco, monospace') .text(function (d) { return d.nt; }) .transition() .duration(500) .attr('fill', feature.color()); }); feature.move (function (nts) { var xScale = feature.scale(); nts.select ("text") .attr("x", function (d) { return xScale(d.pos) ; }); }); return feature; }; var theme = function (ta, div) { var label = tnt.tree.label.text() .text(function (node) { if (node.is_leaf()) { return node.property(function(d) { return d.id.accession; }); } else { return ""; } }) .fontsize(10) .height(height); var rest = tnt.board.track.data.ensembl; d3.json('ENSGT00390000003602.json', function (err, resp) { deploy_vis(resp); }); // TREE SIDE var deploy_vis = function (tree_obj) { tree .data (tree_obj.tree) .layout (tnt.tree.layout.vertical() .width(430) .scale(false) ) .label (label); var reduce = tnt.utils.reduce.line() .smooth(4) .redundant(function (a, b) { return Math.abs (a-b) < 0.2; }) .value("val"); var reduce_all = function (rows) { var obj = {}; for (var id in rows) { if (rows.hasOwnProperty (id)) { obj[id] = reduce(rows[id]); } } return obj; }; var filter_exon_boundaries = function (data, loc) { var sub_data = []; var from = loc.from; var to = loc.to; for (var i=0; i= loc.from && item.loc <= loc.to) { sub_data.push(item); } } return sub_data; }; var get_conservation = function (seqs) { var conservation = {}; for (var k=0; k