## Read a PDB file from the RCSB online database
pdb <- read.pdb("1bg2")
## Select calpha atoms
sele <- atom.select(pdb, "calpha")
## Trim PDB
new.pdb <- trim.pdb(pdb, inds=sele)
## Write to file
write.pdb(new.pdb, file="calpha.pdb")
Run the code above in your browser using DataLab