atom2ele | R Documentation |
Convert atom names/types into atomic symbols
atom2ele(...)
## Default S3 method:
atom2ele(x, elety.custom=NULL, rescue=TRUE, ...)
## S3 method for class 'pdb'
atom2ele(pdb, inds=NULL, ...)
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 converted
based on matching with |
pdb |
an object of class ‘pdb’ for which |
inds |
an object of class ‘select’ indicating a subset of
the |
... |
further arguments passed to or from other methods. |
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.
Return a character vector of atomic symbols
Julien Ide, Lars Skjaerven
atom.index
, elements
,
read.pdb
,
atom2mass
, formula2mass
atom.names <- c("CA", "O", "N", "OXT")
atom2ele(atom.names)
# PDB server connection required - testing excluded
try({
## Get atomic symbols from a PDB object with a customized data set
pdb <- read.pdb("3RE0",verbose=FALSE)
lig <- trim(pdb, "ligand")
## maps PT1 to Pt, CL2 to Cl, C4A to C
atom2ele(lig)
## map atom name to element manually
myelety <- data.frame(name = "CL2", symb = "Cl")
atom2ele(lig, elety.custom = myelety)
}, silent=TRUE)
if(inherits(.Last.value, "try-error")) {
message("Need internet to run the example")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.