#### NMR-ensemble example
## Read a multi-model PDB file
pdb <- read.pdb("1d1d", multi=TRUE)
ca.inds <- atom.select(pdb, 'calpha')
## Find domains and write PDB
gs <- geostas(pdb)
## Plot a atomic movement similarity matrix
plot.dccm(gs$amsm, at=seq(0, 1, 0.1), main="AMSM with Domain Assignment",
col.regions=rev(heat.colors(200)), margin.segments=gs$grps, contour=FALSE)
## Fit all frames to the 'first' domain
domain.inds <- atom2xyz(which(gs$grps==1))
xyz <- fit.xyz(pdb$xyz[1, ca.inds$xyz],
pdb$xyz[, ca.inds$xyz],
fixed.inds = domain.inds,
mobile.inds = domain.inds)
#write.pdb(xyz=xyz, chain=gs$grps)
#### NMA example
## Fetch stucture
pdb <- read.pdb("1crn")
## Calculate (vibrational) normal modes
modes <- nma(pdb)
## Mode trajectories
trj <- rbind(mktrj(modes, mode=7),
mktrj(modes, mode=8),
mktrj(modes, mode=9),
mktrj(modes, mode=10),
mktrj(modes, mode=11))
## Find domains
gs <- geostas(trj, k=2)
## Write NMA trajectory with domain assignment
mktrj(modes, mode=7, chain=gs$grps)
## Redo geostas domain clustering
gs <- geostas(trj, amsm=gs$amsm, k=5)
#### Trajectory example
## Read inn DCD trajectory file, fit coordinates
dcdfile <- system.file("examples/hivp.dcd", package = "bio3d")
trj <- read.dcd(dcdfile)
xyz <- fit.xyz(trj[1,], trj)
## Find domains
gs <- geostas(xyz, k=3, fit=FALSE)
## Principal component analysis
pc.md <- pca.xyz(xyz)
## Visualize PCs with colored domains (chain ID)
mktrj(pc.md, pc=1, chain=gs$grps)
#### X-ray ensemble GroEL subunits
# Define the ensemble PDB-ids
ids <- c("1sx4_[A,B,H,I]", "1xck_[A-B]", "1sx3_[A-B]", "4ab3_[A-B]")
# Download and split PDBs by chain ID
raw.files <- get.pdb(ids, path = "raw_pdbs", gzip = TRUE)
files <- pdbsplit(raw.files, ids, path = "raw_pdbs/split_chain/")
# Align and superimpose coordinates
pdbs <- pdbaln(files)
gs <- geostas(pdbs, k=4, fit=TRUE)
# Principal component analysis
gaps.pos <- gap.inspect(pdbs$xyz)
xyz <- fit.xyz(pdbs$xyz[1, gaps.pos$f.inds],
pdbs$xyz[, gaps.pos$f.inds],
fixed.inds=gs$fit.inds,
mobile.inds=gs$fit.inds)
pc.xray <- pca.xyz(xyz)
## Visualize PCs with colored domains (chain ID)
mktrj(pc.xray, pc=1, chain=gs$grps)
Run the code above in your browser using DataLab