Public
Edited
Feb 1, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
color_hash = {
return {
blue: 0x00FFFF,
red: 0xcf5b5b,
yellow: 0xFFFF00,
green: 0x5fcf5b,
pink: 0xFFC0CB,
gray: 0x808080
};
}
Insert cell
Insert cell
//selected_sites = [0]*1447 // Default
Insert cell
Insert cell
Insert cell
stage.viewerControls.getOrientation()
Insert cell
Insert cell
schemeId = {
return NGL.ColormakerRegistry.addScheme(function (params) {
this.atomColor = function (atom) {
if(selected_sites[atom.residue.resno]) {
console.log("# Site: " + atom.residue.resno)
let site_color = "gray"; // gray for Neutral
console.log("Class: " + selected_sites[atom.residue.resno].class)
if (selected_sites[atom.residue.resno].mutationClass == "MISSENSE") {
site_color = "green";
}

//if (selected_sites[atom.residue.resno] == "289") {
// console.log ("FOUND TARGET SITE");
// site_color = "yellow";
//}

if (selected_sites[atom.residue.resno].mutationClass == "NONSENSE") {
site_color = "blue";
}

if (selected_sites[atom.residue.resno].mutationClass == "INFRAME") {
site_color = "yellow";
}

if (selected_sites[atom.residue.resno].mutationClass == "TRUNC") {
site_color = "red";
}

//if (selected_sites[atom.residue.resno].mutationClass == "FS DEL") {
// site_color = "red";
//}

//if (selected_sites[atom.residue.resno].mutationClass == "FS INS") {
// site_color = "red";
//}

if (selected_sites[atom.residue.resno].mutationClass == "Silent") {
site_color = "pink";
}
//if (selected_sites[atom.residue.resno].mutationClass == "INFRAME") {
// site_color = "gray";
// }

return color_hash[site_color];
//return color_hash[selected_sites[atom.residue.resno].color];
}
else {
// gray
//return 0x808080;
return color_hash["gray"]
}
}
})
}
Insert cell
flare = FileAttachment("PDS5Bmutation2@2.csv").csv()
Insert cell
tooltip = {
let tt = document.createElement("div");
document.body.appendChild(tt);
Object.assign(tt.style, {
display: "none",
position: "absolute",
zIndex: 10,
pointerEvents: "none",
backgroundColor: "rgba(1, 1, 1, 1)",
color: "lightgrey",
padding: "0.5em",
fontFamily: "sans-serif"
});
return tt;
}
Insert cell
component = {
let str;
stage.removeAllComponents();
var stringBlob = new Blob( [ pdbText ], { type: 'text/plain'} );
stage.loadFile(stringBlob, { ext: "pdb" }).then(d=>{
d.addRepresentation("rope", {color: schemeId})
//d.addRepresentation("hyperball", { sele: selection_string , color: schemeId});
d.addRepresentation("licorice", { sele: selection_string , color: schemeId});

stage.viewerControls.orient([17.550527072492336, 77.73142323575034, -35.35459236339453, 0, 76.29412120673659, 1.939498913978275, 42.137723873208586, 0, 38.35789916992212, -39.42342635625532, -67.63584394065052, 0, 3.367788314819336, 0.33123016357421875, 3.3393964767456055, 1]);
stage.setSpin(false);
str = d;
})
return str;
}
Insert cell
selection_string = _.map (
Object.keys(selected_sites), (i, s) => ['A'].map(chain => i + ':' + chain).join(" OR ")
).join (" OR ")
Insert cell
a = require('https://stephenshank.com/bundle.js')
Insert cell
NGL = require("ngl@2.0.0-dev.38")
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