Learn R Programming

bio3d (version 2.2-4)

atom.select: Atom Selection from PDB and PRMTOP Structure Objects

Description

Return the ‘atom’ and ‘xyz’ coordinate indices of ‘pdb’ or ‘prmtop’ structure objects corresponding to the intersection of a hierarchical selection.

Usage

atom.select(...)
"atom.select"(pdb, string = NULL, type  = NULL, eleno = NULL, elety = NULL, resid = NULL, chain = NULL, resno = NULL, segid = NULL, operator = "AND", inverse = FALSE, value = FALSE, verbose=FALSE, ...)
"atom.select"(prmtop, ...)
"print"(x, ...)

Arguments

...
arguments passed to atom.select.pdb, atom.select.prmtop, or print.
pdb
a structure object of class "pdb", obtained from read.pdb.
string
a single selection keyword from calpha cbeta backbone protein nucleic ligand water h or noh.
type
a single element character vector for selecting ‘ATOM’ or ‘HETATM’ record types.
eleno
a numeric vector of element numbers.
elety
a character vector of atom names.
resid
a character vector of residue name identifiers.
chain
a character vector of chain identifiers.
resno
a numeric vector of residue numbers.
segid
a character vector of segment identifiers.
operator
a single element character specifying either the AND or OR operator by which individual selection components should be combined. Allowed values are ‘"AND"’ and ‘"OR"’.
verbose
logical, if TRUE details of the selection are printed.
inverse
logical, if TRUE the inversed selection is retured (i.e. all atoms NOT in the selection).
value
logical, if FALSE, vectors containing the (integer) indices of the matches determined by atom.select are returned, and if TRUE, a pdb object containing the matching atoms themselves is returned.
prmtop
a structure object of class "prmtop", obtained from read.prmtop.
x
a atom.select object as obtained from atom.select.

Value

Returns a list of class "select" with the following components:
atom
a numeric matrix of atomic indices.
xyz
a numeric matrix of xyz indices.
call
the matched call.

Details

This function allows for the selection of atom and coordinate data corresponding to the intersection of various input criteria.

Input selection criteria include selection string keywords (such as "calpha", "backbone", "protein", "nucleic", "ligand", etc.) and individual named selection components (including ‘chain’, ‘resno’, ‘resid’, ‘elety’ etc.).

For example, atom.select(pdb, "calpha") will return indices for all C-alpha (CA) atoms found in protein residues in the pdb object, atom.select(pdb, "backbone") will return indices for all protein N,CA,C,O atoms, and atom.select(pdb, "cbeta") for all protein N,CA,C,O,CB atoms.

Note that keyword string shortcuts can be combined with individual selection components, e.g. atom.select(pdb, "protein", chain="A") will select all protein atoms found in chain A.

Selection criteria are combined according to the provided operator argument. The default operator AND (or &) will combine by intersection while OR (or |) will take the union.

For example, atom.select(pdb, "protein", elety=c("N", "CA", "C"), resno=65:103) will select the N, CA, C atoms in the protein residues 65 through 103, while atom.select(pdb, "protein", resid="ATP", operator="OR") will select all protein atoms as well as any ATP residue(s).

Other string shortcuts include: "calpha", "back", "backbone", "cbeta", "protein", "notprotein", "ligand", "water", "notwater", "h", "noh", "nucleic", and "notnucleic".

In addition, the combine.select function can further combine atom selections using ‘AND’, ‘OR’, or ‘NOT’ logical operations.

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.

See Also

read.pdb, as.select, combine.select, trim.pdb, write.pdb, read.prmtop, read.crd, read.dcd, read.ncdf.

Examples

Run this code

##- 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