Class: ChemSpider::ExtendedCompoundInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/chem_spider/services/mass_spec_a_p_i.rb

Constant Summary collapse

ATTRIBUTES =
{
  :csid => {
    :selector => 'CSID',
    :datatype => Integer,
    :first_child => true,
  },
  :molecular_formula => {
    :selector => 'MF',
    :datatype => String,
    :first_child => true,
  },
  :smiles => {
    :selector => 'SMILES',
    :datatype => String,
    :first_child => true,
  },
  :inchi => {
    :selector => 'InChI',
    :datatype => String,
    :first_child => true,
  },
  :inchi_key => {
    :selector => 'InChIKey',
    :datatype => String,
    :first_child => true,
  },
  :average_mass => {
    :selector => 'AverageMass',
    :datatype => Float,
    :first_child => true,
  },
  :molecular_weight => {
    :selector => 'MolecularWeight',
    :datatype => Float,
    :first_child => true,
  },
  :monoisotopic_mass => {
    :selector => 'MonoisotopicMass',
    :datatype => Float,
    :first_child => true,
  },
  :nominal_mass => {
    :selector => 'NominalMass',
    :datatype => Float,
    :first_child => true,
  },
  :a_log_p => {
    :selector => 'ALogP',
    :datatype => Float,
    :first_child => true,
  },
  :x_log_p => {
    :selector => 'XLogP',
    :datatype => Float,
    :first_child => true,
  },
  :common_name => {
    :selector => 'CommonName',
    :datatype => String,
    :first_child => true,
  },
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ExtendedCompoundInfo

Returns a new instance of ExtendedCompoundInfo.



74
75
76
77
78
# File 'lib/chem_spider/services/mass_spec_a_p_i.rb', line 74

def initialize(attributes = {})
  ATTRIBUTES.keys.each do |attr_name|
    instance_variable_set(:"@#{attr_name}", attributes[attr_name])
  end
end

Class Method Details

.__attributes__Object



67
68
69
# File 'lib/chem_spider/services/mass_spec_a_p_i.rb', line 67

def __attributes__
  ATTRIBUTES
end