module Mspire::MolecularFormula::AA
Constants
- FORMULAS_STRING
molecular formulas for each amino acid residue (no H or OH on ends) keyed by
AA
string. Shares formula objects with FORMULAS_SYBMOL and FORMULAS.
Public Class Methods
formulas(by: :symbol)
click to toggle source
returns hash of molecular formulas keyed by amino acid single letter symbol
options:
:by = :symbol | :string | :both (:symbol is default)
# File lib/mspire/molecular_formula/aa.rb, line 46 def formulas(by: :symbol) case by when :symbol, :both sym_hash = Mspire::MolecularFormula::AA::FORMULAS_STRING.map {|k,v| [k.to_sym, v] }.to_h when :string return Mspire::MolecularFormula::AA::FORMULAS_STRING else raise ArgumentError, ":by must be :symbol, :string, or :both" end if by == :symbol sym_hash else Mspire::MolecularFormula::AA::FORMULAS_STRING.merge(sym_hash) end end