atom2ele: Atom Names/Types to Atomic Symbols Converter

View source: R/atom2ele.R

atom2eleR Documentation

Atom Names/Types to Atomic Symbols Converter

Description

Convert atom names/types into atomic symbols

Usage

atom2ele(...)

## Default S3 method:
atom2ele(x, elety.custom=NULL, rescue=TRUE, ...)

## S3 method for class 'pdb'
atom2ele(pdb, inds=NULL, ...)

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 converted based on matching with bio3d::elements$symb.

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.

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

Return a character vector of atomic symbols

Author(s)

Julien Ide, Lars Skjaerven

See Also

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

Examples

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


# PDB server connection required - testing excluded

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



bio3d documentation built on Oct. 27, 2022, 1:06 a.m.