# NOT RUN {
# PDB server connection required - testing excluded
# Read a PDB file and write it as a PQR file
pdb <- read.pdb( "4q21" )
outfile = file.path(tempdir(), "eg.pqr")
write.pqr(pdb=pdb, file = outfile)
# Read the PQR file
pqr <- read.pqr(outfile)
## Print a brief composition summary
pqr
## Examine the storage format (or internal *str*ucture)
str(pqr)
## Print data for the first four atom
pqr$atom[1:4,]
## Print some coordinate data
head(pqr$atom[, c("x","y","z")])
## Print C-alpha coordinates (can also use 'atom.select' function)
head(pqr$atom[pqr$calpha, c("resid","elety","x","y","z")])
inds <- atom.select(pqr, elety="CA")
head( pqr$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(pqr,"ligand")
pqr$atom[inds$atom,]
pqr$xyz[inds$xyz]
## See the help page for atom.select() function for more details.
# }
Run the code above in your browser using DataLab