Published
Edited
Sep 29, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//result_json = await d3.json ("https://data.hyphy.org/web/busted-ph/"+ phenotype +"_ags.json");
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/*
average_pos = {
let keys = Object.keys(sorted[0])
keys = keys.filter(key => key != 'ID' && key != 'Selection associated with phenotype');
const len_bins = sorted.length/10 // len_bins = 31
let dummy_list = [] // to store 10 lines at a time
let bin_list = [] // to store average of dummy_list
for (let i = 0; i < 10; i++){
dummy_list = sorted.slice(i*len_bins, (i + 1) * len_bins + 1)
bin_list[i] = {}
for (let name of keys){
const average_val = dummy_list.reduce((total, next) => total + next[name], 0) / dummy_list.length
bin_list[i][name] = average_val
}
}
return bin_list
}
*/
Insert cell
//dotplot = Plot.dot(reduced_busted, {x: "w3_t", y: "w1_t", stroke: "Selection associated with phenotype"}).plot()
Insert cell
//dotplot2 = Plot.dot(reduced_pos, {x: "w3_t", y: "w1_t", stroke: "Selection associated with phenotype"}).plot()
Insert cell
//dotplot3 = Plot.dot(reduced_busted, {x: "w3_t", y: "FG p-value", stroke: "Selection associated with phenotype"}).plot()
Insert cell
/*hist = {
let w3_t_pos = []
for (let i = 0; i < pos_sel.length; i++){
w3_t_pos.push(pos_sel[i]["w3_t"])
}
var histGenerator = d3.bin()
.domain([Math.min(...w3_t_pos),Math.max(...w3_t_pos)])
.thresholds(10);
var bins = histGenerator(w3_t_pos);
return bins
}
*/
Insert cell
//lenend for figure from BUSTED-PH simulations (but the figure just looks like grass here)
/*
Legend(omega_color, {
title: "dN/dS",
tickFormat: ".2"
})

*/
Insert cell
//figure from busted-ph simulations (just looks like grass)
/*
canvas = {
const h = average_pos.length;
if (h) {
const w = 300;
const R = 2;
const context = DOM.context2d(w*R*2, 2*h*R, 1);
for (let i = 0; i < h; i++) {
let from = 0.;
let to = average_pos[i].p1_t;
context.fillStyle = omega_color (average_pos[i].w1_t);
context.fillRect( from*w*R, i*2*R, R*(to-from)*w, R );
from = to;
to += average_pos[i].p2_t;
context.fillStyle = omega_color (average_pos[i].w2_t);
context.fillRect( from*w*R, i*2*R, R*(to-from)*w, R );
from = to;
to += average_pos[i].p3_t;
context.fillStyle = omega_color (average_pos[i].w3_t);
context.fillRect( from*w*R, i*2*R, R*(to-from)*w, R );
from = 0.;
to = average_pos[i].p1_b;
context.fillStyle = omega_color (average_pos[i].w1_b);
context.fillRect( from*w*R, i*2*R + R, R*(to-from)*w, R );
from = to;
to += average_pos[i].p2_b;
context.fillStyle = omega_color (average_pos[i].w2_b);
context.fillRect( from*w*R, i*2*R + R , R*(to-from)*w, R );
from = to;
to += average_pos[i].p3_b;
context.fillStyle = omega_color (average_pos[i].w3_b);
context.fillRect( from*w*R, i*2*R + R , R*(to-from)*w, R );
}
return context.canvas;
}
return DOM.context2d(1,1,1).canvas;
}
*/
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more