mspire 0.6.26 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mspire.rb +1 -1
- data/lib/{ms → mspire}/cv.rb +1 -1
- data/lib/{ms → mspire}/cv/param.rb +5 -5
- data/lib/{ms → mspire}/cv/paramable.rb +5 -5
- data/lib/{ms → mspire}/digester.rb +2 -2
- data/lib/{ms → mspire}/error_rate/decoy.rb +1 -1
- data/lib/{ms → mspire}/error_rate/qvalue.rb +4 -4
- data/lib/{ms → mspire}/fasta.rb +5 -5
- data/lib/{ms → mspire}/ident.rb +10 -10
- data/lib/{ms → mspire}/ident/peptide.rb +3 -3
- data/lib/{ms → mspire}/ident/peptide/db.rb +12 -12
- data/lib/{ms → mspire}/ident/peptide_hit.rb +6 -6
- data/lib/{ms → mspire}/ident/peptide_hit/qvalue.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/modifications.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/msms_pipeline_analysis.rb +6 -6
- data/lib/{ms → mspire}/ident/pepxml/msms_run_summary.rb +9 -9
- data/lib/{ms → mspire}/ident/pepxml/parameters.rb +1 -1
- data/lib/{ms → mspire}/ident/pepxml/sample_enzyme.rb +4 -4
- data/lib/{ms → mspire}/ident/pepxml/search_database.rb +5 -5
- data/lib/{ms → mspire}/ident/pepxml/search_hit.rb +4 -4
- data/lib/{ms → mspire}/ident/pepxml/search_hit/modification_info.rb +7 -7
- data/lib/{ms → mspire}/ident/pepxml/search_result.rb +5 -5
- data/lib/{ms → mspire}/ident/pepxml/search_summary.rb +12 -12
- data/lib/{ms → mspire}/ident/pepxml/spectrum_query.rb +7 -7
- data/lib/{ms → mspire}/ident/protein.rb +2 -2
- data/lib/{ms → mspire}/ident/protein_group.rb +2 -2
- data/lib/{ms → mspire}/ident/search.rb +1 -1
- data/lib/{ms → mspire}/isotope.rb +3 -3
- data/lib/{ms → mspire}/isotope/aa.rb +1 -1
- data/lib/{ms → mspire}/isotope/distribution.rb +17 -17
- data/lib/{ms → mspire}/isotope/nist_isotope_info.yml +0 -0
- data/lib/{ms → mspire}/mascot.rb +1 -1
- data/lib/{ms → mspire}/mass.rb +7 -7
- data/lib/{ms → mspire}/mass/aa.rb +6 -6
- data/lib/{ms → mspire}/molecular_formula.rb +7 -7
- data/lib/{ms → mspire}/mzml.rb +55 -55
- data/lib/{ms → mspire}/mzml/activation.rb +3 -3
- data/lib/{ms → mspire}/mzml/chromatogram.rb +3 -3
- data/lib/{ms → mspire}/mzml/chromatogram_list.rb +1 -1
- data/lib/{ms → mspire}/mzml/component.rb +5 -5
- data/lib/{ms → mspire}/mzml/contact.rb +3 -3
- data/lib/{ms → mspire}/mzml/cv.rb +1 -1
- data/lib/{ms → mspire}/mzml/data_array.rb +12 -12
- data/lib/{ms → mspire}/mzml/data_array_container_like.rb +7 -7
- data/lib/{ms → mspire}/mzml/data_processing.rb +3 -3
- data/lib/{ms → mspire}/mzml/file_content.rb +3 -3
- data/lib/{ms → mspire}/mzml/file_description.rb +4 -4
- data/lib/{ms → mspire}/mzml/index_list.rb +2 -2
- data/lib/{ms → mspire}/mzml/instrument_configuration.rb +7 -7
- data/lib/{ms → mspire}/mzml/isolation_window.rb +3 -3
- data/lib/{ms → mspire}/mzml/list.rb +1 -1
- data/lib/{ms → mspire}/mzml/plms1.rb +3 -3
- data/lib/{ms → mspire}/mzml/precursor.rb +6 -6
- data/lib/{ms → mspire}/mzml/processing_method.rb +3 -3
- data/lib/{ms → mspire}/mzml/product.rb +3 -3
- data/lib/{ms → mspire}/mzml/referenceable_param_group.rb +4 -4
- data/lib/{ms → mspire}/mzml/run.rb +3 -3
- data/lib/{ms → mspire}/mzml/sample.rb +5 -5
- data/lib/{ms → mspire}/mzml/scan.rb +4 -4
- data/lib/{ms → mspire}/mzml/scan_list.rb +3 -3
- data/lib/{ms → mspire}/mzml/scan_settings.rb +5 -5
- data/lib/{ms → mspire}/mzml/selected_ion.rb +5 -5
- data/lib/{ms → mspire}/mzml/software.rb +5 -5
- data/lib/{ms → mspire}/mzml/source_file.rb +5 -5
- data/lib/{ms → mspire}/mzml/spectrum.rb +33 -20
- data/lib/{ms → mspire}/mzml/spectrum_list.rb +4 -4
- data/lib/{ms → mspire}/obo.rb +1 -1
- data/lib/{ms → mspire}/peak.rb +3 -3
- data/lib/{ms → mspire}/peak/point.rb +1 -1
- data/lib/{ms → mspire}/plms1.rb +4 -4
- data/lib/{ms → mspire}/quant/qspec.rb +4 -4
- data/lib/{ms → mspire}/quant/qspec/protein_group_comparison.rb +4 -4
- data/lib/{ms → mspire}/spectrum.rb +6 -6
- data/lib/{ms → mspire}/spectrum/centroid.rb +1 -1
- data/lib/{ms → mspire}/spectrum_like.rb +5 -5
- data/lib/{ms → mspire}/user_param.rb +2 -2
- data/script/mzml_read_binary.rb +1 -1
- data/spec/{ms → mspire}/cv/param_spec.rb +6 -6
- data/spec/{ms → mspire}/digester_spec.rb +10 -10
- data/spec/{ms → mspire}/error_rate/qvalue_spec.rb +3 -3
- data/spec/{ms → mspire}/fasta_spec.rb +10 -10
- data/spec/{ms → mspire}/ident/peptide/db_spec.rb +9 -9
- data/spec/{ms → mspire}/ident/pepxml/sample_enzyme_spec.rb +10 -10
- data/spec/{ms → mspire}/ident/pepxml/search_hit/modification_info_spec.rb +4 -4
- data/spec/{ms → mspire}/ident/pepxml_spec.rb +22 -22
- data/spec/{ms → mspire}/ident/protein_group_spec.rb +4 -4
- data/spec/{ms → mspire}/isotope/aa_spec.rb +3 -3
- data/spec/{ms → mspire}/isotope/distribution_spec.rb +4 -4
- data/spec/{ms → mspire}/isotope_spec.rb +9 -9
- data/spec/{ms → mspire}/mass_spec.rb +8 -8
- data/spec/{ms → mspire}/molecular_formula_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/cv_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/data_array_spec.rb +7 -7
- data/spec/{ms → mspire}/mzml/file_content_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/file_description_spec.rb +4 -4
- data/spec/{ms → mspire}/mzml/index_list_spec.rb +13 -13
- data/spec/{ms → mspire}/mzml/plms1_spec.rb +8 -8
- data/spec/{ms → mspire}/mzml/referenceable_param_group_spec.rb +6 -6
- data/spec/{ms → mspire}/mzml_spec.rb +30 -30
- data/spec/{ms → mspire}/peak_spec.rb +10 -10
- data/spec/{ms → mspire}/plms1_spec.rb +7 -7
- data/spec/{ms → mspire}/quant/qspec_spec.rb +2 -2
- data/spec/{ms → mspire}/spectrum_spec.rb +8 -8
- data/spec/{ms → mspire}/user_param_spec.rb +8 -8
- data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.fasta +0 -0
- data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/j24z.idx_comp.3.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/mspire_simulated.MSn.check.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/mzml/openms.noidx_nocomp.12.mzML +0 -0
- data/spec/testfiles/{ms → mspire}/quant/kill_extra_tabs.rb +0 -0
- data/spec/testfiles/{ms → mspire}/quant/max_quant_output.provenance.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/max_quant_output.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.CSV.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp.csv +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt +0 -0
- data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt_qspecgp +0 -0
- data/spec/testfiles/{ms → mspire}/quant/remove_rest_of_proteins.rb +0 -0
- data/spec/testfiles/{ms → mspire}/quant/unlog_transform.rb +0 -0
- metadata +148 -194
- data/lib/ms.rb +0 -3
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
2
|
require 'spec_helper'
|
3
|
-
require '
|
3
|
+
require 'mspire/ident/pepxml/sample_enzyme'
|
4
4
|
require 'nokogiri'
|
5
5
|
|
6
|
-
describe 'creating an
|
6
|
+
describe 'creating an Mspire::Ident::Pepxml::SampleEnzyme' do
|
7
7
|
before do
|
8
8
|
@hash = {
|
9
9
|
:name => 'trypsin',
|
@@ -13,23 +13,23 @@ describe 'creating an MS::Ident::Pepxml::SampleEnzyme' do
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
it 'can be set by a known enzyme name' do
|
16
|
-
se =
|
16
|
+
se = Mspire::Ident::Pepxml::SampleEnzyme.new('trypsin')
|
17
17
|
@hash.each do |k,v|
|
18
18
|
se.send(k).should == v
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'can be set manually with a hash' do
|
23
|
-
se =
|
23
|
+
se = Mspire::Ident::Pepxml::SampleEnzyme.new(@hash)
|
24
24
|
@hash.each do |k,v|
|
25
25
|
se.send(k).should == v
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe 'an
|
30
|
+
describe 'an Mspire::Ident::Pepxml::SampleEnzyme' do
|
31
31
|
before do
|
32
|
-
@sample_enzyme =
|
32
|
+
@sample_enzyme = Mspire::Ident::Pepxml::SampleEnzyme.new(:name=>'trypsin',:cut=>'KR',:no_cut=>'P',:sense=>'C')
|
33
33
|
end
|
34
34
|
it 'generates a valid xml fragment' do
|
35
35
|
string = @sample_enzyme.to_xml
|
@@ -48,15 +48,15 @@ describe 'an MS::Ident::Pepxml::SampleEnzyme' do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
describe 'an
|
51
|
+
describe 'an Mspire::Ident::Pepxml::SampleEnzyme making enzyme digestion calculations' do
|
52
52
|
before do
|
53
|
-
@full_KRP =
|
53
|
+
@full_KRP = Mspire::Ident::Pepxml::SampleEnzyme.new(
|
54
54
|
:name => 'trypsin',
|
55
55
|
:cut => 'KR',
|
56
56
|
:no_cut => 'P',
|
57
57
|
:sense => 'C',
|
58
58
|
)
|
59
|
-
@just_KR =
|
59
|
+
@just_KR = Mspire::Ident::Pepxml::SampleEnzyme.new(
|
60
60
|
:name => 'trypsin',
|
61
61
|
:cut => 'KR',
|
62
62
|
:no_cut => '',
|
@@ -138,7 +138,7 @@ end
|
|
138
138
|
=begin
|
139
139
|
require 'set'
|
140
140
|
|
141
|
-
describe '
|
141
|
+
describe 'Mspire::Ident::Pepxml::SampleEnzyme digesting sequences' do
|
142
142
|
it 'can digest with no missed cleavages' do
|
143
143
|
st = "CRGATKKTAGRPMEK"
|
144
144
|
SampleEnzyme.tryptic(st).should == %w(CR GATK K TAGRPMEK)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/ident/pepxml/search_hit/modification_info'
|
4
4
|
|
5
|
-
describe '
|
5
|
+
describe 'Mspire::Ident::Pepxml::SearchHit::ModificationInfo' do
|
6
6
|
|
7
7
|
before do
|
8
8
|
modaaobjs = [[3, 150.3], [6, 345.2]].map do |ar|
|
9
|
-
|
9
|
+
Mspire::Ident::Pepxml::SearchHit::ModificationInfo::ModAminoacidMass.new(*ar)
|
10
10
|
end
|
11
11
|
hash = {
|
12
12
|
:mod_nterm_mass => 520.2,
|
@@ -14,7 +14,7 @@ describe 'MS::Ident::Pepxml::SearchHit::ModificationInfo' do
|
|
14
14
|
:mod_aminoacid_masses => modaaobjs,
|
15
15
|
}
|
16
16
|
#answ = "<modification_info mod_nterm_mass=\"520.2\" modified_peptide=\"MOD*IFI^E&D\">\n\t<mod_aminoacid_mass position=\"3\" mass=\"150.3\"/>\n\t<mod_aminoacid_mass position=\"6\" mass=\"345.2\"/>\n</modification_info>\n"
|
17
|
-
@obj =
|
17
|
+
@obj = Mspire::Ident::Pepxml::SearchHit::ModificationInfo.new(hash)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'can produce valid pepxml xml' do
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
3
|
+
require 'mspire/mass'
|
4
|
+
require 'mspire/mass/aa'
|
5
|
+
require 'mspire/ident/pepxml'
|
6
|
+
require 'mspire/ident/pepxml/modifications'
|
7
|
+
require 'mspire/ident/pepxml/spectrum_query'
|
8
|
+
require 'mspire/ident/pepxml/search_result'
|
9
|
+
require 'mspire/ident/pepxml/search_hit'
|
10
|
+
require 'mspire/ident/pepxml/search_hit/modification_info'
|
11
11
|
|
12
|
-
describe "creating an
|
12
|
+
describe "creating an Mspire::Ident::Pepxml" do
|
13
13
|
|
14
14
|
it "can be creating in a nested fashion reflecting internal structure" do
|
15
15
|
tags_that_should_be_present = %w(msms_pipeline_analysis msms_run_summary sample_enzyme search_summary spectrum_query search_result search_hit modification_info mod_aminoacid_mass search_score)
|
16
16
|
|
17
|
-
pepxml =
|
17
|
+
pepxml = Mspire::Ident::Pepxml.new do |msms_pipeline_analysis|
|
18
18
|
msms_pipeline_analysis.merge!(:summary_xml => "020.xml") do |msms_run_summary|
|
19
19
|
# prep the sample enzyme and search_summary
|
20
20
|
msms_run_summary.merge!(
|
@@ -38,17 +38,17 @@ describe "creating an MS::Ident::Pepxml" do
|
|
38
38
|
:max_num_internal_cleavages => 2,
|
39
39
|
:min_number_termini => 2
|
40
40
|
)
|
41
|
-
modifications <<
|
42
|
-
:aminoacid => 'M', :massdiff => 15.9994, :mass =>
|
41
|
+
modifications << Mspire::Ident::Pepxml::AminoacidModification.new(
|
42
|
+
:aminoacid => 'M', :massdiff => 15.9994, :mass => Mspire::Mass::AA::MONO['M']+15.9994,
|
43
43
|
:variable => 'Y', :symbol => '*')
|
44
44
|
# invented, for example, a protein terminating mod
|
45
|
-
modifications <<
|
46
|
-
:terminus => 'c', :massdiff => 23.3333, :mass =>
|
45
|
+
modifications << Mspire::Ident::Pepxml::TerminalModification.new(
|
46
|
+
:terminus => 'c', :massdiff => 23.3333, :mass => Mspire::Mass::MONO['oh'] + 23.3333,
|
47
47
|
:variable => 'Y', :symbol => '[', :protein_terminus => 'c',
|
48
48
|
:description => 'leave protein_terminus off if not protein mod'
|
49
49
|
)
|
50
|
-
modifications <<
|
51
|
-
:terminus => 'c', :massdiff => 25.42322, :mass =>
|
50
|
+
modifications << Mspire::Ident::Pepxml::TerminalModification.new(
|
51
|
+
:terminus => 'c', :massdiff => 25.42322, :mass => Mspire::Mass::MONO['h+'] + 25.42322,
|
52
52
|
:variable => 'N', :symbol => ']', :description => 'example: c term mod'
|
53
53
|
)
|
54
54
|
parameters.merge!(
|
@@ -57,18 +57,18 @@ describe "creating an MS::Ident::Pepxml" do
|
|
57
57
|
:enzyme_info => 'Trypsin(KR/P) 1 1 KR P', # etc....
|
58
58
|
)
|
59
59
|
end
|
60
|
-
spectrum_query1 =
|
60
|
+
spectrum_query1 = Mspire::Ident::Pepxml::SpectrumQuery.new(
|
61
61
|
:spectrum => '020.3.3.1', :start_scan => 3, :end_scan => 3,
|
62
62
|
:precursor_neutral_mass => 1120.93743421875, :assumed_charge => 1
|
63
63
|
) do |search_results|
|
64
|
-
search_result1 =
|
64
|
+
search_result1 = Mspire::Ident::Pepxml::SearchResult.new do |search_hits|
|
65
65
|
modpositions = [[1, 243.1559], [6, 167.0581], [7,181.085]].map do |pair|
|
66
|
-
|
66
|
+
Mspire::Ident::Pepxml::SearchHit::ModificationInfo::ModAminoacidMass.new(*pair)
|
67
67
|
end
|
68
68
|
# order(modified_peptide, mod_aminoacid_masses, :mod_nterm_mass, :mod_cterm_mass)
|
69
69
|
# or can be set by hash
|
70
|
-
mod_info =
|
71
|
-
search_hit1 =
|
70
|
+
mod_info = Mspire::Ident::Pepxml::SearchHit::ModificationInfo.new('Y#RLGGS#T#K', modpositions)
|
71
|
+
search_hit1 = Mspire::Ident::Pepxml::SearchHit.new(
|
72
72
|
:hit_rank=>1, :peptide=>'YRLGGSTK', :peptide_prev_aa => "R", :peptide_next_aa => "K",
|
73
73
|
:protein => "gi|16130113|ref|NP_416680.1|", :num_tot_proteins => 1, :num_matched_ions => 5,
|
74
74
|
:tot_num_ions => 35, :calc_neutral_pep_mass => 1120.93163442, :massdiff => 0.00579979875010395,
|
@@ -141,7 +141,7 @@ end
|
|
141
141
|
|
142
142
|
|
143
143
|
=begin
|
144
|
-
describe "
|
144
|
+
describe "Mspire::Ident::Pepxml created from small bioworks.xml" do
|
145
145
|
|
146
146
|
spec_large do
|
147
147
|
before(:all) do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/ident/protein_group'
|
4
4
|
|
5
5
|
PeptideHit = Struct.new(:aaseq, :charge, :proteins) do
|
6
6
|
def inspect # easier to read output
|
@@ -36,21 +36,21 @@ describe 'creating minimal protein groups from peptide hits' do
|
|
36
36
|
it 'is a greedy algorithm' do
|
37
37
|
@prot_hits.each {|prthit| @prot_hits_hash[prthit.id].each {|pep| pep.proteins << prthit } }
|
38
38
|
# big_guy has all the peptides, so it takes them all
|
39
|
-
protein_groups =
|
39
|
+
protein_groups = Mspire::Ident::ProteinGroup.peptide_hits_to_protein_groups(@pep_hits)
|
40
40
|
protein_groups.first.size.should == 1# the group
|
41
41
|
protein_groups.first.first.id.should == 'big_guy'
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'removes proteins accounted for only as little pieces of larger proteins' do
|
45
45
|
@prot_hits[1..-1].each {|prthit| @prot_hits_hash[prthit.id].each {|pep| pep.proteins << prthit } }
|
46
|
-
protein_groups =
|
46
|
+
protein_groups = Mspire::Ident::ProteinGroup.peptide_hits_to_protein_groups(@pep_hits)
|
47
47
|
# no subsumed_by_medium
|
48
48
|
protein_groups.any? {|prot_group| prot_group.any? {|v| v.id == 'subsumed_by_medium' }}.should == false
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'allows alternate sorting algorithms for greediness' do
|
52
52
|
@prot_hits.each {|prthit| @prot_hits_hash[prthit.id].each {|pep| pep.proteins << prthit } }
|
53
|
-
prot_groups =
|
53
|
+
prot_groups = Mspire::Ident::ProteinGroup.peptide_hits_to_protein_groups(@pep_hits) do |prot_and_peptide_hits|
|
54
54
|
# deliberate using a counterintuitive sorting method to give little guys
|
55
55
|
# a chance
|
56
56
|
-prot_and_peptide_hits.last.size
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/isotope/aa'
|
4
4
|
|
5
5
|
describe 'accessing an amino acid atom count' do
|
6
6
|
before do
|
@@ -8,12 +8,12 @@ describe 'accessing an amino acid atom count' do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'residue can be accessed with a symbol' do
|
11
|
-
hash =
|
11
|
+
hash = Mspire::Isotope::AA::ATOM_COUNTS[:A]
|
12
12
|
[:c, :h, :o, :n, :s].each {|key| hash[key].should == @alanine[key] }
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'residue can be accessed with a string' do
|
16
|
-
hash =
|
16
|
+
hash = Mspire::Isotope::AA::ATOM_COUNTS['A']
|
17
17
|
[:c, :h, :o, :n, :s].each {|key| hash[key].should == @alanine[key] }
|
18
18
|
end
|
19
19
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/isotope/distribution'
|
4
4
|
|
5
|
-
describe '
|
5
|
+
describe 'Mspire::Isotope::Distribution class methods' do
|
6
6
|
before do
|
7
7
|
@data = [1.0, 0.08919230588715289, 0.017894161377222082, 0.0013573997600723623, 0.0001398330738144092]
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'can calculate isotope distributions' do
|
11
|
-
|
11
|
+
Mspire::Isotope::Distribution.calculate('C8O7', :max).should == @data
|
12
12
|
end
|
13
13
|
|
14
14
|
# no m/z values, just mass values
|
15
15
|
it 'can calculate isotope distribution spectrum' do
|
16
|
-
spec =
|
16
|
+
spec = Mspire::Isotope::Distribution.spectrum('C8O7', :max)
|
17
17
|
spec.mzs.should == [207.96440233692, 208.97306725252, 209.98173216812, 210.99039708372, 211.99906199932002]
|
18
18
|
spec.intensities.should == [1.0, 0.08919230588715289, 0.017894161377222082, 0.0013573997600723623, 0.0001398330738144092]
|
19
19
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/isotope'
|
4
4
|
|
5
|
-
describe '
|
6
|
-
it 'has all the common isotopes:
|
5
|
+
describe 'Mspire::Isotope constants' do
|
6
|
+
it 'has all the common isotopes: Mspire::Isotope::ISOTOPES' do
|
7
7
|
# frozen
|
8
|
-
|
9
|
-
hydrogen_isotopes =
|
8
|
+
Mspire::Isotope::ISOTOPES.size.should == 288
|
9
|
+
hydrogen_isotopes = Mspire::Isotope::ISOTOPES.select {|iso| iso.element == :h }
|
10
10
|
hydrogen_isotopes.size.should == 2
|
11
11
|
|
12
12
|
{ 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|
|
@@ -15,17 +15,17 @@ describe 'MS::Isotope constants' do
|
|
15
15
|
{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|
|
16
16
|
hydrogen_isotopes.last.send(k).should == v
|
17
17
|
end
|
18
|
-
u =
|
18
|
+
u = Mspire::Isotope::ISOTOPES.last
|
19
19
|
{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|
|
20
20
|
u.send(k).should == v
|
21
21
|
end
|
22
22
|
end
|
23
|
-
it 'has all common isotopes by element:
|
24
|
-
[{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(
|
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.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::BY_ELEMENT[:c]) do |hash, iso|
|
25
25
|
hash.each do |k,v|
|
26
26
|
iso.send(k).should == v
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
Mspire::Isotope::BY_ELEMENT[:h].size.should == 2
|
30
30
|
end
|
31
31
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/mass'
|
4
4
|
|
5
|
-
describe '
|
5
|
+
describe 'Mspire::Mass' do
|
6
6
|
it 'can access elemental masses by string or symbol' do
|
7
7
|
{
|
8
8
|
'c' => 12.0, # +
|
@@ -26,16 +26,16 @@ describe 'MS::Mass' do
|
|
26
26
|
'e' => 0.0005486,
|
27
27
|
'se' => 79.9165196
|
28
28
|
}.each do |el, mass|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
Mspire::Mass::MONO[el].should_not be_nil
|
30
|
+
Mspire::Mass::MONO[el].should == Mspire::Mass::MONO[el.to_sym]
|
31
|
+
Mspire::Mass::MONO[el].should be_within(0.00001).of(mass)
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
{ h: 1.00794, he: 4.002602, ni: 58.6934 }.each do |el, mass|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
Mspire::Mass::AVG[el].should_not be_nil
|
37
|
+
Mspire::Mass::AVG[el].should == Mspire::Mass::AVG[el.to_sym]
|
38
|
+
Mspire::Mass::AVG[el].should be_within(0.00001).of(mass)
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/molecular_formula'
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Mspire::MolecularFormula do
|
6
6
|
|
7
7
|
it 'can be initialized with a String or Hash' do
|
8
8
|
data = {h: 22, c: 12, n: 1, o: 3, s: 2}
|
9
|
-
mf =
|
9
|
+
mf = Mspire::MolecularFormula.new "H22BeC12N1O3S2Li2"
|
10
10
|
mf.should == {:h=>22, :be=>1, :c=>12, :n=>1, :o=>3, :s=>2, :li=>2}
|
11
|
-
mf =
|
11
|
+
mf = Mspire::MolecularFormula.new(data)
|
12
12
|
mf.should == data
|
13
13
|
end
|
14
14
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'builder'
|
3
|
-
require '
|
3
|
+
require 'mspire/mzml/cv'
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Mspire::Mzml::CV do
|
6
6
|
|
7
7
|
it 'can make CVList xml' do
|
8
|
-
cvs = [
|
8
|
+
cvs = [Mspire::Mzml::CV::MS, Mspire::Mzml::CV::UO, Mspire::Mzml::CV::IMS]
|
9
9
|
b = Builder::XmlMarkup.new(:indent => 2)
|
10
|
-
|
10
|
+
Mspire::Mzml::CV.list_xml(cvs, b)
|
11
11
|
xml = b.to_xml
|
12
12
|
[/cvList\s+count=/, /id="MS"/, /id="UO"/, /id="IMS"/, /URI="/].each do |regexp|
|
13
13
|
xml.should match(regexp)
|
@@ -1,26 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'mspire/mzml/data_array'
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Mspire::Mzml::DataArray do
|
6
6
|
|
7
7
|
it 'can be created from base64 binary data' do
|
8
|
-
d_ar =
|
8
|
+
d_ar = Mspire::Mzml::DataArray.from_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', :float64, zlib=true)
|
9
9
|
d_ar.is_a?(Array)
|
10
10
|
d_ar.should == [1.0, 2.0, 3.0]
|
11
|
-
d_ar =
|
11
|
+
d_ar = Mspire::Mzml::DataArray.from_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', ['MS:1000523', 'MS:1000574'])
|
12
12
|
d_ar.is_a?(Array)
|
13
13
|
d_ar.should == [1.0, 2.0, 3.0]
|
14
14
|
end
|
15
15
|
|
16
16
|
it "can be initialized like any ol' array" do
|
17
17
|
data = [1,2,3]
|
18
|
-
d_ar =
|
18
|
+
d_ar = Mspire::Mzml::DataArray.new( data )
|
19
19
|
d_ar.should == data
|
20
20
|
end
|
21
21
|
|
22
|
-
describe 'an instantiated
|
23
|
-
subject {
|
22
|
+
describe 'an instantiated Mspire::Mzml::DataArray' do
|
23
|
+
subject { Mspire::Mzml::DataArray.new [1,2,3] }
|
24
24
|
|
25
25
|
it "can have a 'type'" do
|
26
26
|
subject.type = :mz
|
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'builder'
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'mspire/mzml/file_content'
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe Mspire::Mzml::FileContent do
|
7
7
|
|
8
8
|
it 'can be initialized with params' do
|
9
|
-
filecontent =
|
9
|
+
filecontent = Mspire::Mzml::FileContent.new(:params => ['MS:1000579', ['IMS:1000080', "{9D501BDC-5344-4916-B7E9-7E795B02C856}"]])
|
10
10
|
|
11
11
|
desc = filecontent.params
|
12
12
|
desc.size.should == 2
|
13
|
-
desc.all? {|par| par.class ==
|
13
|
+
desc.all? {|par| par.class == Mspire::CV::Param }.should be_true
|
14
14
|
b = Builder::XmlMarkup.new
|
15
15
|
filecontent.to_xml(b)
|
16
16
|
xml = b.to_xml
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require '
|
2
|
+
require 'mspire/mzml/file_description'
|
3
3
|
require 'builder'
|
4
4
|
|
5
5
|
describe 'creating mzml xml' do
|
@@ -9,11 +9,11 @@ describe 'creating mzml xml' do
|
|
9
9
|
|
10
10
|
describe 'making a SourceFile' do
|
11
11
|
it 'can be generated with params and a block' do
|
12
|
-
source_file =
|
12
|
+
source_file = Mspire::Mzml::SourceFile.new("someFileID", "filename.mzML", "/home/jtprince/tmp", params: ['MS:1000584'])
|
13
13
|
|
14
14
|
params = source_file.params
|
15
15
|
params.size.should == 1
|
16
|
-
params.all? {|par| par.class ==
|
16
|
+
params.all? {|par| par.class == Mspire::CV::Param }.should be_true
|
17
17
|
b = Builder::XmlMarkup.new(:indent => 2)
|
18
18
|
source_file.to_xml(b)
|
19
19
|
xml = b.to_xml
|
@@ -24,7 +24,7 @@ describe 'creating mzml xml' do
|
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
27
|
+
describe Mspire::Mzml::FileDescription do
|
28
28
|
|
29
29
|
it 'creates valid xml' do
|
30
30
|
#MS::Mzml::FileDescription
|