Published
Edited
Apr 29, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html `<svg id='genemap'>`
Insert cell
mapviz = {
d3.select()
}
Insert cell
stage1 = {
let s = new NGL.Stage( "viewport1" ,{ backgroundColor: "white" })
return s
};
Insert cell
structure1 = {
let str;
const molecule = "rcsb://6JX7";
await stage1.loadFile(molecule).then(d => {
d.addRepresentation("cartoon", { color: schemeId, sele: ':A'})
stage1.autoView();
str = d;
})
return str;
}
Insert cell
scale = d3.scaleLinear()
//.domain([0, 1, d3.max(_.pluck(processed_data, 'omega'))])
.domain([0, 1, 2])
.range(['#000000', '#EEEEEE', '#FF0000'])
Insert cell
schemeId = {
return NGL.ColormakerRegistry.addScheme(function (params) {
this.atomColor = function (atom) {
let residue_number = atom.residue.resno;
let omega = processed_data[residue_number - 1] || 1;
return parseInt(
d3.color(scale(omega)).formatHex().slice(1), 16
);
}

})
}
Insert cell
NGL = require("https://cdn.rawgit.com/arose/ngl/v2.0.0-dev.37/dist/ngl.js")
Insert cell
stage1.viewerControls.getOrientation()
Insert cell
import {Table} from "@observablehq/inputs"
Insert cell
_ = require("underscore")
Insert cell
processed_data = {
let pd = {};
raw_data.forEach(datum => {
if (datum.UNALIGNED_CODON_SITE_IN_SPIKE == 'X') return;
let alpha = +datum.alpha,
beta = +datum['beta (FIPV1)'],
omega = alpha == 0 ? 0 : Math.min(beta / alpha, 2);
pd[+datum.UNALIGNED_CODON_SITE_IN_SPIKE] = omega;
});
return pd
}
Insert cell
raw_data = FileAttachment('FCOV1.mapped.CFEL.FINAL.csv').csv()
Insert cell
d3 = require('d3@6')
Insert cell
import {legend} from "@d3/color-legend"
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