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

combine.select(sel1=NULL, sel2=NULL, ..., operator="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.

...

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.

References

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

Author

Xin-Qiu Yao

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)
#> Intersect of selects #> * Selected a total of: 5 atoms *
print( pdb$atom[ ca.local.inds$atom, ] )
#> type eleno elety alt resid chain resno insert x y z o b #> 359 ATOM 359 CA <NA> ASN A 46 <NA> 15.247 22.135 24.062 1 12.92 #> 367 ATOM 367 CA <NA> THR A 47 <NA> 18.108 23.768 25.931 1 39.90 #> 374 ATOM 374 CA <NA> ASP A 48 <NA> 16.626 22.832 29.261 1 9.90 #> 382 ATOM 382 CA <NA> GLY A 49 <NA> 16.950 19.205 28.182 1 10.24 #> 386 ATOM 386 CA <NA> SER A 50 <NA> 13.311 18.716 27.712 1 7.32 #> segid elesy charge #> 359 <NA> C <NA> #> 367 <NA> C <NA> #> 374 <NA> C <NA> #> 382 <NA> C <NA> #> 386 <NA> C <NA>
# 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="-")
#> Select 2 (, 3, ...) is subtracted from select 1 #> * Selected a total of: 13 atoms *
print( pdb$atom[ sc.local.inds$atom, ] )
#> type eleno elety alt resid chain resno insert x y z o b #> 362 ATOM 362 CB <NA> ASN A 46 <NA> 13.989 22.699 24.735 1 11.70 #> 363 ATOM 363 CG <NA> ASN A 46 <NA> 12.659 22.418 24.007 1 21.14 #> 364 ATOM 364 OD1 <NA> ASN A 46 <NA> 11.762 21.669 24.459 1 23.29 #> 365 ATOM 365 ND2 <NA> ASN A 46 <NA> 12.508 23.062 22.886 1 24.99 #> 370 ATOM 370 CB <NA> THR A 47 <NA> 18.506 25.250 25.905 1 47.42 #> 371 ATOM 371 OG1 <NA> THR A 47 <NA> 17.376 26.053 26.142 1 38.53 #> 372 ATOM 372 CG2 <NA> THR A 47 <NA> 19.115 25.572 24.552 1 58.08 #> 377 ATOM 377 CB <NA> ASP A 48 <NA> 15.349 23.377 29.887 1 14.78 #> 378 ATOM 378 CG <NA> ASP A 48 <NA> 14.119 22.821 29.267 1 19.04 #> 379 ATOM 379 OD1 <NA> ASP A 48 <NA> 14.160 21.981 28.422 1 28.31 #> 380 ATOM 380 OD2 <NA> ASP A 48 <NA> 13.002 23.315 29.717 1 28.61 #> 389 ATOM 389 CB <NA> SER A 50 <NA> 12.113 19.490 28.182 1 4.67 #> 390 ATOM 390 OG <NA> SER A 50 <NA> 12.074 20.716 27.461 1 9.76 #> segid elesy charge #> 362 <NA> C <NA> #> 363 <NA> C <NA> #> 364 <NA> O <NA> #> 365 <NA> N <NA> #> 370 <NA> C <NA> #> 371 <NA> O <NA> #> 372 <NA> C <NA> #> 377 <NA> C <NA> #> 378 <NA> C <NA> #> 379 <NA> O <NA> #> 380 <NA> O <NA> #> 389 <NA> C <NA> #> 390 <NA> O <NA>
# 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="+")
#> Union of selects #> * Selected a total of: 18 atoms *
print( pdb$atom[ casc.local.inds$atom, ] )
#> type eleno elety alt resid chain resno insert x y z o b #> 359 ATOM 359 CA <NA> ASN A 46 <NA> 15.247 22.135 24.062 1 12.92 #> 362 ATOM 362 CB <NA> ASN A 46 <NA> 13.989 22.699 24.735 1 11.70 #> 363 ATOM 363 CG <NA> ASN A 46 <NA> 12.659 22.418 24.007 1 21.14 #> 364 ATOM 364 OD1 <NA> ASN A 46 <NA> 11.762 21.669 24.459 1 23.29 #> 365 ATOM 365 ND2 <NA> ASN A 46 <NA> 12.508 23.062 22.886 1 24.99 #> 367 ATOM 367 CA <NA> THR A 47 <NA> 18.108 23.768 25.931 1 39.90 #> 370 ATOM 370 CB <NA> THR A 47 <NA> 18.506 25.250 25.905 1 47.42 #> 371 ATOM 371 OG1 <NA> THR A 47 <NA> 17.376 26.053 26.142 1 38.53 #> 372 ATOM 372 CG2 <NA> THR A 47 <NA> 19.115 25.572 24.552 1 58.08 #> 374 ATOM 374 CA <NA> ASP A 48 <NA> 16.626 22.832 29.261 1 9.90 #> 377 ATOM 377 CB <NA> ASP A 48 <NA> 15.349 23.377 29.887 1 14.78 #> 378 ATOM 378 CG <NA> ASP A 48 <NA> 14.119 22.821 29.267 1 19.04 #> 379 ATOM 379 OD1 <NA> ASP A 48 <NA> 14.160 21.981 28.422 1 28.31 #> 380 ATOM 380 OD2 <NA> ASP A 48 <NA> 13.002 23.315 29.717 1 28.61 #> 382 ATOM 382 CA <NA> GLY A 49 <NA> 16.950 19.205 28.182 1 10.24 #> 386 ATOM 386 CA <NA> SER A 50 <NA> 13.311 18.716 27.712 1 7.32 #> 389 ATOM 389 CB <NA> SER A 50 <NA> 12.113 19.490 28.182 1 4.67 #> 390 ATOM 390 OG <NA> SER A 50 <NA> 12.074 20.716 27.461 1 9.76 #> segid elesy charge #> 359 <NA> C <NA> #> 362 <NA> C <NA> #> 363 <NA> C <NA> #> 364 <NA> O <NA> #> 365 <NA> N <NA> #> 367 <NA> C <NA> #> 370 <NA> C <NA> #> 371 <NA> O <NA> #> 372 <NA> C <NA> #> 374 <NA> C <NA> #> 377 <NA> C <NA> #> 378 <NA> C <NA> #> 379 <NA> O <NA> #> 380 <NA> O <NA> #> 382 <NA> C <NA> #> 386 <NA> C <NA> #> 389 <NA> C <NA> #> 390 <NA> O <NA>
# 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="-")
#> Select 2 (, 3, ...) is subtracted from select 1 #> * Selected a total of: 9 atoms *
print( pdb$atom[ sc2.local.inds$atom, ] )
#> type eleno elety alt resid chain resno insert x y z o b #> 363 ATOM 363 CG <NA> ASN A 46 <NA> 12.659 22.418 24.007 1 21.14 #> 364 ATOM 364 OD1 <NA> ASN A 46 <NA> 11.762 21.669 24.459 1 23.29 #> 365 ATOM 365 ND2 <NA> ASN A 46 <NA> 12.508 23.062 22.886 1 24.99 #> 371 ATOM 371 OG1 <NA> THR A 47 <NA> 17.376 26.053 26.142 1 38.53 #> 372 ATOM 372 CG2 <NA> THR A 47 <NA> 19.115 25.572 24.552 1 58.08 #> 378 ATOM 378 CG <NA> ASP A 48 <NA> 14.119 22.821 29.267 1 19.04 #> 379 ATOM 379 OD1 <NA> ASP A 48 <NA> 14.160 21.981 28.422 1 28.31 #> 380 ATOM 380 OD2 <NA> ASP A 48 <NA> 13.002 23.315 29.717 1 28.61 #> 390 ATOM 390 OG <NA> SER A 50 <NA> 12.074 20.716 27.461 1 9.76 #> segid elesy charge #> 363 <NA> C <NA> #> 364 <NA> O <NA> #> 365 <NA> N <NA> #> 371 <NA> O <NA> #> 372 <NA> C <NA> #> 378 <NA> C <NA> #> 379 <NA> O <NA> #> 380 <NA> O <NA> #> 390 <NA> O <NA>