## Read a PDB file from the RCSB online database
#pdb <- read.pdb("4q21")
## Read a PDB file from those included with the package
pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )
## Print a brief composition summary
pdb
## Examine the storage format (or internal *str*ucture)
str(pdb)
## Print data for the first four atom
pdb$atom[1:4,]
## Print some coordinate data
head(pdb$atom[, c("x","y","z")])
## Or coordinates as a numeric vector
head(pdb$xyz)
## Print C-alpha coordinates (can also use 'atom.select' function)
head(pdb$atom[pdb$calpha, c("resid","elety","x","y","z")])
inds <- atom.select(pdb, elety="CA")
head( pdb$atom[inds$atom, ] )
## The atom.select() function returns 'indices' (row numbers)
## that can be used for accessing subsets of PDB objects, e.g.
inds <- atom.select(pdb,"ligand")
pdb$atom[inds$atom,]
pdb$xyz[inds$xyz]
## See the help page for atom.select() function for more details.
## Not run:
# ## Print SSE data for helix and sheet,
# ## see also dssp() and stride() functions
# print.sse(pdb)
# pdb$helix
# pdb$sheet$start
#
# ## Print SEQRES data
# pdb$seqres
#
# ## SEQRES as one letter code
# aa321(pdb$seqres)
#
# ## Where is the P-loop motif in the ATOM sequence
# inds.seq <- motif.find("G....GKT", pdbseq(pdb))
# pdbseq(pdb)[inds.seq]
#
# ## Where is it in the structure
# inds.pdb <- atom.select(pdb,resno=inds.seq, elety="CA")
# pdb$atom[inds.pdb$atom,]
# pdb$xyz[inds.pdb$xyz]
#
# ## View in interactive 3D mode
# #view(pdb)
# ## End(Not run)
Run the code above in your browser using DataLab