mspire 0.6.20 → 0.6.21

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.20
1
+ 0.6.21
@@ -1,4 +1,5 @@
1
1
  require 'ms/mzml/list'
2
+ require 'ms/mzml/selected_ion'
2
3
 
3
4
  module MS
4
5
  class Mzml
@@ -20,6 +21,10 @@ module MS
20
21
  # a boolean indicating the spectrum is from an external source file
21
22
  attr_accessor :from_external_source_file
22
23
 
24
+ def initialize(spectrum_derived_from=nil)
25
+ @spectrum=spectrum_derived_from
26
+ end
27
+
23
28
  def to_xml(builder)
24
29
  atts = {}
25
30
  if @from_external_source_file
@@ -30,8 +35,8 @@ module MS
30
35
  end
31
36
  builder.precursor(atts) do |prec_n|
32
37
  @isolation_window.to_xml(prec_n) if @isolation_window
33
- MS::Mzml::SelectedIonList.list_xml(@selected_ions, prec_n) if @selected_ions
34
- @activation.to_xml(prec_n)
38
+ MS::Mzml::SelectedIon.list_xml(@selected_ions, prec_n) if @selected_ions
39
+ @activation.to_xml(prec_n) if @activation
35
40
  end
36
41
  end
37
42
 
data/lib/ms/mzml.rb CHANGED
@@ -8,6 +8,7 @@ require 'ms/mzml/spectrum'
8
8
  require 'ms/mzml/file_description'
9
9
  require 'ms/mzml/software'
10
10
  require 'ms/mzml/scan_list'
11
+ require 'ms/mzml/selected_ion'
11
12
  require 'ms/mzml/scan'
12
13
  require 'ms/mzml/scan_settings'
13
14
  require 'ms/mzml/processing_method'
data/mspire.gemspec ADDED
@@ -0,0 +1,200 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "mspire"
8
+ s.version = "0.6.20"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["John T. Prince", "Simon Chiang"]
12
+ s.date = "2012-02-24"
13
+ s.description = "mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire, merging of ms-* gems"
14
+ s.email = "jtprince@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "lib/bin.rb",
25
+ "lib/core_ext/array/in_groups.rb",
26
+ "lib/cv.rb",
27
+ "lib/cv/param.rb",
28
+ "lib/cv/referenceable_param_group_ref.rb",
29
+ "lib/io/bookmark.rb",
30
+ "lib/merge.rb",
31
+ "lib/ms.rb",
32
+ "lib/ms/cv.rb",
33
+ "lib/ms/cv/param.rb",
34
+ "lib/ms/cv/paramable.rb",
35
+ "lib/ms/digester.rb",
36
+ "lib/ms/fasta.rb",
37
+ "lib/ms/ident.rb",
38
+ "lib/ms/ident/peptide.rb",
39
+ "lib/ms/ident/peptide/db.rb",
40
+ "lib/ms/ident/peptide_hit.rb",
41
+ "lib/ms/ident/peptide_hit/qvalue.rb",
42
+ "lib/ms/ident/pepxml.rb",
43
+ "lib/ms/ident/pepxml/modifications.rb",
44
+ "lib/ms/ident/pepxml/msms_pipeline_analysis.rb",
45
+ "lib/ms/ident/pepxml/msms_run_summary.rb",
46
+ "lib/ms/ident/pepxml/parameters.rb",
47
+ "lib/ms/ident/pepxml/sample_enzyme.rb",
48
+ "lib/ms/ident/pepxml/search_database.rb",
49
+ "lib/ms/ident/pepxml/search_hit.rb",
50
+ "lib/ms/ident/pepxml/search_hit/modification_info.rb",
51
+ "lib/ms/ident/pepxml/search_result.rb",
52
+ "lib/ms/ident/pepxml/search_summary.rb",
53
+ "lib/ms/ident/pepxml/spectrum_query.rb",
54
+ "lib/ms/ident/protein.rb",
55
+ "lib/ms/ident/protein_group.rb",
56
+ "lib/ms/ident/search.rb",
57
+ "lib/ms/isotope/aa.rb",
58
+ "lib/ms/mascot.rb",
59
+ "lib/ms/mass.rb",
60
+ "lib/ms/mass/aa.rb",
61
+ "lib/ms/mzml.rb",
62
+ "lib/ms/mzml/activation.rb",
63
+ "lib/ms/mzml/chromatogram.rb",
64
+ "lib/ms/mzml/chromatogram_list.rb",
65
+ "lib/ms/mzml/component.rb",
66
+ "lib/ms/mzml/contact.rb",
67
+ "lib/ms/mzml/cv.rb",
68
+ "lib/ms/mzml/data_array.rb",
69
+ "lib/ms/mzml/data_array_container_like.rb",
70
+ "lib/ms/mzml/data_processing.rb",
71
+ "lib/ms/mzml/file_content.rb",
72
+ "lib/ms/mzml/file_description.rb",
73
+ "lib/ms/mzml/index_list.rb",
74
+ "lib/ms/mzml/instrument_configuration.rb",
75
+ "lib/ms/mzml/isolation_window.rb",
76
+ "lib/ms/mzml/list.rb",
77
+ "lib/ms/mzml/plms1.rb",
78
+ "lib/ms/mzml/precursor.rb",
79
+ "lib/ms/mzml/processing_method.rb",
80
+ "lib/ms/mzml/product.rb",
81
+ "lib/ms/mzml/referenceable_param_group.rb",
82
+ "lib/ms/mzml/run.rb",
83
+ "lib/ms/mzml/sample.rb",
84
+ "lib/ms/mzml/scan.rb",
85
+ "lib/ms/mzml/scan_list.rb",
86
+ "lib/ms/mzml/scan_settings.rb",
87
+ "lib/ms/mzml/selected_ion.rb",
88
+ "lib/ms/mzml/software.rb",
89
+ "lib/ms/mzml/source_file.rb",
90
+ "lib/ms/mzml/spectrum.rb",
91
+ "lib/ms/mzml/spectrum_list.rb",
92
+ "lib/ms/obo.rb",
93
+ "lib/ms/peak.rb",
94
+ "lib/ms/peak/point.rb",
95
+ "lib/ms/plms1.rb",
96
+ "lib/ms/quant/qspec.rb",
97
+ "lib/ms/quant/qspec/protein_group_comparison.rb",
98
+ "lib/ms/spectrum.rb",
99
+ "lib/ms/spectrum/centroid.rb",
100
+ "lib/ms/spectrum_like.rb",
101
+ "lib/ms/user_param.rb",
102
+ "lib/mspire.rb",
103
+ "lib/obo/ims.rb",
104
+ "lib/obo/ms.rb",
105
+ "lib/obo/ontology.rb",
106
+ "lib/obo/unit.rb",
107
+ "lib/openany.rb",
108
+ "lib/write_file_or_string.rb",
109
+ "obo/ims.obo",
110
+ "obo/ms.obo",
111
+ "obo/unit.obo",
112
+ "spec/bin_spec.rb",
113
+ "spec/ms/cv/param_spec.rb",
114
+ "spec/ms/digester_spec.rb",
115
+ "spec/ms/fasta_spec.rb",
116
+ "spec/ms/ident/peptide/db_spec.rb",
117
+ "spec/ms/ident/pepxml/sample_enzyme_spec.rb",
118
+ "spec/ms/ident/pepxml/search_hit/modification_info_spec.rb",
119
+ "spec/ms/ident/pepxml_spec.rb",
120
+ "spec/ms/ident/protein_group_spec.rb",
121
+ "spec/ms/isotope/aa_spec.rb",
122
+ "spec/ms/mass_spec.rb",
123
+ "spec/ms/mzml/cv_spec.rb",
124
+ "spec/ms/mzml/file_content_spec.rb",
125
+ "spec/ms/mzml/file_description_spec.rb",
126
+ "spec/ms/mzml/index_list_spec.rb",
127
+ "spec/ms/mzml/plms1_spec.rb",
128
+ "spec/ms/mzml/referenceable_param_group_spec.rb",
129
+ "spec/ms/mzml_spec.rb",
130
+ "spec/ms/peak_spec.rb",
131
+ "spec/ms/plms1_spec.rb",
132
+ "spec/ms/quant/qspec_spec.rb",
133
+ "spec/ms/spectrum_spec.rb",
134
+ "spec/ms/user_param_spec.rb",
135
+ "spec/mspire_spec.rb",
136
+ "spec/obo_spec.rb",
137
+ "spec/spec_helper.rb",
138
+ "spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.fasta",
139
+ "spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml",
140
+ "spec/testfiles/ms/mzml/j24z.idx_comp.3.mzML",
141
+ "spec/testfiles/ms/mzml/mspire_simulated.noidx.check.mzML",
142
+ "spec/testfiles/ms/mzml/openms.noidx_nocomp.12.mzML",
143
+ "spec/testfiles/ms/quant/kill_extra_tabs.rb",
144
+ "spec/testfiles/ms/quant/max_quant_output.provenance.txt",
145
+ "spec/testfiles/ms/quant/max_quant_output.txt",
146
+ "spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv",
147
+ "spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv_qspecgp",
148
+ "spec/testfiles/ms/quant/pdcd5_final.killedextratabs.tsv_qspecgp.csv",
149
+ "spec/testfiles/ms/quant/pdcd5_final.txt",
150
+ "spec/testfiles/ms/quant/pdcd5_final.txt_qspecgp",
151
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.CSV.csv",
152
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.csv",
153
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.csv",
154
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv",
155
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp",
156
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp.csv",
157
+ "spec/testfiles/ms/quant/pdcd5_lfq_qspec.txt",
158
+ "spec/testfiles/ms/quant/pdcd5_lfq_tabdel.txt",
159
+ "spec/testfiles/ms/quant/pdcd5_lfq_tabdel.txt_qspecgp",
160
+ "spec/testfiles/ms/quant/remove_rest_of_proteins.rb",
161
+ "spec/testfiles/ms/quant/unlog_transform.rb",
162
+ "spec/testfiles/plms1/output.key"
163
+ ]
164
+ s.homepage = "http://github.com/princelab/mspire"
165
+ s.licenses = ["MIT"]
166
+ s.require_paths = ["lib"]
167
+ s.rubygems_version = "1.8.15"
168
+ s.summary = "mass spectrometry proteomics, lipidomics, and tools"
169
+
170
+ if s.respond_to? :specification_version then
171
+ s.specification_version = 3
172
+
173
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
174
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.5"])
175
+ s.add_runtime_dependency(%q<bsearch>, [">= 1.5.0"])
176
+ s.add_runtime_dependency(%q<andand>, [">= 1.3.1"])
177
+ s.add_runtime_dependency(%q<obo>, [">= 0.1.0"])
178
+ s.add_development_dependency(%q<rspec>, ["~> 2.6"])
179
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
180
+ s.add_development_dependency(%q<rcov>, [">= 0"])
181
+ else
182
+ s.add_dependency(%q<nokogiri>, ["~> 1.5"])
183
+ s.add_dependency(%q<bsearch>, [">= 1.5.0"])
184
+ s.add_dependency(%q<andand>, [">= 1.3.1"])
185
+ s.add_dependency(%q<obo>, [">= 0.1.0"])
186
+ s.add_dependency(%q<rspec>, ["~> 2.6"])
187
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
188
+ s.add_dependency(%q<rcov>, [">= 0"])
189
+ end
190
+ else
191
+ s.add_dependency(%q<nokogiri>, ["~> 1.5"])
192
+ s.add_dependency(%q<bsearch>, [">= 1.5.0"])
193
+ s.add_dependency(%q<andand>, [">= 1.3.1"])
194
+ s.add_dependency(%q<obo>, [">= 0.1.0"])
195
+ s.add_dependency(%q<rspec>, ["~> 2.6"])
196
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
197
+ s.add_dependency(%q<rcov>, [">= 0"])
198
+ end
199
+ end
200
+
@@ -77,6 +77,12 @@ describe 'basic fasta operations' do
77
77
  end
78
78
  end
79
79
 
80
+ it 'gives an iterator called with MS::Fasta.foreach and no block' do
81
+ seqs = MS::Fasta.foreach(@data['newlines_file']).select {|e| e.header =~ /^gi/ }.map(&:sequence)
82
+ seqs.size.should == 1
83
+ seqs.first[0,4].should == 'LCLY'
84
+ end
85
+
80
86
  it 'runs the documentation' do
81
87
  fasta_file = @data['newlines_file']
82
88
  ids = MS::Fasta.open(fasta_file) do |fasta|
data/spec/ms/mzml_spec.rb CHANGED
@@ -76,6 +76,78 @@ describe MS::Mzml do
76
76
  string.gsub(/"mspire" version="([\.\d]+)"/, %Q{"mspire" version="X.X.X"})
77
77
  end
78
78
 
79
+ it 'writes MS1 and MS2 spectra' do
80
+ # profile and ms_level 1
81
+ spec_params = ['MS:1000128', ['MS:1000511', 1]]
82
+
83
+ spec1 = MS::Mzml::Spectrum.new('scan=1', params: spec_params) do |spec|
84
+ spec.data_arrays = [[1,2,3], [4,5,6]]
85
+ spec.scan_list = MS::Mzml::ScanList.new do |sl|
86
+ scan = MS::Mzml::Scan.new do |scan|
87
+ # retention time of 42 seconds
88
+ scan.describe! ['MS:1000016', 40.0, 'UO:0000010']
89
+ end
90
+ sl << scan
91
+ end
92
+ end
93
+
94
+ # centroid, ms_level 2, MSn spectrum,
95
+ spec_params = ['MS:1000127', ['MS:1000511', 2], "MS:1000580"]
96
+
97
+ spec2 = MS::Mzml::Spectrum.new('scan=2', params: spec_params) do |spec|
98
+ spec.data_arrays = [[1,2,3.5], [5,6,5]]
99
+ spec.scan_list = MS::Mzml::ScanList.new do |sl|
100
+ scan = MS::Mzml::Scan.new do |scan|
101
+ # retention time of 42 seconds
102
+ scan.describe! ['MS:1000016', 45.0, 'UO:0000010']
103
+ end
104
+ sl << scan
105
+ end
106
+ precursor = MS::Mzml::Precursor.new( spec1 )
107
+ si = MS::Mzml::SelectedIon.new
108
+ # the selected ion m/z:
109
+ si.describe! ["MS:1000744", 2.0]
110
+ # the selected ion charge state
111
+ si.describe! ["MS:1000041", 2]
112
+ # the selected ion intensity
113
+ si.describe! ["MS:1000042", 5]
114
+ precursor.selected_ions = [si]
115
+ spec.precursors = [precursor]
116
+ end
117
+
118
+ mzml = MS::Mzml.new do |mzml|
119
+ mzml.id = 'ms1_and_ms2'
120
+ mzml.cvs = MS::Mzml::CV::DEFAULT_CVS
121
+ mzml.file_description = MS::Mzml::FileDescription.new do |fd|
122
+ fd.file_content = MS::Mzml::FileContent.new
123
+ fd.source_files << MS::Mzml::SourceFile.new
124
+ end
125
+ default_instrument_config = MS::Mzml::InstrumentConfiguration.new("IC",[], params: ['MS:1000031'])
126
+ mzml.instrument_configurations << default_instrument_config
127
+ software = MS::Mzml::Software.new
128
+ mzml.software_list << software
129
+ default_data_processing = MS::Mzml::DataProcessing.new("did_nothing")
130
+ mzml.data_processing_list << default_data_processing
131
+ mzml.run = MS::Mzml::Run.new("little_run", default_instrument_config) do |run|
132
+ spectrum_list = MS::Mzml::SpectrumList.new(default_data_processing)
133
+ spectrum_list.push(spec1, spec2)
134
+ run.spectrum_list = spectrum_list
135
+ end
136
+ end
137
+
138
+ #check = TESTFILES + '/ms/mzml/mspire_simulated.noidx.check.mzML'
139
+ tmpfile = TESTFILES + '/ms/mzml/mspire_simulated.MSn.TMP.mzML'
140
+ mzml.to_xml(tmpfile)
141
+ p tmpfile
142
+ #xml = sanitize_version(IO.read(tmpfile))
143
+ #xml.should be_a(String)
144
+ #sanitize_version(mzml.to_xml).should == xml
145
+ #xml.should == sanitize_version(IO.read(check))
146
+ #xml.should match(/<mzML/)
147
+ #File.unlink(tmpfile)
148
+ end
149
+
150
+
79
151
  it 'writes MS1 spectra and retention times' do
80
152
 
81
153
  spec_params = ['MS:1000127', ['MS:1000511', 1]]
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.6.20
4
+ version: 0.6.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-24 00:00:00.000000000 Z
13
+ date: 2012-02-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
17
- requirement: &23959880 !ruby/object:Gem::Requirement
17
+ requirement: &8601020 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '1.5'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *23959880
25
+ version_requirements: *8601020
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: bsearch
28
- requirement: &23959360 !ruby/object:Gem::Requirement
28
+ requirement: &8615260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *23959360
36
+ version_requirements: *8615260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: andand
39
- requirement: &23958860 !ruby/object:Gem::Requirement
39
+ requirement: &8612840 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.3.1
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *23958860
47
+ version_requirements: *8612840
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: obo
50
- requirement: &23958340 !ruby/object:Gem::Requirement
50
+ requirement: &8611480 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *23958340
58
+ version_requirements: *8611480
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rspec
61
- requirement: &23974240 !ruby/object:Gem::Requirement
61
+ requirement: &8609880 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '2.6'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *23974240
69
+ version_requirements: *8609880
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: jeweler
72
- requirement: &23973760 !ruby/object:Gem::Requirement
72
+ requirement: &8624220 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.5.2
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *23973760
80
+ version_requirements: *8624220
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rcov
83
- requirement: &23973280 !ruby/object:Gem::Requirement
83
+ requirement: &8617960 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *23973280
91
+ version_requirements: *8617960
92
92
  description: mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire,
93
93
  merging of ms-* gems
94
94
  email: jtprince@gmail.com
@@ -187,6 +187,7 @@ files:
187
187
  - lib/obo/unit.rb
188
188
  - lib/openany.rb
189
189
  - lib/write_file_or_string.rb
190
+ - mspire.gemspec
190
191
  - obo/ims.obo
191
192
  - obo/ms.obo
192
193
  - obo/unit.obo