atom.select {bio3d} | R Documentation

## 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(...)

    ## S3 method for class 'pdb'
    atom.select(pdb, string = NULL,
                              type  = NULL, eleno = NULL, elety = NULL,
                              resid = NULL, chain = NULL, resno = NULL,
                              insert = NULL, segid = NULL,
                              operator = "AND", inverse = FALSE,
                              value = FALSE, verbose=FALSE, ...)

    ## S3 method for class 'mol2'
    atom.select(mol, string=NULL,
                               eleno = NULL, elena = NULL, elety = NULL,
                               resid = NULL, chain = NULL, resno = NULL,
                               statbit = NULL,
    			   operator = "AND", inverse = FALSE,
                               value = FALSE, verbose=FALSE,  ...)

    ## S3 method for class 'prmtop'
    atom.select(prmtop, ...)

    ## S3 method for class 'select'
    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` `sidechain` `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.
`elena` | a character vector of atom names.
`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.
`insert` | a character vector of insert identifiers. Non-insert residues can be selected with `NA` or ‘’ values. The default value of `NULL` will select both insert and non-insert residues.
`segid` | a character vector of segment identifiers. Empty segid values can be selected with `NA` or ‘’ values. The default value of `NULL` will select both empty and non-empty 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.
`mol` | a structure object of class `"mol2"`, obtained from `read.mol2`.
`statbit` | a character vector of statbit identifiers.
`prmtop` | a structure object of class `"prmtop"`, obtained from `read.prmtop`.
`x` | a atom.select object as obtained from `atom.select`.

### 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"`, `"sidechain"`, `"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.

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

### Note

Protein atoms are defined as any atom in a residue matching the residue name in the attached `aa.table` data frame. See `aa.table$aa3` for a complete list of residue names.

Nucleic atoms are defined as all atoms found in residues with names A, U, G, C, T, I, DA, DU, DG, DC, DT, or DI.

Water atoms/residues are defined as those with residue names H2O, OH2, HOH, HHO, OHH, SOL, WAT, TIP, TIP, TIP3, or TIP4.

### Author(s)

Barry Grant, Lars Skjaerven

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

    ##- 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(system.file("examples/crambin.prmtop", package="bio3d"))

    ## Atom selection
    ca.inds <- atom.select(prmtop, "calpha")

    ## End(Not run)

[Package bio3d version 2.3-4 Index]