## Not run:
# ##-- Generate a small kinesin alignment and read corresponding structures
# pdbfiles <- get.pdb(c("1bg2","2ncd","1i6i","1i5s"), URLonly=TRUE)
# pdbs <- pdbaln(pdbfiles)
#
# ##-- Find 'core' positions
# core <- core.find(pdbs)
# plot(core)
#
# ##-- Fit on these relatively invarient subset of positions
# #core.inds <- print(core, vol=1)
# core.inds <- print(core, vol=0.5)
# xyz <- pdbfit(pdbs, core.inds, outpath="corefit_structures")
#
# ##-- Compare to fitting on all equivalent positions
# xyz2 <- pdbfit(pdbs)
#
# ## Note that overall RMSD will be higher but RMSF will
# ## be lower in core regions, which may equate to a
# ## 'better fit' for certain applications
# gaps <- gap.inspect(pdbs$xyz)
# rmsd(xyz[,gaps$f.inds])
# rmsd(xyz2[,gaps$f.inds])
#
# plot(rmsf(xyz[,gaps$f.inds]), typ="l", col="blue", ylim=c(0,9))
# points(rmsf(xyz2[,gaps$f.inds]), typ="l", col="red")
# ## End(Not run)
## Not run:
# ##-- Run core.find() on a multimodel PDB file
# pdb <- read.pdb('1d1d', multi=TRUE)
# core <- core.find(pdb)
#
# ##-- Run core.find() on a trajectory
# trtfile <- system.file("examples/hivp.dcd", package="bio3d")
# trj <- read.dcd(trtfile)
#
# ## Read the starting PDB file to determine atom correspondence
# pdbfile <- system.file("examples/hivp.pdb", package="bio3d")
# pdb <- read.pdb(pdbfile)
#
# ## select calpha coords from a manageable number of frames
# ca.ind <- atom.select(pdb, "calpha")$xyz
# frames <- seq(1, nrow(trj), by=10)
#
# core <- core.find( trj[frames, ca.ind], write.pdbs=TRUE )
#
# ## have a look at the various cores "vmd -m core_pruned/*.pdb"
#
# ## Lets use a 6A^3 core cutoff
# inds <- print(core, vol=6)
# write.pdb(xyz=pdb$xyz[inds$xyz],resno=pdb$atom[inds$atom,"resno"], file="core.pdb")
#
#
# ##- Fit trj onto starting structure based on core indices
# xyz <- fit.xyz( fixed = pdb$xyz,
# mobile = trj,
# fixed.inds = inds$xyz,
# mobile.inds = inds$xyz)
#
# ##write.pdb(pdb=pdb, xyz=xyz, file="new_trj.pdb")
# ##write.ncdf(xyz, "new_trj.nc")
#
# ## End(Not run)
Run the code above in your browser using DataLab