mspire 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/README.md +5 -2
- data/lib/mspire/isotope/distribution.rb +14 -7
- data/lib/mspire/isotope/neese.rb +33 -0
- data/lib/mspire/isotope/{nist_isotope_info.yml → nist/isotope_info.yml} +0 -0
- data/lib/mspire/isotope/nist/updater.rb +67 -0
- data/lib/mspire/isotope/nist.rb +19 -0
- data/lib/mspire/isotope.rb +18 -80
- data/lib/mspire/version.rb +1 -1
- data/spec/mspire/isotope/distribution_spec.rb +17 -9
- data/spec/mspire/isotope/nist_spec.rb +32 -0
- data/spec/mspire/isotope_spec.rb +4 -4
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cacdee4487f5e6a98d31c9649cb02390bce1dd9d
|
4
|
+
data.tar.gz: 64ae39986bc3bb20dcbcff972ef8162bdd36609b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6523afd75ba3fd0f179d587413b6c85f7bf77152e8c97a155152352498742ff3c53d628b49b9d613f51a1f9d33fde5d7e2f9911c9055d0b751979ad2127faac4
|
7
|
+
data.tar.gz: fae953898b991b9f0cb6917fc8eaf4ff2e8557c6f73f82b750abe22b68f5f435de300c36c0b7835751b7a48ac22e40d59d340e4f4d6898478615fe6cbf66e892
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -125,12 +125,15 @@ Mspire::Mass::Subatomic::MONO[:electron]
|
|
125
125
|
|
126
126
|
### Isotopes and molecular formulas
|
127
127
|
|
128
|
+
Uses Richard Neese biological isotope ratios by default. All other isotope information culled from NIST.
|
129
|
+
|
128
130
|
```ruby
|
129
131
|
require 'mspire/isotope'
|
130
132
|
isotopes = Mspire::Isotope::ISOTOPES # 288 isotopes
|
131
|
-
|
133
|
+
# same as Mspire::Isotope::Neese::ISOTOPES ; compare to Mspire::Isotope::NIST::ISOTOPES
|
134
|
+
hydrogen_isotopes = isotopes.select {|iso| iso.element == :H }
|
132
135
|
|
133
|
-
c12 = Mspire::Isotope::BY_ELEMENT[:
|
136
|
+
c12 = Mspire::Isotope::BY_ELEMENT[:C].first
|
134
137
|
c12.atomic_number # also: mass_number atomic_mass relative_abundance average_mass
|
135
138
|
c12.mono # => true (this is the monoisotopic isotope)
|
136
139
|
|
@@ -106,14 +106,21 @@ module Mspire
|
|
106
106
|
|
107
107
|
class Isotope
|
108
108
|
module Distribution
|
109
|
-
def self.calculate(molecular_formula_like, normalize=Mspire::Isotope::Distribution::NORMALIZE, percent_cutoff=nil)
|
110
|
-
mf = molecular_formula_like.is_a?(Mspire::MolecularFormula) ? molecular_formula_like : Mspire::MolecularFormula.from_any(molecular_formula_like)
|
111
|
-
mf.isotope_distribution(normalize, percent_cutoff)
|
112
|
-
end
|
113
109
|
|
114
|
-
|
115
|
-
|
116
|
-
|
110
|
+
class << self
|
111
|
+
def to_mf(obj)
|
112
|
+
obj.is_a?(Mspire::MolecularFormula) ? obj : Mspire::MolecularFormula.from_any(obj)
|
113
|
+
end
|
114
|
+
|
115
|
+
def calculate(molecular_formula_like, normalize=NORMALIZE, percent_cutoff=nil, isotope_table=Mspire::Isotope::BY_ELEMENT)
|
116
|
+
mf = to_mf(molecular_formula_like)
|
117
|
+
mf.isotope_distribution(normalize, percent_cutoff, isotope_table)
|
118
|
+
end
|
119
|
+
|
120
|
+
def spectrum(molecular_formula_like, normalize=NORMALIZE, percent_cutoff=nil, isotope_table=Mspire::Isotope::BY_ELEMENT)
|
121
|
+
mf = to_mf(molecular_formula_like)
|
122
|
+
mf.isotope_distribution_spectrum(normalize, percent_cutoff, isotope_table)
|
123
|
+
end
|
117
124
|
end
|
118
125
|
end
|
119
126
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'mspire/isotope/nist'
|
2
|
+
|
3
|
+
module Mspire
|
4
|
+
class Isotope
|
5
|
+
module Neese
|
6
|
+
RATIOS = {
|
7
|
+
H: [0.999844, 0.000156],
|
8
|
+
C: [0.9891, 0.0109],
|
9
|
+
N: [0.99635, 0.00365],
|
10
|
+
O: [0.99759, 0.00037, 0.00204],
|
11
|
+
S: [0.9493, 0.0076, 0.0429, 0.0002]
|
12
|
+
}
|
13
|
+
|
14
|
+
BY_ELEMENT = Mspire::Isotope::NIST::BY_ELEMENT.dup # shallow copy on purpose
|
15
|
+
|
16
|
+
RATIOS.each do |el, abundances|
|
17
|
+
BY_ELEMENT[el] = Mspire::Isotope::NIST::BY_ELEMENT[el].
|
18
|
+
zip(abundances).map do |isotope, abundance|
|
19
|
+
if abundance
|
20
|
+
new_isotope = isotope.dup
|
21
|
+
new_isotope.relative_abundance = abundance
|
22
|
+
new_isotope
|
23
|
+
else
|
24
|
+
isotope
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
ISOTOPES = BY_ELEMENT.values.flatten(1).sort_by {|ist| [ist.atomic_number, ist.mass_number] }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'mspire/isotope'
|
2
|
+
|
3
|
+
class Mspire::Isotope::NIST::Updater
|
4
|
+
NIST_ISOTOPE_SITE = 'http://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl?ele=&all=all&ascii=ascii2&isotype=some'
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# Creates an isotope from a nist entry. Sets mono to false, which is not
|
9
|
+
# always correct (but needs to be corrected with additional info)
|
10
|
+
def isotope_from_nist_line(*args)
|
11
|
+
# atomic_number and mass_number are ints
|
12
|
+
[0,2].each {|i| args[i] = args[i].to_i }
|
13
|
+
# element is a downcase sym
|
14
|
+
args[1] = args[1].to_sym
|
15
|
+
# atomic_mass, relative_abundance, and average_mass as floats
|
16
|
+
[3, 4, 5].each {|i| args[i] = args[i][/([\w.]*)/].to_f }
|
17
|
+
# by default call every isotope the non-monoisotopic peak
|
18
|
+
# (will correct it as a group)
|
19
|
+
args << false
|
20
|
+
Mspire::Isotope.new(*args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_nist_info(filename)
|
24
|
+
isotopes = isotopes_from_nist_site
|
25
|
+
File.write(filename, isotopes.map {|isotope| Mspire::Isotope::MEMBERS.map {|key| isotope.send(key) }}.to_yaml)
|
26
|
+
end
|
27
|
+
|
28
|
+
def isotopes_from_nist_site(deuterium_is_kind_of_hydrogen=true)
|
29
|
+
require 'mechanize'
|
30
|
+
body = Mechanize.new.get(NIST_ISOTOPE_SITE).body.split("\n")
|
31
|
+
body.delete_if {|l| l[/^(<|\/)/]}
|
32
|
+
body.shift(22)
|
33
|
+
isotopes = body.each_slice(8).map do |lines|
|
34
|
+
arr = (1..4).to_a.map {|i| match lines[i] }
|
35
|
+
rel, avg = match(lines[5]), match(lines[6])
|
36
|
+
next if rel.nil?
|
37
|
+
rel.size > 0 ? isotope_from_nist_line(*arr, rel, avg) : nil
|
38
|
+
end.compact!
|
39
|
+
|
40
|
+
# deuterium should be grouped with hydrogen, not as its own element!
|
41
|
+
isotopes.find {|iso| iso.element == :D }.element = :H if deuterium_is_kind_of_hydrogen
|
42
|
+
|
43
|
+
# update the mono boolean if this is the highest abundance peak
|
44
|
+
isotopes.group_by(&:element).values.each do |set|
|
45
|
+
set.max_by(&:relative_abundance).mono = true
|
46
|
+
end
|
47
|
+
isotopes
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def match(string)
|
53
|
+
unless string.nil?
|
54
|
+
if string.empty?
|
55
|
+
nil
|
56
|
+
else
|
57
|
+
string[/= (.*)/,1]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if __FILE__ == $0
|
65
|
+
require 'mspire/isotope/nist'
|
66
|
+
Mspire::Isotope::NIST::Updater.write_nist_info(Mspire::Isotope::NIST::INFO_FILE_FULL_PATH)
|
67
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'mspire/isotope'
|
2
|
+
|
3
|
+
module Mspire::Isotope::NIST
|
4
|
+
INFO_FILE = 'isotope_info.yml'
|
5
|
+
INFO_FILE_FULL_PATH = File.expand_path(File.dirname(__FILE__) + "/nist/#{INFO_FILE}")
|
6
|
+
|
7
|
+
if File.exist?(INFO_FILE_FULL_PATH)
|
8
|
+
|
9
|
+
ISOTOPES = YAML.load_file(INFO_FILE_FULL_PATH).map {|ar| Mspire::Isotope.new *ar }
|
10
|
+
BY_ELEMENT = ISOTOPES.group_by(&:element)
|
11
|
+
|
12
|
+
else
|
13
|
+
unless __FILE__ == $0
|
14
|
+
warn "no file #{INFO_FILE_FULL_PATH} to read isotope information from!"
|
15
|
+
warn "Note that directly running the file: lib/mspire/isotope/nist/updater.rb"
|
16
|
+
warn "will autogenerate this file from NIST data"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/mspire/isotope.rb
CHANGED
@@ -2,92 +2,30 @@ require 'yaml'
|
|
2
2
|
|
3
3
|
module Mspire
|
4
4
|
class Isotope
|
5
|
-
MEMBERS = [
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
MEMBERS = [
|
6
|
+
:atomic_number,
|
7
|
+
:element,
|
8
|
+
:mass_number,
|
9
|
+
:atomic_mass,
|
10
|
+
:relative_abundance,
|
11
|
+
:average_mass,
|
12
|
+
:mono
|
13
|
+
].each {|key| attr_accessor key }
|
11
14
|
|
12
15
|
def initialize(*args)
|
13
16
|
MEMBERS.zip(args) {|k,val| self.send("#{k}=", val) }
|
14
17
|
end
|
18
|
+
end
|
19
|
+
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
def self.from_nist_line(*args)
|
19
|
-
# atomic_number and mass_number are ints
|
20
|
-
[0,2].each {|i| args[i] = args[i].to_i }
|
21
|
-
# element is a downcase sym
|
22
|
-
args[1] = args[1].to_sym
|
23
|
-
# atomic_mass, relative_abundance, and average_mass as floats
|
24
|
-
[3, 4, 5].each {|i| args[i] = args[i][/([\w.]*)/].to_f }
|
25
|
-
# by default call every isotope the non-monoisotopic peak
|
26
|
-
# (will correct it as a group)
|
27
|
-
args << false
|
28
|
-
self.new(*args)
|
29
|
-
end
|
30
|
-
|
31
|
-
if File.exist?(INFO_FILE_FULL_PATH)
|
32
|
-
|
33
|
-
ISOTOPES = YAML.load_file(INFO_FILE_FULL_PATH).map {|ar| Mspire::Isotope.new *ar }
|
34
|
-
BY_ELEMENT = ISOTOPES.group_by(&:element)
|
35
|
-
|
36
|
-
else
|
37
|
-
unless __FILE__ == $0
|
38
|
-
warn "no file #{INFO_FILE_FULL_PATH} to read isotope information from"
|
39
|
-
warn "directly running the file: #{__FILE__}"
|
40
|
-
warn "will generate the file from NIST data"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class Updater
|
45
|
-
NIST_ISOTOPE_SITE = 'http://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl?ele=&all=all&ascii=ascii2&isotype=some'
|
46
|
-
class << self
|
47
|
-
|
48
|
-
def write_nist_info(filename)
|
49
|
-
isotopes = isotopes_from_nist_site
|
50
|
-
File.write(filename, isotopes.map {|isotope| MEMBERS.map {|key| isotope.send(key) }}.to_yaml)
|
51
|
-
end
|
52
|
-
|
53
|
-
def isotopes_from_nist_site(deuterium_is_kind_of_hydrogen=true)
|
54
|
-
require 'mechanize'
|
55
|
-
body = Mechanize.new.get(NIST_ISOTOPE_SITE).body.split("\n")
|
56
|
-
body.delete_if {|l| l[/^(<|\/)/]}
|
57
|
-
body.shift(22)
|
58
|
-
isotopes = body.each_slice(8).map do |lines|
|
59
|
-
arr = (1..4).to_a.map {|i| match lines[i] }
|
60
|
-
rel, avg = match(lines[5]), match(lines[6])
|
61
|
-
next if rel.nil?
|
62
|
-
rel.size > 0 ? Isotope.from_nist_line(*arr, rel, avg) : nil
|
63
|
-
end.compact!
|
64
|
-
|
65
|
-
# deuterium should be grouped with hydrogen, not as its own element!
|
66
|
-
isotopes.find {|iso| iso.element == :D }.element = :H if deuterium_is_kind_of_hydrogen
|
67
|
-
|
68
|
-
# update the mono boolean if this is the highest abundance peak
|
69
|
-
isotopes.group_by(&:element).values.each do |set|
|
70
|
-
set.max_by(&:relative_abundance).mono = true
|
71
|
-
end
|
72
|
-
isotopes
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
21
|
+
require 'mspire/isotope/neese'
|
22
|
+
# sets Mspire::Isotope::BY_ELEMENTS and Mspire::Isotope::ISOTOPES
|
76
23
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
else
|
82
|
-
string[/= (.*)/,1]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
24
|
+
module Mspire
|
25
|
+
class Isotope
|
26
|
+
BY_ELEMENT = Mspire::Isotope::Neese::BY_ELEMENT
|
27
|
+
ISOTOPES = Mspire::Isotope::Neese::ISOTOPES
|
88
28
|
end
|
89
29
|
end
|
90
30
|
|
91
|
-
|
92
|
-
Mspire::Isotope::Updater.write_nist_info(Mspire::Isotope::INFO_FILE_FULL_PATH)
|
93
|
-
end
|
31
|
+
|
data/lib/mspire/version.rb
CHANGED
@@ -3,46 +3,54 @@ require 'spec_helper'
|
|
3
3
|
require 'mspire/isotope/distribution'
|
4
4
|
|
5
5
|
describe 'Mspire::Isotope::Distribution class methods' do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@nist = Mspire::Isotope::NIST::BY_ELEMENT
|
9
|
+
@norm = Mspire::Isotope::Distribution::NORMALIZE
|
10
|
+
@pcut = nil # percent cutoff
|
11
|
+
end
|
12
|
+
|
6
13
|
before do
|
7
14
|
@first = [1.0, 0.08919230588715311, 0.017894161377222138, 0.0013573997600723345, 0.0001398330738144181]
|
8
15
|
end
|
16
|
+
|
9
17
|
# can also be used on a real MolecularFormula object
|
10
18
|
subject { 'C102H120O15' }
|
11
19
|
|
12
20
|
describe 'normalizing isotope distributions' do
|
13
21
|
|
14
22
|
it 'defaults to normalizing by total signal with no cutoff' do
|
15
|
-
dist = Mspire::Isotope::Distribution.calculate( subject )
|
23
|
+
dist = Mspire::Isotope::Distribution.calculate( subject, @norm, @pcut, @nist )
|
16
24
|
dist.size.should == 253
|
17
25
|
dist[0,5].should == [0.31740518639058685, 0.35635707398291416, 0.20793431846543858, 0.08373257192958428, 0.026084566135229446]
|
18
26
|
end
|
19
27
|
|
20
28
|
it 'can normalize by first peak' do
|
21
|
-
dist = Mspire::Isotope::Distribution.calculate( subject, :first )
|
29
|
+
dist = Mspire::Isotope::Distribution.calculate( subject, :first, @pcut, @nist )
|
22
30
|
dist.size.should == 253
|
23
31
|
dist[0].should == 1.0
|
24
32
|
dist[1].should_not == 1.0
|
25
33
|
end
|
26
34
|
|
27
35
|
it 'can normalize by the max peak' do
|
28
|
-
dist = Mspire::Isotope::Distribution.calculate( subject, :max)
|
36
|
+
dist = Mspire::Isotope::Distribution.calculate( subject, :max, @pcut, @nist )
|
29
37
|
dist.size.should == 253
|
30
38
|
dist[0].should_not == 1.0
|
31
39
|
dist[1].should == 1.0
|
32
40
|
end
|
33
41
|
|
34
42
|
it 'can cutoff based on percent of total signal' do
|
35
|
-
Mspire::Isotope::Distribution.calculate(subject, :max, 100).should == []
|
36
|
-
Mspire::Isotope::Distribution.calculate(subject, :max, 20).should == [0.8906942209481861, 1.0, 0.5834999040187656]
|
37
|
-
Mspire::Isotope::Distribution.calculate(subject, :max, 5).should == [0.8906942209481861, 1.0, 0.5834999040187656, 0.23496817670469172]
|
38
|
-
Mspire::Isotope::Distribution.calculate(subject, :max, 0.0001).size.should == 11
|
43
|
+
Mspire::Isotope::Distribution.calculate(subject, :max, 100, @nist).should == []
|
44
|
+
Mspire::Isotope::Distribution.calculate(subject, :max, 20, @nist).should == [0.8906942209481861, 1.0, 0.5834999040187656]
|
45
|
+
Mspire::Isotope::Distribution.calculate(subject, :max, 5, @nist).should == [0.8906942209481861, 1.0, 0.5834999040187656, 0.23496817670469172]
|
46
|
+
Mspire::Isotope::Distribution.calculate(subject, :max, 0.0001, @nist).size.should == 11
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
42
50
|
describe 'calculating an isotope distribution spectrum' do
|
43
51
|
|
44
52
|
it 'gives neutral masses if no charge' do
|
45
|
-
spec = Mspire::Isotope::Distribution.spectrum( subject )
|
53
|
+
spec = Mspire::Isotope::Distribution.spectrum( subject, @norm, @pcut, @nist )
|
46
54
|
[:mzs, :intensities].each {|att| spec.send(att).size.should == 253 }
|
47
55
|
spec.mzs[0,5].should == [1584.8627231418, 1585.8713880574, 1586.8800529730001, 1587.8887178886002, 1588.8973828042003]
|
48
56
|
spec.intensities[0,5].should == [0.31740518639058685, 0.35635707398291416, 0.20793431846543858, 0.08373257192958428, 0.026084566135229446]
|
@@ -51,7 +59,7 @@ describe 'Mspire::Isotope::Distribution class methods' do
|
|
51
59
|
it 'gives proper m/z values if the molecule is charged' do
|
52
60
|
charged_molecule = Mspire::MolecularFormula.from_any( subject )
|
53
61
|
charged_molecule.charge = -3
|
54
|
-
spec = Mspire::Isotope::Distribution.spectrum( charged_molecule )
|
62
|
+
spec = Mspire::Isotope::Distribution.spectrum( charged_molecule, @norm, @pcut, @nist )
|
55
63
|
[:mzs, :intensities].each {|att| spec.send(att).size.should == 253 }
|
56
64
|
spec.mzs[0,5].should == [-528.2881229806, -528.6243446191334, -528.9605662576668, -529.2967878962, -529.6330095347334]
|
57
65
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'mspire/isotope/nist'
|
4
|
+
|
5
|
+
describe 'Mspire::Isotope::NIST' do
|
6
|
+
|
7
|
+
it 'has all the common isotopes: Mspire::Isotope::NIST::ISOTOPES' do
|
8
|
+
# frozen
|
9
|
+
Mspire::Isotope::NIST::ISOTOPES.size.should == 288
|
10
|
+
hydrogen_isotopes = Mspire::Isotope::NIST::ISOTOPES.select {|iso| iso.element == :H }
|
11
|
+
hydrogen_isotopes.size.should == 2
|
12
|
+
|
13
|
+
{ atomic_number: 1, element: :H, mass_number: 1, atomic_mass: 1.00782503207, relative_abundance: 0.999885, average_mass: 1.00794, mono: true }.each do |k,v|
|
14
|
+
hydrogen_isotopes.first.send(k).should == v
|
15
|
+
end
|
16
|
+
{atomic_number: 1, element: :H, mass_number: 2, atomic_mass: 2.0141017778, relative_abundance: 0.000115, average_mass: 1.00794, mono: false}.each do |k,v|
|
17
|
+
hydrogen_isotopes.last.send(k).should == v
|
18
|
+
end
|
19
|
+
u = Mspire::Isotope::NIST::ISOTOPES.last
|
20
|
+
{atomic_number: 92, element: :U, mass_number: 238, atomic_mass: 238.0507882, relative_abundance: 0.992742, average_mass: 238.02891, mono: true}.each do |k,v|
|
21
|
+
u.send(k).should == v
|
22
|
+
end
|
23
|
+
end
|
24
|
+
it 'has all common isotopes by element: Mspire::Isotope::BY_ELEMENT' do
|
25
|
+
[{atomic_number: 6, element: :C, mass_number: 12, atomic_mass: 12.0, relative_abundance: 0.9893, average_mass: 12.0107, mono: true}, {atomic_number: 6, element: :C, mass_number: 13, atomic_mass: 13.0033548378, relative_abundance: 0.0107, average_mass: 12.0107, mono: false}].zip(Mspire::Isotope::NIST::BY_ELEMENT[:C]) do |hash, iso|
|
26
|
+
hash.each do |k,v|
|
27
|
+
iso.send(k).should == v
|
28
|
+
end
|
29
|
+
end
|
30
|
+
Mspire::Isotope::NIST::BY_ELEMENT[:H].size.should == 2
|
31
|
+
end
|
32
|
+
end
|
data/spec/mspire/isotope_spec.rb
CHANGED
@@ -3,16 +3,16 @@ require 'spec_helper'
|
|
3
3
|
require 'mspire/isotope'
|
4
4
|
|
5
5
|
describe 'Mspire::Isotope constants' do
|
6
|
-
it 'has all the common isotopes
|
6
|
+
it 'Mspire::Isotope::ISOTOPES has all the common isotopes and uses Neese by default' do
|
7
7
|
# frozen
|
8
8
|
Mspire::Isotope::ISOTOPES.size.should == 288
|
9
9
|
hydrogen_isotopes = Mspire::Isotope::ISOTOPES.select {|iso| iso.element == :H }
|
10
10
|
hydrogen_isotopes.size.should == 2
|
11
11
|
|
12
|
-
{ atomic_number: 1, element: :H, mass_number: 1, atomic_mass: 1.00782503207, relative_abundance: 0.
|
12
|
+
{ atomic_number: 1, element: :H, mass_number: 1, atomic_mass: 1.00782503207, relative_abundance: 0.999844, average_mass: 1.00794, mono: true }.each do |k,v|
|
13
13
|
hydrogen_isotopes.first.send(k).should == v
|
14
14
|
end
|
15
|
-
{atomic_number: 1, element: :H, mass_number: 2, atomic_mass: 2.0141017778, relative_abundance: 0.
|
15
|
+
{atomic_number: 1, element: :H, mass_number: 2, atomic_mass: 2.0141017778, relative_abundance: 0.000156, average_mass: 1.00794, mono: false}.each do |k,v|
|
16
16
|
hydrogen_isotopes.last.send(k).should == v
|
17
17
|
end
|
18
18
|
u = Mspire::Isotope::ISOTOPES.last
|
@@ -21,7 +21,7 @@ describe 'Mspire::Isotope constants' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
it 'has all common isotopes by element: Mspire::Isotope::BY_ELEMENT' do
|
24
|
-
[{atomic_number: 6, element: :C, mass_number: 12, atomic_mass: 12.0, relative_abundance: 0.
|
24
|
+
[{atomic_number: 6, element: :C, mass_number: 12, atomic_mass: 12.0, relative_abundance: 0.9891, average_mass: 12.0107, mono: true}, {atomic_number: 6, element: :C, mass_number: 13, atomic_mass: 13.0033548378, relative_abundance: 0.0109, average_mass: 12.0107, mono: false}].zip(Mspire::Isotope::BY_ELEMENT[:C]) do |hash, iso|
|
25
25
|
hash.each do |k,v|
|
26
26
|
iso.send(k).should == v
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John T. Prince
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -268,7 +268,10 @@ files:
|
|
268
268
|
- lib/mspire/isotope.rb
|
269
269
|
- lib/mspire/isotope/aa.rb
|
270
270
|
- lib/mspire/isotope/distribution.rb
|
271
|
-
- lib/mspire/isotope/
|
271
|
+
- lib/mspire/isotope/neese.rb
|
272
|
+
- lib/mspire/isotope/nist.rb
|
273
|
+
- lib/mspire/isotope/nist/isotope_info.yml
|
274
|
+
- lib/mspire/isotope/nist/updater.rb
|
272
275
|
- lib/mspire/mascot.rb
|
273
276
|
- lib/mspire/mass.rb
|
274
277
|
- lib/mspire/mass/aa.rb
|
@@ -370,6 +373,7 @@ files:
|
|
370
373
|
- spec/mspire/imzml/writer_spec.rb
|
371
374
|
- spec/mspire/isotope/aa_spec.rb
|
372
375
|
- spec/mspire/isotope/distribution_spec.rb
|
376
|
+
- spec/mspire/isotope/nist_spec.rb
|
373
377
|
- spec/mspire/isotope_spec.rb
|
374
378
|
- spec/mspire/mass/aa_spec.rb
|
375
379
|
- spec/mspire/mass/all_spec.rb
|
@@ -476,6 +480,7 @@ test_files:
|
|
476
480
|
- spec/mspire/imzml/writer_spec.rb
|
477
481
|
- spec/mspire/isotope/aa_spec.rb
|
478
482
|
- spec/mspire/isotope/distribution_spec.rb
|
483
|
+
- spec/mspire/isotope/nist_spec.rb
|
479
484
|
- spec/mspire/isotope_spec.rb
|
480
485
|
- spec/mspire/mass/aa_spec.rb
|
481
486
|
- spec/mspire/mass/all_spec.rb
|
@@ -539,3 +544,4 @@ test_files:
|
|
539
544
|
- spec/testfiles/mspire/quant/unlog_transform.rb
|
540
545
|
- spec/testfiles/plms1/output.key
|
541
546
|
- spec/testfiles/processed_binary.tmp.ibd
|
547
|
+
has_rdoc:
|