Published
Edited
Jun 29, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
color_choices = [
{name: 'redbluepurple', label: "Red, blue, and purple", scheme: rbpSchemeId},
{name: 'redonly', label: "Red only", scheme: roSchemeId}
]
Insert cell
PDB_ID = "7C8D"
Insert cell
sites = Array(100).fill(0).map((d, i) => i % 4)
Insert cell
colors = {
return {
'redbluepurple': [0xDDDDDD, 0xFF0000, 0x0000FF, 0xFF00FF],
'redonly': [0xDDDDDD, 0xFF0000, 0xDD0000, 0x990000]
}
}
Insert cell
Insert cell
viewport.style.height = "400px"
Insert cell
roSchemeId = {
return NGL.ColormakerRegistry.addScheme(function (params) {
this.atomColor = function (atom) {
return colors['redonly'][sites[atom.resno]]
}
})
}
Insert cell
rbpSchemeId = {
return NGL.ColormakerRegistry.addScheme(function (params) {
this.atomColor = function (atom) {
return colors['redbluepurple'][sites[atom.resno]]
}
})
}
Insert cell
Insert cell
set_color = {
str.setColor(colorchoice.scheme);
str.update({color: true});
}
Insert cell
Insert cell
NGL = require("https://cdn.rawgit.com/arose/ngl/v2.0.0-dev.37/dist/ngl.js")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more