Learn R Programming

bio3d (version 2.1-2)

atom2ele: Atom Names/Types to Atomic Symbols Converter

Description

Convert atom names/types into atomic symbols

Usage

atom2ele(...)

## S3 method for class 'default': atom2ele(x, elety.custom=NULL, rescue=TRUE, \dots)

## S3 method for class 'pdb': atom2ele(pdb, inds, elety.custom=NULL, rescue=TRUE, \dots)

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.

Value

  • Return a character vector of 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.

See Also

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

Examples

Run this code
atom.names <- c("CA", "O", "N", "OXT")
atom2ele(atom.names)

## Get atomic symbols from a PDB object with a customized data set
pdb <- read.pdb("3RE0",verbose=FALSE)
inds <- atom.select(pdb, resno=201, verbose=FALSE)

## maps CL2 to C
atom2ele(pdb, inds, elety.custom = NULL)

## map CL2 to Cl manually
myelety <- data.frame(name = "CL2", symb = "Cl")
atom2ele(pdb, inds, elety.custom = myelety)

Run the code above in your browser using DataLab