Sha256: 6af78b9de1640aefbdcff16c30c1db442c83226441c9dc6946cfe0f0234674ba

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'mspire/mass/version'
require 'mspire/mass/element'
require 'mspire/mass/subatomic'
require 'mspire/mass/common'
require 'mspire/mass/aa'

module Mspire
  # includes the Subatomic entities that are acceptable contants (e.g., H+
  # won't work) as uppercase module constants (e.g.  Mspire::Mass::ELECTRON
  # and Mspire::Mass::PROTON)
  module Mass
    Subatomic::MONO_STRING.each do |key, val|
      unless key == 'H+'
        self.const_set(key, val)
      end
    end

    #class << self
      ## takes a molecular formula as a string, hash or MolecularFormula object
      ## and returns the exact mass.
      #def formula_to_exact_mass(formula)
        #Mspire::MolecularFormula.from_any(formula).mass
      #end
      #alias_method :formula, :formula_to_exact_mass

      #def aa_to_exact_mass(aa_seq)
        #chain_mass = aa_seq.each_char.inject(0.0) do |sum, aa_char|
          #sum + AA[aa_char]
        #end
        #chain_mass + formula_to_exact_mass('H2O')
      #end
      #alias_method :aa, :aa_to_exact_mass

    #end

  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mspire-mass-0.1.0 lib/mspire/mass.rb