Learn R Programming

bio3d (version 2.1-2)

combine.sel: Combine Atom Selections From PDB Structure

Description

Do "and", "or", or "not" logical operations between two atom selections made by atom.select

Usage

combine.sel(sel1=NULL, sel2=NULL, op="AND", verbose=TRUE)

Arguments

sel1
an atom selection object of class "select", obtained from atom.select.
sel2
a second atom selection object of class "select", obtained from atom.select.
op
name of the logical operation.
verbose
logical, if TRUE details of the selection combination are printed.

Value

  • Returns a list of class "select" with components:
  • atomatom indices of selected atoms.
  • xyzxyz indices of selected atoms.

Details

The value of op should be one of following: (1) "AND", "and", or "&" for set intersection, (2) "OR", "or", "|", or "+" for set union, (3) "NOT", "not", "!", or "-" for set difference sel1 - sel2.

References

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

See Also

atom.select

Examples

Run this code
# Read a PDB file
pdb <- read.pdb( system.file("examples/1hel.pdb", package="bio3d") )

# Select all C-alpha atoms
ca.inds <- atom.select(pdb, "calpha")

# Select all atoms with residues numbers between 43 and 54
res.inds <- atom.select(pdb, resno=43:54)

# Select all C-beta atoms with residues numbers between 43 and 54
cb.inds <- atom.select(pdb, resno=43:54, elety="CB")

# Intersection
inds <- combine.sel(ca.inds, res.inds, op="AND")
print( pdb$atom[ inds$atom, "resid" ] )
print( pdb$xyz[ inds$xyz ] )

# Union
inds2 <- combine.sel(inds, cb.inds, op="+")

# Not
inds3 <- combine.sel(res.inds, ca.inds, op="-")

Run the code above in your browser using DataLab