# Read a PDB file
pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )
# Select all C-alpha atoms
ca.inds <- atom.select(pdb, "calpha")
# Select all atoms with residues numbers between 43 and 54
res.inds <- atom.select(pdb, resno=43:54)
# Select all C-beta atoms with residues numbers between 43 and 54
cb.inds <- atom.select(pdb, resno=43:54, elety="CB")
# Intersection
inds <- combine.sel(ca.inds, res.inds, op="AND")
print( pdb$atom[ inds$atom, "resid" ] )
print( pdb$xyz[ inds$xyz ] )
# Union
inds2 <- combine.sel(inds, cb.inds, op="+")
# Not
inds3 <- combine.sel(res.inds, ca.inds, op="-")
Run the code above in your browser using DataLab