atom2ele.Rd
Convert atom names/types into atomic symbols
atom2ele(...) # S3 method for default atom2ele(x, elety.custom=NULL, rescue=TRUE, ...) # S3 method for 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
#> [1] "C" "O" "N" "O"# \donttest{ # 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=TRUElig <- trim(pdb, "ligand") ## maps PT1 to Pt, CL2 to Cl, C4A to C atom2ele(lig)#> Warning: #> mapped element PT1 to Pt #> mapped element N1 to N #> mapped element N2 to N #> mapped element CL2 to Cl#> [1] "Pt" "N" "N" "Cl" "Pt" "N" "N" "Cl"## map atom name to element manually myelety <- data.frame(name = "CL2", symb = "Cl") atom2ele(lig, elety.custom = myelety)#> Warning: #> mapped element PT1 to Pt #> mapped element N1 to N #> mapped element N2 to N#> [1] "Pt" "N" "N" "Cl" "Pt" "N" "N" "Cl"# }