Atom Names/Types to Atomic Symbols Converter

Usage

atom2ele(...)
"atom2ele"(x, elety.custom=NULL, rescue=TRUE, ...)
"atom2ele"(pdb, inds, elety.custom=NULL, rescue=TRUE, ...)

Arguments

x
a character vector containing atom names/types to be converted.
elety.custom
a customized data.frame containing atom names/types and corresponding atomic symbols.
rescue
logical, if TRUE the atomic symbols will be mapped to the first character of the atom names/types.
pdb
an object of class ‘pdb’ for which elety will be converted.
inds
an object of class ‘select’ indicating a subset of the pdb object to be used (see atom.select and trim.pdb).
...
further arguments passed to or from other methods.

Description

Convert atom names/types into atomic symbols

Details

The default method searchs for the atom names/types in the atom.index data set and returns their corresponding atomic symbols. If elety.custom is specified it is combined with atom.index (using rbind) before searching. Therefore, elety.custom must contains columns named name and symb.

The S3 method for object of class ‘pdb’, pass pdb$atom[,"elety"] to the default method.

Value

Examples

atom.names <- c("CA", "O", "N", "OXT") atom2ele(atom.names)
[1] "C" "O" "N" "O"
# PDB server connection required - testing excluded ## Get atomic symbols from a PDB object with a customized data set pdb <- read.pdb("3RE0",verbose=FALSE)
Note: Accessing on-line PDB file PDB has ALT records, taking A only, rm.alt=TRUE
inds <- atom.select(pdb, resno=201, verbose=FALSE) ## maps CL2 to C atom2ele(pdb, inds, elety.custom = NULL)
Warning message: unknown element: mapped PT1 to P unknown element: mapped N1 to N unknown element: mapped N2 to N unknown element: mapped CL2 to C
[1] "P" "N" "N" "C"
## map CL2 to Cl manually myelety <- data.frame(name = "CL2", symb = "Cl") atom2ele(pdb, inds, elety.custom = myelety)
Warning message: unknown element: mapped PT1 to P unknown element: mapped N1 to N unknown element: mapped N2 to N
[1] "P" "N" "N" "Cl"

See also

atom.index, elements, read.pdb, atom2mass, formula2mass

Author

Julien Ide, Lars Skjaerven