combine.select {bio3d} | R Documentation |
Combine Atom Selections From PDB Structure
Description
Do "and", "or", or "not" set operations between two or more atom
selections made by atom.select
Usage
combine.select(sel1=NULL, sel2=NULL, ..., operator="AND", verbose=TRUE)
Arguments
sel1 |
an atom selection object of class |
sel2 |
a second atom selection object of class |
... |
more select objects for the set operation. |
operator |
name of the set operation. |
verbose |
logical, if TRUE details of the selection combination are printed. |
Details
The value of operator
should be one of following:
(1) "AND", "and", or "&" for set intersect,
(2) "OR", "or", "|", or "+" for set union,
(3) "NOT", "not", "!", or "-" for set difference sel1 - sel2 - sel3 ...
.
Value
Returns a list of class "select"
with components:
atom |
atom indices of selected atoms. |
xyz |
xyz indices of selected atoms. |
call |
the matched call. |
Author(s)
Xin-Qiu Yao
References
Grant, B.J. et al. (2006) Bioinformatics 22, 2695–2696.
See Also
atom.select
, as.select
read.pdb
, trim.pdb
Examples
# Read a PDB file
pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )
## - Build atom selections to be operated
# Select C-alpha atoms of entire system
ca.global.inds <- atom.select(pdb, "calpha")
# Select C-beta atoms of entire protein
cb.global.inds <- atom.select(pdb, "protein", elety="CB")
# Select backbone atoms of entire system
bb.global.inds <- atom.select(pdb, "backbone")
# Select all atoms with residue number from 46 to 50
aa.local.inds <- atom.select(pdb, resno=46:50)
# Do set intersect:
# - Return C-alpha atoms with residue number from 46 to 50
ca.local.inds <- combine.select(ca.global.inds, aa.local.inds)
print( pdb$atom[ ca.local.inds$atom, ] )
# Do set subtract:
# - Return side-chain atoms with residue number from 46 to 50
sc.local.inds <- combine.select(aa.local.inds, bb.global.inds, operator="-")
print( pdb$atom[ sc.local.inds$atom, ] )
# Do set union:
# - Return C-alpha and side-chain atoms with residue number from 46 to 50
casc.local.inds <- combine.select(ca.local.inds, sc.local.inds, operator="+")
print( pdb$atom[ casc.local.inds$atom, ] )
# More than two selections:
# - Return side-chain atoms (but not C-beta) with residue number from 46 to 50
sc2.local.inds <- combine.select(aa.local.inds, bb.global.inds, cb.global.inds, operator="-")
print( pdb$atom[ sc2.local.inds$atom, ] )