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,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/mass'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
module Mass
|
5
5
|
module AA
|
6
6
|
# amino_acids keys as strings, average masses
|
@@ -69,11 +69,11 @@ module MS
|
|
69
69
|
AVG_SYM = Hash[AVG_STRING.map {|aa,mass| [aa.to_sym, mass] } ]
|
70
70
|
|
71
71
|
# Monoisotopic amino acid masses keyed as symbols and also strings (all
|
72
|
-
# upper case). Also includes
|
73
|
-
MONO = MONO_SYM.merge(MONO_STRING).merge(
|
72
|
+
# upper case). Also includes Mspire::Mass::MONO for things like protons ('h+')
|
73
|
+
MONO = MONO_SYM.merge(MONO_STRING).merge(Mspire::Mass::MONO)
|
74
74
|
# Average amino acid masses keyed as symbols and also strings (all
|
75
|
-
# uppder case). Also includes
|
76
|
-
AVG = AVG_SYM.merge(AVG_STRING).merge(
|
75
|
+
# uppder case). Also includes Mspire::Mass::AVG for things like protons ('h+')
|
76
|
+
AVG = AVG_SYM.merge(AVG_STRING).merge(Mspire::Mass::AVG)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
1
|
+
require 'mspire/isotope'
|
2
|
+
require 'mspire/isotope/aa'
|
3
|
+
require 'mspire/mass'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Mspire
|
6
6
|
class MolecularFormula < Hash
|
7
7
|
|
8
8
|
# integer desribing the charge state
|
@@ -25,7 +25,7 @@ module MS
|
|
25
25
|
|
26
26
|
def self.from_aaseq(aaseq)
|
27
27
|
hash = aaseq.each_char.inject({}) do |hash,aa|
|
28
|
-
hash.merge(
|
28
|
+
hash.merge(Mspire::Isotope::AA::ATOM_COUNTS[aa]) {|h,o,n| (o ? o : 0) +n }
|
29
29
|
end
|
30
30
|
hash[:h] += 2
|
31
31
|
hash[:o] += 1
|
@@ -34,8 +34,8 @@ module MS
|
|
34
34
|
|
35
35
|
# gives the monoisotopic mass adjusted by the current charge
|
36
36
|
def mass
|
37
|
-
mss = inject(0.0) {|sum,(el,cnt)| sum + (
|
38
|
-
mss - (
|
37
|
+
mss = inject(0.0) {|sum,(el,cnt)| sum + (Mspire::Mass::MONO[el]*cnt) }
|
38
|
+
mss - (Mspire::Mass::ELECTRON * charge)
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
data/lib/{ms → mspire}/mzml.rb
RENAMED
@@ -3,28 +3,28 @@ require 'builder'
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'io/bookmark'
|
5
5
|
require 'zlib'
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
require '
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
require '
|
18
|
-
require '
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
require '
|
23
|
-
|
24
|
-
module
|
6
|
+
require 'mspire/mzml/index_list'
|
7
|
+
require 'mspire/mzml/spectrum'
|
8
|
+
require 'mspire/mzml/file_description'
|
9
|
+
require 'mspire/mzml/software'
|
10
|
+
require 'mspire/mzml/scan_list'
|
11
|
+
require 'mspire/mzml/selected_ion'
|
12
|
+
require 'mspire/mzml/scan'
|
13
|
+
require 'mspire/mzml/scan_settings'
|
14
|
+
require 'mspire/mzml/processing_method'
|
15
|
+
require 'mspire/mzml/run'
|
16
|
+
require 'mspire/mzml/spectrum_list'
|
17
|
+
require 'mspire/mzml/chromatogram_list'
|
18
|
+
require 'mspire/mzml/instrument_configuration'
|
19
|
+
require 'mspire/mzml/data_processing'
|
20
|
+
require 'mspire/mzml/referenceable_param_group'
|
21
|
+
require 'mspire/mzml/cv'
|
22
|
+
require 'mspire/mzml/sample'
|
23
|
+
|
24
|
+
module Mspire
|
25
25
|
# Reading an mzxml file:
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Mspire::Mzml.open("somefile.mzML") do |mzml|
|
28
28
|
# mzml.each do |spectrum|
|
29
29
|
# scan = spectrum.scan
|
30
30
|
# spectrum.mzs # array of m/zs
|
@@ -42,10 +42,10 @@ module MS
|
|
42
42
|
#
|
43
43
|
# Writing an mzml file from scratch:
|
44
44
|
#
|
45
|
-
# spec1 =
|
45
|
+
# spec1 = Mspire::Mzml::Spectrum.new('scan=1', params: ['MS:1000127', ['MS:1000511', 1]]) do |spec|
|
46
46
|
# spec.data_arrays = [[1,2,3], [4,5,6]]
|
47
|
-
# spec.scan_list =
|
48
|
-
# scan =
|
47
|
+
# spec.scan_list = Mspire::Mzml::ScanList.new do |sl|
|
48
|
+
# scan = Mspire::Mzml::Scan.new do |scan|
|
49
49
|
# # retention time of 40 seconds
|
50
50
|
# scan.describe! ['MS:1000016', 40.0, 'UO:0000010']
|
51
51
|
# end
|
@@ -53,21 +53,21 @@ module MS
|
|
53
53
|
# end
|
54
54
|
# end
|
55
55
|
#
|
56
|
-
# mzml =
|
56
|
+
# mzml = Mspire::Mzml.new do |mzml|
|
57
57
|
# mzml.id = 'the_little_example'
|
58
|
-
# mzml.cvs =
|
59
|
-
# mzml.file_description =
|
60
|
-
# fd.file_content =
|
61
|
-
# fd.source_files <<
|
58
|
+
# mzml.cvs = Mspire::Mzml::CV::DEFAULT_CVS
|
59
|
+
# mzml.file_description = Mspire::Mzml::FileDescription.new do |fd|
|
60
|
+
# fd.file_content = Mspire::Mzml::FileContent.new
|
61
|
+
# fd.source_files << Mspire::Mzml::SourceFile.new
|
62
62
|
# end
|
63
|
-
# default_instrument_config =
|
63
|
+
# default_instrument_config = Mspire::Mzml::InstrumentConfiguration.new("IC",[], params: ['MS:1000031'])
|
64
64
|
# mzml.instrument_configurations << default_instrument_config
|
65
|
-
# software =
|
65
|
+
# software = Mspire::Mzml::Software.new
|
66
66
|
# mzml.software_list << software
|
67
|
-
# default_data_processing =
|
67
|
+
# default_data_processing = Mspire::Mzml::DataProcessing.new("did_nothing")
|
68
68
|
# mzml.data_processing_list << default_data_processing
|
69
|
-
# mzml.run =
|
70
|
-
# spectrum_list =
|
69
|
+
# mzml.run = Mspire::Mzml::Run.new("little_run", default_instrument_config) do |run|
|
70
|
+
# spectrum_list = Mspire::Mzml::SpectrumList.new(default_data_processing)
|
71
71
|
# spectrum_list.push(spec1)
|
72
72
|
# run.spectrum_list = spectrum_list
|
73
73
|
# end
|
@@ -101,31 +101,31 @@ module MS
|
|
101
101
|
# SUBELEMENTS
|
102
102
|
###############################################
|
103
103
|
|
104
|
-
# (required) an array of
|
104
|
+
# (required) an array of Mspire::Mzml::CV objects
|
105
105
|
attr_accessor :cvs
|
106
106
|
|
107
|
-
# (required) an
|
107
|
+
# (required) an Mspire::Mzml::FileDescription
|
108
108
|
attr_accessor :file_description
|
109
109
|
|
110
110
|
# (optional) an array of CV::ReferenceableParamGroup objects
|
111
111
|
attr_accessor :referenceable_param_groups
|
112
112
|
|
113
|
-
# (optional) an array of
|
113
|
+
# (optional) an array of Mspire::Mzml::Sample objects
|
114
114
|
attr_accessor :samples
|
115
115
|
|
116
|
-
# (required) an array of
|
116
|
+
# (required) an array of Mspire::Mzml::Software objects
|
117
117
|
attr_accessor :software_list
|
118
118
|
|
119
|
-
# (optional) an array of
|
119
|
+
# (optional) an array of Mspire::Mzml::ScanSettings objects
|
120
120
|
attr_accessor :scan_settings_list
|
121
121
|
|
122
|
-
# (required) an array of
|
122
|
+
# (required) an array of Mspire::Mzml::InstrumentConfiguration objects
|
123
123
|
attr_accessor :instrument_configurations
|
124
124
|
|
125
|
-
# (required) an array of
|
125
|
+
# (required) an array of Mspire::Mzml::DataProcessing objects
|
126
126
|
attr_accessor :data_processing_list
|
127
127
|
|
128
|
-
# (required) an
|
128
|
+
# (required) an Mspire::Mzml::Run object
|
129
129
|
attr_accessor :run
|
130
130
|
|
131
131
|
module Parser
|
@@ -219,11 +219,11 @@ module MS
|
|
219
219
|
end
|
220
220
|
|
221
221
|
# @param [Object] arg an index number (Integer) or id string (String)
|
222
|
-
# @return [
|
222
|
+
# @return [Mspire::Spectrum] a spectrum object
|
223
223
|
def spectrum(arg)
|
224
224
|
start_byte = index_list[0].start_byte(arg)
|
225
225
|
spec_n = spectrum_node_from_start_byte(start_byte)
|
226
|
-
|
226
|
+
Mspire::Mzml::Spectrum.from_xml(spec_n)
|
227
227
|
end
|
228
228
|
|
229
229
|
# returns the number of spectra
|
@@ -234,7 +234,7 @@ module MS
|
|
234
234
|
alias_method :'[]', :spectrum
|
235
235
|
|
236
236
|
# @param [Integer] scan_num the scan number
|
237
|
-
# @return [
|
237
|
+
# @return [Mspire::Spectrum] a spectrum object, or nil if not found
|
238
238
|
# @raise [ScanNumbersNotUnique] if scan numbers are not unique
|
239
239
|
# @raise [ScanNumbersNotFound] if spectra exist but scan numbers were not
|
240
240
|
# found
|
@@ -245,10 +245,10 @@ module MS
|
|
245
245
|
spectrum(@scan_to_index[scan_num])
|
246
246
|
end
|
247
247
|
|
248
|
-
# @return [
|
248
|
+
# @return [Mspire::Mzml::IndexList] or nil if there is no indexList in the
|
249
249
|
# mzML
|
250
250
|
def read_index_list
|
251
|
-
if offset=
|
251
|
+
if offset=Mspire::Mzml::Index.index_offset(@io)
|
252
252
|
@io.seek(offset)
|
253
253
|
xml = Nokogiri::XML.parse(@io.read, nil, @encoding, Parser::NOBLANKS)
|
254
254
|
index_list = xml.root
|
@@ -269,7 +269,7 @@ module MS
|
|
269
269
|
end
|
270
270
|
end
|
271
271
|
# Reads through and captures start bytes
|
272
|
-
# @return [
|
272
|
+
# @return [Mspire::Mzml::IndexList]
|
273
273
|
def create_index_list
|
274
274
|
indices_hash = @io.bookmark(true) do |inner_io| # sets to beginning of file
|
275
275
|
indices = {:spectrum => {}, :chromatogram => {}}
|
@@ -316,21 +316,21 @@ module MS
|
|
316
316
|
|
317
317
|
xml.mzML(mzml_atts) do |mzml_n|
|
318
318
|
# the 'if' statements capture whether or not the list is required or not
|
319
|
-
raise "#{self.class}#cvs must have > 0
|
320
|
-
|
319
|
+
raise "#{self.class}#cvs must have > 0 Mspire::Mzml::CV objects" unless @cvs.size > 0
|
320
|
+
Mspire::Mzml::CV.list_xml(@cvs, mzml_n)
|
321
321
|
@file_description.to_xml(mzml_n)
|
322
322
|
if @referenceable_param_groups
|
323
|
-
|
323
|
+
Mspire::Mzml::ReferenceableParamGroup.list_xml(@referenceable_param_groups, mzml_n)
|
324
324
|
end
|
325
325
|
if @samples
|
326
|
-
|
326
|
+
Mspire::Mzml::Sample.list_xml(@samples, mzml_n)
|
327
327
|
end
|
328
|
-
|
328
|
+
Mspire::Mzml::Software.list_xml(@software_list, mzml_n)
|
329
329
|
if @scan_settings_list && @scan_settings_list.size > 0
|
330
|
-
|
330
|
+
Mspire::Mzml::ScanSettings.list_xml(@scan_settings_list, mzml_n)
|
331
331
|
end
|
332
|
-
icl =
|
333
|
-
|
332
|
+
icl = Mspire::Mzml::InstrumentConfiguration.list_xml(@instrument_configurations, mzml_n)
|
333
|
+
Mspire::Mzml::DataProcessing.list_xml(@data_processing_list, mzml_n)
|
334
334
|
@run.to_xml(mzml_n)
|
335
335
|
end
|
336
336
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/cv/paramable'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
class Mzml
|
5
5
|
|
6
6
|
# MAY supply a *child* term of MS:1000510 (precursor activation attribute) one or more times
|
@@ -27,7 +27,7 @@ module MS
|
|
27
27
|
# e.g.: MS:1000433 (low-energy collision-induced dissociation)
|
28
28
|
# et al.
|
29
29
|
class Activation
|
30
|
-
include
|
30
|
+
include Mspire::CV::Paramable
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/mzml/data_array_container_like'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
class Mzml
|
5
5
|
class Chromatogram
|
6
|
-
include
|
6
|
+
include Mspire::Mzml::DataArrayContainerLike
|
7
7
|
|
8
8
|
# (optional) precursor isolations to the chromatogram currently being
|
9
9
|
# described
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'mspire/cv/paramable'
|
2
|
+
require 'mspire/mzml/list'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Mspire
|
5
5
|
class Mzml
|
6
6
|
module Component
|
7
|
-
include
|
7
|
+
include Mspire::CV::Paramable
|
8
8
|
|
9
9
|
attr_accessor :order
|
10
10
|
|
@@ -15,7 +15,7 @@ module MS
|
|
15
15
|
builder
|
16
16
|
end
|
17
17
|
|
18
|
-
extend(
|
18
|
+
extend(Mspire::Mzml::List)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'mspire/cv/paramable'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Mspire
|
4
4
|
class Mzml
|
5
5
|
class Contact
|
6
6
|
|
@@ -11,7 +11,7 @@ module MS
|
|
11
11
|
email: 'MS:1000589'
|
12
12
|
}
|
13
13
|
|
14
|
-
include
|
14
|
+
include Mspire::CV::Paramable
|
15
15
|
|
16
16
|
def to_xml(builder)
|
17
17
|
builder.contact do |fc_n|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'base64'
|
2
2
|
require 'zlib'
|
3
|
-
require '
|
3
|
+
require 'mspire/cv/paramable'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Mspire
|
6
6
|
class Mzml
|
7
7
|
class DataArray < Array
|
8
8
|
alias_method :array_initialize, :initialize
|
9
|
-
include
|
9
|
+
include Mspire::CV::Paramable
|
10
10
|
|
11
11
|
DEFAULT_DTYPE = :float64
|
12
12
|
DEFAULT_COMPRESSION = true
|
@@ -25,16 +25,16 @@ module MS
|
|
25
25
|
array_initialize(*args)
|
26
26
|
end
|
27
27
|
|
28
|
-
# returns a new
|
28
|
+
# returns a new Mspire::Mzml::DataArray object (an array)
|
29
29
|
#
|
30
30
|
# args:
|
31
31
|
# base64, set-like # where set-like responds to include?
|
32
32
|
# base64, type=:float64, compression=true
|
33
33
|
#
|
34
34
|
# examples:
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
35
|
+
# Mspire::Mzml::Spectrum.unpack_binary('eJxjYACBD/YMEOAAoTgcABe3Abg=', ['MS:1000574', MS:1000523']).
|
36
|
+
# Mspire::Mzml::Spectrum.unpack_binary("ADBA/=", :float32, true)
|
37
|
+
# Mspire::Mzml::Spectrum.unpack_binary("ADBA/=") # uses float64 and compression
|
38
38
|
def self.from_binary(base64, *args)
|
39
39
|
if args.first.respond_to?(:include?)
|
40
40
|
accessions = args.first
|
@@ -119,11 +119,11 @@ module MS
|
|
119
119
|
builder.binaryDataArray(encodedLength: encoded_length) do |bda_n|
|
120
120
|
@params.each {|param| param.to_xml(bda_n) } if @params
|
121
121
|
unless @external
|
122
|
-
|
123
|
-
|
122
|
+
Mspire::CV::Param[ DTYPE_TO_ACC[dtype] ].to_xml(bda_n)
|
123
|
+
Mspire::CV::Param[ compression ? 'MS:1000574' : 'MS:1000576' ].to_xml(bda_n)
|
124
124
|
if @type
|
125
125
|
accession = ( (@type == :mz) ? 'MS:1000514' : 'MS:1000515' )
|
126
|
-
|
126
|
+
Mspire::CV::Param[accession].to_xml(bda_n)
|
127
127
|
bda_n.binary(base64)
|
128
128
|
end
|
129
129
|
end
|
@@ -135,10 +135,10 @@ module MS
|
|
135
135
|
builder.binaryDataArrayList(count: arrays.size) do |bdal_n|
|
136
136
|
arrays.zip([:mz, :intensity]) do |data_ar, typ|
|
137
137
|
ar =
|
138
|
-
if data_ar.is_a?(
|
138
|
+
if data_ar.is_a?(Mspire::Mzml::DataArray)
|
139
139
|
data_ar
|
140
140
|
else
|
141
|
-
real_data_array =
|
141
|
+
real_data_array = Mspire::Mzml::DataArray.new(data_ar)
|
142
142
|
real_data_array.type = typ
|
143
143
|
real_data_array
|
144
144
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'mspire/cv/paramable'
|
2
|
+
require 'mspire/mzml/data_array'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Mspire
|
5
5
|
class Mzml
|
6
6
|
module DataArrayContainerLike
|
7
|
-
include
|
7
|
+
include Mspire::CV::Paramable
|
8
8
|
|
9
9
|
###########################################
|
10
10
|
# ATTRIBUTES
|
@@ -16,14 +16,14 @@ module MS
|
|
16
16
|
# (required [at xml write time]) the index in the spectrum list
|
17
17
|
attr_accessor :index
|
18
18
|
|
19
|
-
# (optional) an
|
19
|
+
# (optional) an Mspire::Mzml::DataProcessing object
|
20
20
|
attr_accessor :data_processing
|
21
21
|
|
22
22
|
###########################################
|
23
23
|
# SUBELEMENTS
|
24
24
|
###########################################
|
25
25
|
|
26
|
-
# (optional) an array of
|
26
|
+
# (optional) an array of Mspire::Mzml::DataArray
|
27
27
|
attr_accessor :data_arrays
|
28
28
|
|
29
29
|
def initialize(id, opts={params: []})
|
@@ -55,7 +55,7 @@ module MS
|
|
55
55
|
builder.spectrum(atts) do |sp_n|
|
56
56
|
super(sp_n) # params
|
57
57
|
block.call(sp_n) if block
|
58
|
-
|
58
|
+
Mspire::Mzml::DataArray.list_xml(@data_arrays, sp_n) if @data_arrays
|
59
59
|
end
|
60
60
|
builder
|
61
61
|
end
|