# PDB server connection required - testing excluded
#### NMR-ensemble example
## Read a multi-model PDB file
pdb <- read.pdb("1d1d", multi=TRUE)
## Find domains and write PDB
gs <- geostas(pdb, fit=TRUE)
## Plot a atomic movement similarity matrix
plot.geostas(gs, contour=FALSE)
## Fit all frames to the 'first' domain
domain.inds <- gs$inds[[1]]
xyz <- pdbfit(pdb, inds=domain.inds)
#write.pdb(pdb, xyz=xyz, chain=gs$atomgrps)
## Not run:
# #### NMA example
# ## Fetch stucture
# pdb <- read.pdb("1crn")
#
# ## Calculate (vibrational) normal modes
# modes <- nma(pdb)
#
# ## Find domains
# gs <- geostas(modes, k=2)
#
# ## Write NMA trajectory with domain assignment
# mktrj(modes, mode=7, chain=gs$grps)
#
# ## Redo geostas domain clustering
# gs <- geostas(modes, 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 structures
# pdbs <- pdbaln(files)
#
# # Find domains
# gs <- geostas(pdbs, k=4, fit=TRUE)
#
# # Superimpose to core region
# pdbs$xyz <- pdbfit(pdbs, inds=gs$fit.inds)
#
# # Principal component analysis
# pc.xray <- pca(pdbs)
#
# # Visualize PCs with colored domains (chain ID)
# mktrj(pc.xray, pc=1, chain=gs$grps)
#
#
# ##- Same, but more manual approach
# gaps.pos <- gap.inspect(pdbs$xyz)
#
# # Find core region
# core <- core.find(pdbs)
#
# # Fit to core region
# xyz <- fit.xyz(pdbs$xyz[1, gaps.pos$f.inds],
# pdbs$xyz[, gaps.pos$f.inds],
# fixed.inds=core$xyz,
# mobile.inds=core$xyz)
#
# # Find domains
# gs <- geostas(xyz, k=4, fit=FALSE)
#
# # Perform PCA
# pc.xray <- pca.xyz(xyz)
#
# # Make trajectory
# mktrj(pc.xray, pc=1, chain=gs$grps)
#
# ## End(Not run)
Run the code above in your browser using DataLab