##- PDB example
# Read a PDB file
pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )
# Select protein atoms of chain A
atom.select(pdb, "protein", chain="A")
# Select all atoms except from the protein
atom.select(pdb, "protein", inverse=TRUE, verbose=TRUE)
# Select all C-alpha atoms with residues numbers between 43 and 54
sele <- atom.select(pdb, "calpha", resno=43:54, verbose=TRUE)
# Access the PDB data with the selection indices
print( pdb$atom[ sele$atom, "resid" ] )
print( pdb$xyz[ sele$xyz ] )
# Trim PDB to selection
ca.pdb <- trim.pdb(pdb, sele)
## Not run:
#
# ##- PRMTOP example
# prmtop <- read.prmtop("prot_solvated.prmtop")
#
# ## Atom selection
# ca.inds <- atom.select(prmtop, "calpha")
#
# ## End(Not run)
Run the code above in your browser using DataLab