Template:Team:UC Davis/MutantWidget
From 2011.igem.org
(Difference between revisions)
Line 212: | Line 212: | ||
[0.56349, 0.00000, 0.00000], | [0.56349, 0.00000, 0.00000], | ||
[0.50000, 0.00000, 0.00000]]; | [0.50000, 0.00000, 0.00000]]; | ||
+ | |||
+ | //cool_color_ramp = [[0,0,0], [0,0,1], [1,1,1]]; | ||
var WIDTH = 650; | var WIDTH = 650; | ||
Line 220: | Line 222: | ||
FAR = 10000; | FAR = 10000; | ||
- | mutantcolors = [" | + | mutantcolors = ["black", "#ff6666", "orange", "yellow", "#66ff66", "#66ffff", "#ddaaff", "pink"]; |
selectedColor = "orange"; | selectedColor = "orange"; | ||
widget_mode = "2D"; | widget_mode = "2D"; | ||
Line 303: | Line 305: | ||
{ | { | ||
dataseries.push(data[index]); | dataseries.push(data[index]); | ||
+ | dataseries.push(errbars_2d[index]); | ||
} | } | ||
} | } | ||
Line 315: | Line 318: | ||
xaxis: {max:.014, min:0}, | xaxis: {max:.014, min:0}, | ||
yaxis: {max: 1.0, min:0}, | yaxis: {max: 1.0, min:0}, | ||
- | grid: { | + | grid: { }, |
points: {show: true}, | points: {show: true}, | ||
lines: {show: true} | lines: {show: true} | ||
Line 343: | Line 346: | ||
$(this).addClass("selected"); | $(this).addClass("selected"); | ||
$('#mw_sequencearea').children().hide(); | $('#mw_sequencearea').children().hide(); | ||
- | + | // $('#mw_sequencearea').children().eq($(this).parent().index()).show(); | |
} | } | ||
if(widget_mode == "2D") | if(widget_mode == "2D") | ||
Line 356: | Line 359: | ||
{ | { | ||
dataseries.push(data[index]); | dataseries.push(data[index]); | ||
+ | dataseries.push(errbars_2d[index]); | ||
} | } | ||
} | } | ||
Line 368: | Line 372: | ||
xaxis: {max:.014, min:0}, | xaxis: {max:.014, min:0}, | ||
yaxis: {max: 1.0, min:0}, | yaxis: {max: 1.0, min:0}, | ||
- | grid: { | + | grid: { }, |
points: {show: true}, | points: {show: true}, | ||
lines: {show: true} | lines: {show: true} | ||
Line 395: | Line 399: | ||
//Extract plotting data | //Extract plotting data | ||
data = []; | data = []; | ||
+ | errbars_2d = []; | ||
$('#mutantwidget .xdata').each( | $('#mutantwidget .xdata').each( | ||
function(index) | function(index) | ||
{ | { | ||
data.push({color:mutantcolors[index], data:[]}); | data.push({color:mutantcolors[index], data:[]}); | ||
+ | errbars_2d.push({color:"#ff0000", data:[], points:{show:false}}); | ||
var thisdatax = $(this).text().split(','); | var thisdatax = $(this).text().split(','); | ||
var thisdatay = $('#mutantwidget .ydata').eq(index).text().split(','); | var thisdatay = $('#mutantwidget .ydata').eq(index).text().split(','); | ||
+ | var thisdataerr = $('#mutantwidget .stdevs').eq(index).text().split(','); | ||
var i; | var i; | ||
for(i=0; i < thisdatay.length; ++i) | for(i=0; i < thisdatay.length; ++i) | ||
{ | { | ||
thisdatay[i] = parseFloat(thisdatay[i]); | thisdatay[i] = parseFloat(thisdatay[i]); | ||
+ | thisdataerr[i] = parseFloat(thisdataerr[i]); | ||
} | } | ||
for(i=0; i < thisdatax.length; ++i) | for(i=0; i < thisdatax.length; ++i) | ||
Line 410: | Line 418: | ||
thisdatax[i] = parseFloat(thisdatax[i]); | thisdatax[i] = parseFloat(thisdatax[i]); | ||
data[index].data.push([thisdatax[i], thisdatay[i]]) | data[index].data.push([thisdatax[i], thisdatay[i]]) | ||
+ | errbars_2d[index].data.push([thisdatax[i], thisdatay[i]+thisdataerr[i]*2]) | ||
+ | errbars_2d[index].data.push([thisdatax[i], thisdatay[i]-thisdataerr[i]*2]) | ||
+ | errbars_2d[index].data.push([null, null]) | ||
} | } | ||
Line 418: | Line 429: | ||
xaxis: {max:.014, min:0}, | xaxis: {max:.014, min:0}, | ||
yaxis: {max: 1.0, min:0}, | yaxis: {max: 1.0, min:0}, | ||
- | grid: { | + | grid: { }, |
}); | }); | ||
Line 516: | Line 527: | ||
thisdatax[i%thisdatax.length]/axisdimensions[1]*100, | thisdatax[i%thisdatax.length]/axisdimensions[1]*100, | ||
thisdatay[Math.floor(i/thisdatax.length)]/axisdimensions[3]*100, | thisdatay[Math.floor(i/thisdatax.length)]/axisdimensions[3]*100, | ||
- | thisdataz[i]/axisdimensions[5]*100-thisdataerr[i]/axisdimensions[5]*100 | + | thisdataz[i]/axisdimensions[5]*100-thisdataerr[i]/axisdimensions[5]*100*2 |
))); | ))); | ||
errbargeom.vertices.push(new THREE.Vertex(new THREE.Vector3( | errbargeom.vertices.push(new THREE.Vertex(new THREE.Vector3( | ||
thisdatax[i%thisdatax.length]/axisdimensions[1]*100, | thisdatax[i%thisdatax.length]/axisdimensions[1]*100, | ||
thisdatay[Math.floor(i/thisdatax.length)]/axisdimensions[3]*100, | thisdatay[Math.floor(i/thisdatax.length)]/axisdimensions[3]*100, | ||
- | thisdataz[i]/axisdimensions[5]*100+thisdataerr[i]/axisdimensions[5]*100 | + | thisdataz[i]/axisdimensions[5]*100+thisdataerr[i]/axisdimensions[5]*100*2 |
))); | ))); | ||
var errbar = new THREE.Line(errbargeom, axisMat); | var errbar = new THREE.Line(errbargeom, axisMat); | ||
Line 571: | Line 582: | ||
//Find flanking x,y values | //Find flanking x,y values | ||
var kx = ky = 0; | var kx = ky = 0; | ||
- | while(thisx >= thisdatax[kx]) { | + | while(thisx >= thisdatax[kx] && kx < thisdatax.length-1) { |
kx=kx+1; | kx=kx+1; | ||
} | } | ||
- | while(thisy >= thisdatay[ky]) { | + | while(thisy >= thisdatay[ky] && ky < thisdatay.length-1) { |
ky=ky+1; | ky=ky+1; | ||
} | } | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
kx--; | kx--; | ||
ky--; | ky--; |
Revision as of 20:39, 27 September 2011