mspire 0.6.22 → 0.6.24
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/lib/ms/isotope.rb +93 -0
- data/lib/ms/isotope/aa.rb +2 -1
- data/lib/ms/isotope/nist_isotope_info.yml +2017 -0
- data/lib/ms/mzml.rb +0 -18
- data/lib/ms/mzml/data_array.rb +79 -11
- data/lib/ms/mzml/spectrum.rb +2 -3
- data/mspire.gemspec +14 -3
- data/script/mzml_read_binary.rb +34 -0
- data/spec/ms/isotope_spec.rb +31 -0
- data/spec/ms/mzml/data_array_spec.rb +38 -0
- data/spec/ms/mzml_spec.rb +5 -62
- data/spec/testfiles/ms/mzml/{mspire_simulated.noidx.check.mzML → mspire_simulated.MSn.check.mzML} +14 -4
- metadata +44 -17
data/lib/ms/mzml.rb
CHANGED
@@ -176,24 +176,6 @@ module MS
|
|
176
176
|
mzml.each(&block)
|
177
177
|
end
|
178
178
|
end
|
179
|
-
|
180
|
-
# unpack binary data based on an accesions. accessions must only
|
181
|
-
# respond to :include? So, hash keys, a set, or an array will all work.
|
182
|
-
def unpack_binary(base64string, accessions)
|
183
|
-
compressed =
|
184
|
-
if accessions.include?('MS:1000574') then true # zlib compression
|
185
|
-
elsif accessions.include?('MS:1000576') then false # no compression
|
186
|
-
else raise 'no compression info: check your MS accession numbers'
|
187
|
-
end
|
188
|
-
precision_unpack =
|
189
|
-
if accessions.include?('MS:1000523') then 'E*'
|
190
|
-
elsif accessions.include?('MS:1000521') then 'e*'
|
191
|
-
else raise 'unrecognized precision: check your MS accession numbers'
|
192
|
-
end
|
193
|
-
data = base64string.unpack("m*").first
|
194
|
-
unzipped = compressed ? Zlib::Inflate.inflate(data) : data
|
195
|
-
unzipped.unpack(precision_unpack)
|
196
|
-
end
|
197
179
|
end
|
198
180
|
|
199
181
|
# name can be :spectrum or :chromatogram
|
data/lib/ms/mzml/data_array.rb
CHANGED
@@ -5,6 +5,7 @@ require 'ms/cv/paramable'
|
|
5
5
|
module MS
|
6
6
|
class Mzml
|
7
7
|
class DataArray < Array
|
8
|
+
alias_method :array_initialize, :initialize
|
8
9
|
include MS::CV::Paramable
|
9
10
|
|
10
11
|
DEFAULT_DTYPE = :float64
|
@@ -17,17 +18,76 @@ module MS
|
|
17
18
|
int32: 'MS:1000519', # signed
|
18
19
|
}
|
19
20
|
|
20
|
-
# the type of data array (:mz or :
|
21
|
+
# the type of data array (:mz, :intensity, :mz_external, or :intensity_external)
|
21
22
|
attr_accessor :type
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
def initialize(_type, opts={params: []})
|
26
|
-
@type = _type
|
27
|
-
@external = !!(@type.to_s =~ /external$/)
|
24
|
+
def initialize(*args)
|
25
|
+
array_initialize(*args)
|
28
26
|
end
|
29
27
|
|
30
|
-
|
28
|
+
# returns a new MS::Mzml::DataArray object (an array)
|
29
|
+
#
|
30
|
+
# args:
|
31
|
+
# base64, set-like # where set-like responds to include?
|
32
|
+
# base64, type=:float64, compression=true
|
33
|
+
#
|
34
|
+
# examples:
|
35
|
+
# MS::Mzml::Spectrum.unpack_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', ['MS:1000574', MS:1000523']).
|
36
|
+
# MS::Mzml::Spectrum.unpack_binary("ADBA/=", :float32, true)
|
37
|
+
# MS::Mzml::Spectrum.unpack_binary("ADBA/=") # uses float64 and compression
|
38
|
+
def self.from_binary(base64, *args)
|
39
|
+
if args.first.respond_to?(:include?)
|
40
|
+
accessions = args.first
|
41
|
+
compressed =
|
42
|
+
if accessions.include?('MS:1000574') then true # zlib compression
|
43
|
+
elsif accessions.include?('MS:1000576') then false # no compression
|
44
|
+
else raise 'no compression info: check your MS accession numbers'
|
45
|
+
end
|
46
|
+
precision_unpack =
|
47
|
+
if accessions.include?('MS:1000523') then 'E*'
|
48
|
+
elsif accessions.include?('MS:1000521') then 'e*'
|
49
|
+
else raise 'unrecognized precision: check your MS accession numbers'
|
50
|
+
end
|
51
|
+
else
|
52
|
+
compressed = args.last || true
|
53
|
+
precision_unpack =
|
54
|
+
case args.first
|
55
|
+
when :float64
|
56
|
+
'E*'
|
57
|
+
when :float32
|
58
|
+
'e*'
|
59
|
+
when nil
|
60
|
+
'E*'
|
61
|
+
else
|
62
|
+
raise ArgumentError, "#{args.first} must be one of :float64, :float32 or other acceptable type"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
data = base64.unpack("m*").first
|
66
|
+
unzipped = compressed ? Zlib::Inflate.inflate(data) : data
|
67
|
+
self.new( unzipped.unpack(precision_unpack) )
|
68
|
+
end
|
69
|
+
|
70
|
+
# returns a base64 string that can be used for xml representations of
|
71
|
+
# the data
|
72
|
+
#
|
73
|
+
# args:
|
74
|
+
# array-like set-like # where set-like responds to include?
|
75
|
+
# array-like type=:float64, compression=true
|
76
|
+
def self.to_binary(array_ish, *args)
|
77
|
+
if args.first.respond_to?(:include?)
|
78
|
+
accessions = args.first
|
79
|
+
dtype =
|
80
|
+
if accessions.include?('MS:1000521')
|
81
|
+
:float32
|
82
|
+
else
|
83
|
+
:float64
|
84
|
+
end
|
85
|
+
compression = accessions.include?('MS:1000576') ? false : true
|
86
|
+
else
|
87
|
+
dtype = args[0] || DEFAULT_DTYPE
|
88
|
+
compression = args[1] || DEFAULT_COMPRESSION
|
89
|
+
end
|
90
|
+
|
31
91
|
pack_code =
|
32
92
|
case dtype
|
33
93
|
when :float64 ; 'E*'
|
@@ -42,6 +102,11 @@ module MS
|
|
42
102
|
Base64.strict_encode64(string)
|
43
103
|
end
|
44
104
|
|
105
|
+
# calls the class to_binary method with self and the given args
|
106
|
+
def to_binary(*args)
|
107
|
+
self.class.to_binary(self, *args)
|
108
|
+
end
|
109
|
+
|
45
110
|
def to_xml(builder, dtype=DEFAULT_DTYPE, compression=DEFAULT_COMPRESSION)
|
46
111
|
encoded_length =
|
47
112
|
if @external
|
@@ -56,8 +121,11 @@ module MS
|
|
56
121
|
unless @external
|
57
122
|
MS::CV::Param[ DTYPE_TO_ACC[dtype] ].to_xml(bda_n)
|
58
123
|
MS::CV::Param[ compression ? 'MS:1000574' : 'MS:1000576' ].to_xml(bda_n)
|
59
|
-
|
60
|
-
|
124
|
+
if @type
|
125
|
+
accession = ( (@type == :mz) ? 'MS:1000514' : 'MS:1000515' )
|
126
|
+
MS::CV::Param[accession].to_xml(bda_n)
|
127
|
+
bda_n.binary(base64)
|
128
|
+
end
|
61
129
|
end
|
62
130
|
end
|
63
131
|
end
|
@@ -70,8 +138,8 @@ module MS
|
|
70
138
|
if data_ar.is_a?(MS::Mzml::DataArray)
|
71
139
|
data_ar
|
72
140
|
else
|
73
|
-
real_data_array = MS::Mzml::DataArray.new(
|
74
|
-
real_data_array.
|
141
|
+
real_data_array = MS::Mzml::DataArray.new(data_ar)
|
142
|
+
real_data_array.type = typ
|
75
143
|
real_data_array
|
76
144
|
end
|
77
145
|
ar.type = typ unless ar.type
|
data/lib/ms/mzml/spectrum.rb
CHANGED
@@ -83,16 +83,15 @@ module MS
|
|
83
83
|
data_arrays = xml.xpath('./binaryDataArrayList/binaryDataArray').map do |binary_data_array_n|
|
84
84
|
accessions = binary_data_array_n.xpath('./cvParam').map {|node| node['accession'] }
|
85
85
|
base64 = binary_data_array_n.xpath('./binary').text
|
86
|
-
MS::Mzml.
|
86
|
+
MS::Mzml::DataArray.from_binary(base64, accessions)
|
87
87
|
end
|
88
88
|
# if there is no spectrum, we will still return a spectrum object, it
|
89
89
|
# just has no mzs or intensities
|
90
|
-
data_arrays = [
|
90
|
+
data_arrays = [MS::Mzml::DataArray.new, MS::Mzml::DataArray.new] if data_arrays.size == 0
|
91
91
|
spec.data_arrays = data_arrays
|
92
92
|
spec
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
95
|
# the most common param to pass in would be ms level: 'MS:1000511'
|
97
96
|
#
|
98
97
|
# This would generate a spectrum of ms_level=2 :
|
data/mspire.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mspire"
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.24"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John T. Prince", "Simon Chiang"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-03-13"
|
13
13
|
s.description = "mass spectrometry proteomics, lipidomics, and tools, a rewrite of mspire, merging of ms-* gems"
|
14
14
|
s.email = "jtprince@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -56,7 +56,9 @@ Gem::Specification.new do |s|
|
|
56
56
|
"lib/ms/ident/protein.rb",
|
57
57
|
"lib/ms/ident/protein_group.rb",
|
58
58
|
"lib/ms/ident/search.rb",
|
59
|
+
"lib/ms/isotope.rb",
|
59
60
|
"lib/ms/isotope/aa.rb",
|
61
|
+
"lib/ms/isotope/nist_isotope_info.yml",
|
60
62
|
"lib/ms/mascot.rb",
|
61
63
|
"lib/ms/mass.rb",
|
62
64
|
"lib/ms/mass/aa.rb",
|
@@ -112,6 +114,7 @@ Gem::Specification.new do |s|
|
|
112
114
|
"obo/ims.obo",
|
113
115
|
"obo/ms.obo",
|
114
116
|
"obo/unit.obo",
|
117
|
+
"script/mzml_read_binary.rb",
|
115
118
|
"spec/bin_spec.rb",
|
116
119
|
"spec/ms/cv/param_spec.rb",
|
117
120
|
"spec/ms/digester_spec.rb",
|
@@ -123,8 +126,10 @@ Gem::Specification.new do |s|
|
|
123
126
|
"spec/ms/ident/pepxml_spec.rb",
|
124
127
|
"spec/ms/ident/protein_group_spec.rb",
|
125
128
|
"spec/ms/isotope/aa_spec.rb",
|
129
|
+
"spec/ms/isotope_spec.rb",
|
126
130
|
"spec/ms/mass_spec.rb",
|
127
131
|
"spec/ms/mzml/cv_spec.rb",
|
132
|
+
"spec/ms/mzml/data_array_spec.rb",
|
128
133
|
"spec/ms/mzml/file_content_spec.rb",
|
129
134
|
"spec/ms/mzml/file_description_spec.rb",
|
130
135
|
"spec/ms/mzml/index_list_spec.rb",
|
@@ -142,7 +147,7 @@ Gem::Specification.new do |s|
|
|
142
147
|
"spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.fasta",
|
143
148
|
"spec/testfiles/ms/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml",
|
144
149
|
"spec/testfiles/ms/mzml/j24z.idx_comp.3.mzML",
|
145
|
-
"spec/testfiles/ms/mzml/mspire_simulated.
|
150
|
+
"spec/testfiles/ms/mzml/mspire_simulated.MSn.check.mzML",
|
146
151
|
"spec/testfiles/ms/mzml/openms.noidx_nocomp.12.mzML",
|
147
152
|
"spec/testfiles/ms/quant/kill_extra_tabs.rb",
|
148
153
|
"spec/testfiles/ms/quant/max_quant_output.provenance.txt",
|
@@ -179,6 +184,8 @@ Gem::Specification.new do |s|
|
|
179
184
|
s.add_runtime_dependency(%q<bsearch>, [">= 1.5.0"])
|
180
185
|
s.add_runtime_dependency(%q<andand>, [">= 1.3.1"])
|
181
186
|
s.add_runtime_dependency(%q<obo>, [">= 0.1.0"])
|
187
|
+
s.add_runtime_dependency(%q<builder>, [">= 3.0.0"])
|
188
|
+
s.add_runtime_dependency(%q<trollop>, [">= 1.16.2"])
|
182
189
|
s.add_development_dependency(%q<rspec>, ["~> 2.6"])
|
183
190
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
184
191
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
@@ -187,6 +194,8 @@ Gem::Specification.new do |s|
|
|
187
194
|
s.add_dependency(%q<bsearch>, [">= 1.5.0"])
|
188
195
|
s.add_dependency(%q<andand>, [">= 1.3.1"])
|
189
196
|
s.add_dependency(%q<obo>, [">= 0.1.0"])
|
197
|
+
s.add_dependency(%q<builder>, [">= 3.0.0"])
|
198
|
+
s.add_dependency(%q<trollop>, [">= 1.16.2"])
|
190
199
|
s.add_dependency(%q<rspec>, ["~> 2.6"])
|
191
200
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
192
201
|
s.add_dependency(%q<rcov>, [">= 0"])
|
@@ -196,6 +205,8 @@ Gem::Specification.new do |s|
|
|
196
205
|
s.add_dependency(%q<bsearch>, [">= 1.5.0"])
|
197
206
|
s.add_dependency(%q<andand>, [">= 1.3.1"])
|
198
207
|
s.add_dependency(%q<obo>, [">= 0.1.0"])
|
208
|
+
s.add_dependency(%q<builder>, [">= 3.0.0"])
|
209
|
+
s.add_dependency(%q<trollop>, [">= 1.16.2"])
|
199
210
|
s.add_dependency(%q<rspec>, ["~> 2.6"])
|
200
211
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
201
212
|
s.add_dependency(%q<rcov>, [">= 0"])
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'trollop'
|
4
|
+
require 'ms/mzml/data_array'
|
5
|
+
|
6
|
+
parser = Trollop::Parser.new do
|
7
|
+
banner "usage: #{File.basename(__FILE__)} [OPTIONS] <base64> ..."
|
8
|
+
banner "output: space separated data, one line per base64 string"
|
9
|
+
banner ""
|
10
|
+
opt :type, "kind of data (float32|float64|int8|int16|int32|int64)", :default => 'float64'
|
11
|
+
opt :not_compressed, "zlib compression was *not* used"
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
opts = parser.parse(ARGV)
|
16
|
+
rescue help=Trollop::HelpNeeded
|
17
|
+
end
|
18
|
+
|
19
|
+
if help || ARGV.size == 0
|
20
|
+
parser.educate && exit
|
21
|
+
end
|
22
|
+
|
23
|
+
type = opts[:type].to_sym
|
24
|
+
compressed = !opts[:not_compressed]
|
25
|
+
|
26
|
+
ARGV.each do |base64|
|
27
|
+
puts MS::Mzml::DataArray.from_binary(base64, type, compressed).join(" ")
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'ms/isotope'
|
4
|
+
|
5
|
+
describe 'MS::Isotope constants' do
|
6
|
+
it 'has all the common isotopes: MS::Isotope::ISOTOPES' do
|
7
|
+
# frozen
|
8
|
+
MS::Isotope::ISOTOPES.size.should == 288
|
9
|
+
hydrogen_isotopes = MS::Isotope::ISOTOPES.select {|iso| iso.element == :h }
|
10
|
+
hydrogen_isotopes.size.should == 2
|
11
|
+
|
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|
|
13
|
+
hydrogen_isotopes.first.send(k).should == v
|
14
|
+
end
|
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
|
+
hydrogen_isotopes.last.send(k).should == v
|
17
|
+
end
|
18
|
+
u = MS::Isotope::ISOTOPES.last
|
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
|
+
u.send(k).should == v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
it 'has all common isotopes by element: MS::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(MS::Isotope::BY_ELEMENT[:c]) do |hash, iso|
|
25
|
+
hash.each do |k,v|
|
26
|
+
iso.send(k).should == v
|
27
|
+
end
|
28
|
+
end
|
29
|
+
MS::Isotope::BY_ELEMENT[:h].size.should == 2
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'ms/mzml/data_array'
|
4
|
+
|
5
|
+
describe MS::Mzml::DataArray do
|
6
|
+
|
7
|
+
it 'can be created from base64 binary data' do
|
8
|
+
d_ar = MS::Mzml::DataArray.from_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', :float64, zlib=true)
|
9
|
+
d_ar.is_a?(Array)
|
10
|
+
d_ar.should == [1.0, 2.0, 3.0]
|
11
|
+
d_ar = MS::Mzml::DataArray.from_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', ['MS:1000523', 'MS:1000574'])
|
12
|
+
d_ar.is_a?(Array)
|
13
|
+
d_ar.should == [1.0, 2.0, 3.0]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "can be initialized like any ol' array" do
|
17
|
+
data = [1,2,3]
|
18
|
+
d_ar = MS::Mzml::DataArray.new( data )
|
19
|
+
d_ar.should == data
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'an instantiated MS::Mzml::DataArray' do
|
23
|
+
subject { MS::Mzml::DataArray.new [1,2,3] }
|
24
|
+
|
25
|
+
it "can have a 'type'" do
|
26
|
+
subject.type = :mz
|
27
|
+
subject.type.should == :mz
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'can be converted to a binary string' do
|
31
|
+
string = subject.to_binary
|
32
|
+
# frozen
|
33
|
+
string.should == "eJxjYACBD/YMEOAAoTgcABe3Abg="
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/spec/ms/mzml_spec.rb
CHANGED
@@ -136,70 +136,13 @@ describe MS::Mzml do
|
|
136
136
|
#check = TESTFILES + '/ms/mzml/mspire_simulated.noidx.check.mzML'
|
137
137
|
tmpfile = TESTFILES + '/ms/mzml/mspire_simulated.MSn.TMP.mzML'
|
138
138
|
mzml.to_xml(tmpfile)
|
139
|
-
|
140
|
-
|
141
|
-
#xml.should be_a(String)
|
142
|
-
#sanitize_version(mzml.to_xml).should == xml
|
143
|
-
#xml.should == sanitize_version(IO.read(check))
|
144
|
-
#xml.should match(/<mzML/)
|
145
|
-
#File.unlink(tmpfile)
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
it 'writes MS1 spectra and retention times' do
|
139
|
+
as_string = mzml.to_xml
|
140
|
+
check_string = IO.read(TESTFILES + '/ms/mzml/mspire_simulated.MSn.check.mzML')
|
150
141
|
|
151
|
-
|
152
|
-
|
153
|
-
spec1 = MS::Mzml::Spectrum.new('scan=1', params: spec_params) do |spec|
|
154
|
-
spec.data_arrays = [[1,2,3], [4,5,6]]
|
155
|
-
spec.scan_list = MS::Mzml::ScanList.new do |sl|
|
156
|
-
scan = MS::Mzml::Scan.new do |scan|
|
157
|
-
# retention time of 42 seconds
|
158
|
-
scan.describe! ['MS:1000016', 40.0, 'UO:0000010']
|
159
|
-
end
|
160
|
-
sl << scan
|
161
|
-
end
|
162
|
-
end
|
163
|
-
spec2 = MS::Mzml::Spectrum.new('scan=2', params: spec_params) do |spec|
|
164
|
-
spec.data_arrays = [[1,2,3.5], [5,6,5]]
|
165
|
-
spec.scan_list = MS::Mzml::ScanList.new do |sl|
|
166
|
-
scan = MS::Mzml::Scan.new do |scan|
|
167
|
-
# retention time of 42 seconds
|
168
|
-
scan.describe! ['MS:1000016', 45.0, 'UO:0000010']
|
169
|
-
end
|
170
|
-
sl << scan
|
171
|
-
end
|
142
|
+
[IO.read(tmpfile), as_string].each do |st|
|
143
|
+
sanitize_version(check_string).should == sanitize_version(st)
|
172
144
|
end
|
173
|
-
|
174
|
-
mzml = MS::Mzml.new do |mzml|
|
175
|
-
mzml.id = 'the_little_one'
|
176
|
-
mzml.cvs = MS::Mzml::CV::DEFAULT_CVS
|
177
|
-
mzml.file_description = MS::Mzml::FileDescription.new do |fd|
|
178
|
-
fd.file_content = MS::Mzml::FileContent.new
|
179
|
-
fd.source_files << MS::Mzml::SourceFile.new
|
180
|
-
end
|
181
|
-
default_instrument_config = MS::Mzml::InstrumentConfiguration.new("IC",[], params: ['MS:1000031'])
|
182
|
-
mzml.instrument_configurations << default_instrument_config
|
183
|
-
software = MS::Mzml::Software.new
|
184
|
-
mzml.software_list << software
|
185
|
-
default_data_processing = MS::Mzml::DataProcessing.new("did_nothing")
|
186
|
-
mzml.data_processing_list << default_data_processing
|
187
|
-
mzml.run = MS::Mzml::Run.new("little_run", default_instrument_config) do |run|
|
188
|
-
spectrum_list = MS::Mzml::SpectrumList.new(default_data_processing)
|
189
|
-
spectrum_list.push(spec1, spec2)
|
190
|
-
run.spectrum_list = spectrum_list
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
check = TESTFILES + '/ms/mzml/mspire_simulated.noidx.check.mzML'
|
195
|
-
tmpfile = TESTFILES + '/ms/mzml/mspire_simulated.TMP.mzML'
|
196
|
-
mzml.to_xml(tmpfile)
|
197
|
-
xml = sanitize_version(IO.read(tmpfile))
|
198
|
-
xml.should be_a(String)
|
199
|
-
sanitize_version(mzml.to_xml).should == xml
|
200
|
-
xml.should == sanitize_version(IO.read(check))
|
201
|
-
xml.should match(/<mzML/)
|
202
|
-
File.unlink(tmpfile)
|
145
|
+
File.unlink(tmpfile) if File.exist?(tmpfile)
|
203
146
|
end
|
204
147
|
end
|
205
148
|
end
|
data/spec/testfiles/ms/mzml/{mspire_simulated.noidx.check.mzML → mspire_simulated.MSn.check.mzML}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.1.0" id="
|
2
|
+
<mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.1.0" id="ms1_and_ms2">
|
3
3
|
<cvList count="3">
|
4
4
|
<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" URI="http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo" version="3.18.0"/>
|
5
5
|
<cv id="UO" fullName="Unit Ontology" URI="http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/phenotype/unit.obo" version="16:02:2012"/>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
</sourceFileList>
|
15
15
|
</fileDescription>
|
16
16
|
<softwareList count="1">
|
17
|
-
<software id="mspire" version="0.6.
|
17
|
+
<software id="mspire" version="0.6.22">
|
18
18
|
</software>
|
19
19
|
</softwareList>
|
20
20
|
<instrumentConfigurationList count="1">
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<run id="little_run" defaultInstrumentConfigurationRef="IC">
|
32
32
|
<spectrumList count="2" defaultDataProcessingRef="did_nothing">
|
33
33
|
<spectrum id="scan=1" index="0" defaultArrayLength="3">
|
34
|
-
<cvParam cvRef="MS" accession="MS:
|
34
|
+
<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum"/>
|
35
35
|
<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="1"/>
|
36
36
|
<scanList count="1">
|
37
37
|
<scan>
|
@@ -55,12 +55,22 @@
|
|
55
55
|
</spectrum>
|
56
56
|
<spectrum id="scan=2" index="1" defaultArrayLength="3">
|
57
57
|
<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum"/>
|
58
|
-
<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="
|
58
|
+
<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="2"/>
|
59
|
+
<cvParam cvRef="MS" accession="MS:1000580" name="MSn spectrum"/>
|
59
60
|
<scanList count="1">
|
60
61
|
<scan>
|
61
62
|
<cvParam cvRef="MS" accession="MS:1000016" name="scan start time" value="45.0" unitCvRef="UO" unitAccession="UO:0000010" unitName="second"/>
|
62
63
|
</scan>
|
63
64
|
</scanList>
|
65
|
+
<precursorList count="1">
|
66
|
+
<precursor spectrumRef="scan=1">
|
67
|
+
<selectedIonList count="1">
|
68
|
+
<cvParam cvRef="MS" accession="MS:1000744" name="selected ion m/z" value="2.0"/>
|
69
|
+
<cvParam cvRef="MS" accession="MS:1000041" name="charge state" value="2"/>
|
70
|
+
<cvParam cvRef="MS" accession="MS:1000042" name="peak intensity" value="5"/>
|
71
|
+
</selectedIonList>
|
72
|
+
</precursor>
|
73
|
+
</precursorList>
|
64
74
|
<binaryDataArrayList count="2">
|
65
75
|
<binaryDataArray encodedLength="28">
|
66
76
|
<cvParam cvRef="MS" accession="MS:1000523" name="64-bit float"/>
|