1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// Generated by CoffeeScript 1.8.0
var iplotMScanone_noeff, lod_data;
iplotMScanone_noeff = function(lod_data, times, chartOpts) {
var axispos, chartdivid, chrGap, colors, darkrect, extra_digits, g_heatmap, g_lodchart, hbot, htop, i, lightrect, linecolor, linewidth, lod4curves, lod_labels, lod_ylab, lodchart_curves, lodcolumn, lodcurve, margin, mylodchart, mylodheatmap, nullcolor, nxticks, plotLodCurve, pos, svg, titlepos, totalh, totalw, wleft, wright, x, xticks, y, zlim, zthresh, _ref, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref2, _ref20, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
wleft = (_ref = chartOpts != null ? chartOpts.wleft : void 0) != null ? _ref : 1000;
wright = (_ref1 = chartOpts != null ? chartOpts.wright : void 0) != null ? _ref1 : 500;
htop = (_ref2 = chartOpts != null ? chartOpts.htop : void 0) != null ? _ref2 : 350;
hbot = (_ref3 = chartOpts != null ? chartOpts.hbot : void 0) != null ? _ref3 : 350;
margin = (_ref4 = chartOpts != null ? chartOpts.margin : void 0) != null ? _ref4 : {
left: 100,
top: 40,
right: 40,
bottom: 40,
inner: 5
};
axispos = (_ref5 = chartOpts != null ? chartOpts.axispos : void 0) != null ? _ref5 : {
xtitle: 25,
ytitle: 30,
xlabel: 5,
ylabel: 5
};
titlepos = (_ref6 = chartOpts != null ? chartOpts.titlepos : void 0) != null ? _ref6 : 20;
chrGap = (_ref7 = chartOpts != null ? chartOpts.chrGap : void 0) != null ? _ref7 : 8;
darkrect = (_ref8 = chartOpts != null ? chartOpts.darkrect : void 0) != null ? _ref8 : "#C8C8C8";
lightrect = (_ref9 = chartOpts != null ? chartOpts.lightrect : void 0) != null ? _ref9 : "#E6E6E6";
nullcolor = (_ref10 = chartOpts != null ? chartOpts.nullcolor : void 0) != null ? _ref10 : "#E6E6E6";
colors = (_ref11 = chartOpts != null ? chartOpts.colors : void 0) != null ? _ref11 : ["slateblue", "white", "crimson"];
zlim = (_ref12 = chartOpts != null ? chartOpts.zlim : void 0) != null ? _ref12 : null;
zthresh = (_ref13 = chartOpts != null ? chartOpts.zthresh : void 0) != null ? _ref13 : null;
lod_ylab = (_ref14 = chartOpts != null ? chartOpts.lod_ylab : void 0) != null ? _ref14 : "";
linecolor = (_ref15 = chartOpts != null ? chartOpts.linecolor : void 0) != null ? _ref15 : "darkslateblue";
linewidth = (_ref16 = chartOpts != null ? chartOpts.linewidth : void 0) != null ? _ref16 : 2;
nxticks = (_ref17 = chartOpts != null ? chartOpts.nxticks : void 0) != null ? _ref17 : 5;
xticks = (_ref18 = chartOpts != null ? chartOpts.xticks : void 0) != null ? _ref18 : null;
lod_labels = (_ref19 = chartOpts != null ? chartOpts.lod_labels : void 0) != null ? _ref19 : null;
chartdivid = (_ref20 = chartOpts != null ? chartOpts.chartdivid : void 0) != null ? _ref20 : 'chart';
totalh = htop + hbot + 2 * (margin.top + margin.bottom);
totalw = wleft + wright + 2 * (margin.left + margin.right);
if (lod_labels == null) {
lod_labels = times != null ? (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = times.length; _i < _len; _i++) {
x = times[_i];
_results.push(formatAxis(times, extra_digits = 1)(x));
}
return _results;
})() : lod_data.lodnames;
}
mylodheatmap = lodheatmap().height(htop).width(wleft).margin(margin).axispos(axispos);
svg = d3.select("div#" + chartdivid).append("svg").attr("height", totalh).attr("width", totalw);
g_heatmap = svg.append("g").attr("id", "heatmap").datum(lod_data).call(mylodheatmap);
mylodchart = lodchart().height(hbot).width(wleft).margin(margin).axispos(axispos).titlepos(titlepos).chrGap(chrGap).linecolor("none").pad4heatmap(true).darkrect(darkrect).lightrect(lightrect).ylim([0, d3.max(mylodheatmap.zlim())]).pointsAtMarkers(false);
g_lodchart = svg.append("g").attr("transform", "translate(0," + (htop + margin.top + margin.bottom) + ")").attr("id", "lodchart").datum(lod_data).call(mylodchart);
lodcurve = function(chr, lodcolumn) {
return d3.svg.line().x(function(d) {
return mylodchart.xscale()[chr](d);
}).y(function(d, i) {
return mylodchart.yscale()(Math.abs(lod_data.lodByChr[chr][i][lodcolumn]));
});
};
lodchart_curves = null;
plotLodCurve = function(lodcolumn) {
var chr, _i, _len, _ref21, _results;
g_lodchart.selectAll("g#curves").remove();
lodchart_curves = g_lodchart.append("g").attr("id", "lodcurves");
_ref21 = lod_data.chrnames;
_results = [];
for (_i = 0, _len = _ref21.length; _i < _len; _i++) {
chr = _ref21[_i];
_results.push(lodchart_curves.append("path").datum(lod_data.posByChr[chr[0]]).attr("d", lodcurve(chr[0], lodcolumn)).attr("stroke", linecolor).attr("fill", "none").attr("stroke-width", linewidth).style("pointer-events", "none"));
}
return _results;
};
lod4curves = {
data: []
};
for (pos in lod_data.pos) {
y = (function() {
var _i, _len, _ref21, _results;
_ref21 = lod_data.lodnames;
_results = [];
for (_i = 0, _len = _ref21.length; _i < _len; _i++) {
lodcolumn = _ref21[_i];
_results.push(Math.abs(lod_data[lodcolumn][pos]));
}
return _results;
})();
x = (function() {
var _results;
_results = [];
for (i in lod_data.lodnames) {
_results.push(+i);
}
return _results;
})();
lod4curves.data.push({
x: x,
y: y
});
}
return mylodheatmap.cellSelect().on("mouseover", function(d) {
var p;
plotLodCurve(d.lodindex);
g_lodchart.select("g.title text").text("" + lod_labels[d.lodindex]);
return p = d3.format(".1f")(d.pos);
}).on("mouseout", function(d) {
lodchart_curves.remove();
return g_lodchart.select("g.title text").text("");
});
};
iplotMScanone_noeff(lod_data = js_data.json_data);
|