mspire 0.6.26 → 0.7.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.
Files changed (132) hide show
  1. data/VERSION +1 -1
  2. data/lib/mspire.rb +1 -1
  3. data/lib/{ms → mspire}/cv.rb +1 -1
  4. data/lib/{ms → mspire}/cv/param.rb +5 -5
  5. data/lib/{ms → mspire}/cv/paramable.rb +5 -5
  6. data/lib/{ms → mspire}/digester.rb +2 -2
  7. data/lib/{ms → mspire}/error_rate/decoy.rb +1 -1
  8. data/lib/{ms → mspire}/error_rate/qvalue.rb +4 -4
  9. data/lib/{ms → mspire}/fasta.rb +5 -5
  10. data/lib/{ms → mspire}/ident.rb +10 -10
  11. data/lib/{ms → mspire}/ident/peptide.rb +3 -3
  12. data/lib/{ms → mspire}/ident/peptide/db.rb +12 -12
  13. data/lib/{ms → mspire}/ident/peptide_hit.rb +6 -6
  14. data/lib/{ms → mspire}/ident/peptide_hit/qvalue.rb +7 -7
  15. data/lib/{ms → mspire}/ident/pepxml.rb +7 -7
  16. data/lib/{ms → mspire}/ident/pepxml/modifications.rb +7 -7
  17. data/lib/{ms → mspire}/ident/pepxml/msms_pipeline_analysis.rb +6 -6
  18. data/lib/{ms → mspire}/ident/pepxml/msms_run_summary.rb +9 -9
  19. data/lib/{ms → mspire}/ident/pepxml/parameters.rb +1 -1
  20. data/lib/{ms → mspire}/ident/pepxml/sample_enzyme.rb +4 -4
  21. data/lib/{ms → mspire}/ident/pepxml/search_database.rb +5 -5
  22. data/lib/{ms → mspire}/ident/pepxml/search_hit.rb +4 -4
  23. data/lib/{ms → mspire}/ident/pepxml/search_hit/modification_info.rb +7 -7
  24. data/lib/{ms → mspire}/ident/pepxml/search_result.rb +5 -5
  25. data/lib/{ms → mspire}/ident/pepxml/search_summary.rb +12 -12
  26. data/lib/{ms → mspire}/ident/pepxml/spectrum_query.rb +7 -7
  27. data/lib/{ms → mspire}/ident/protein.rb +2 -2
  28. data/lib/{ms → mspire}/ident/protein_group.rb +2 -2
  29. data/lib/{ms → mspire}/ident/search.rb +1 -1
  30. data/lib/{ms → mspire}/isotope.rb +3 -3
  31. data/lib/{ms → mspire}/isotope/aa.rb +1 -1
  32. data/lib/{ms → mspire}/isotope/distribution.rb +17 -17
  33. data/lib/{ms → mspire}/isotope/nist_isotope_info.yml +0 -0
  34. data/lib/{ms → mspire}/mascot.rb +1 -1
  35. data/lib/{ms → mspire}/mass.rb +7 -7
  36. data/lib/{ms → mspire}/mass/aa.rb +6 -6
  37. data/lib/{ms → mspire}/molecular_formula.rb +7 -7
  38. data/lib/{ms → mspire}/mzml.rb +55 -55
  39. data/lib/{ms → mspire}/mzml/activation.rb +3 -3
  40. data/lib/{ms → mspire}/mzml/chromatogram.rb +3 -3
  41. data/lib/{ms → mspire}/mzml/chromatogram_list.rb +1 -1
  42. data/lib/{ms → mspire}/mzml/component.rb +5 -5
  43. data/lib/{ms → mspire}/mzml/contact.rb +3 -3
  44. data/lib/{ms → mspire}/mzml/cv.rb +1 -1
  45. data/lib/{ms → mspire}/mzml/data_array.rb +12 -12
  46. data/lib/{ms → mspire}/mzml/data_array_container_like.rb +7 -7
  47. data/lib/{ms → mspire}/mzml/data_processing.rb +3 -3
  48. data/lib/{ms → mspire}/mzml/file_content.rb +3 -3
  49. data/lib/{ms → mspire}/mzml/file_description.rb +4 -4
  50. data/lib/{ms → mspire}/mzml/index_list.rb +2 -2
  51. data/lib/{ms → mspire}/mzml/instrument_configuration.rb +7 -7
  52. data/lib/{ms → mspire}/mzml/isolation_window.rb +3 -3
  53. data/lib/{ms → mspire}/mzml/list.rb +1 -1
  54. data/lib/{ms → mspire}/mzml/plms1.rb +3 -3
  55. data/lib/{ms → mspire}/mzml/precursor.rb +6 -6
  56. data/lib/{ms → mspire}/mzml/processing_method.rb +3 -3
  57. data/lib/{ms → mspire}/mzml/product.rb +3 -3
  58. data/lib/{ms → mspire}/mzml/referenceable_param_group.rb +4 -4
  59. data/lib/{ms → mspire}/mzml/run.rb +3 -3
  60. data/lib/{ms → mspire}/mzml/sample.rb +5 -5
  61. data/lib/{ms → mspire}/mzml/scan.rb +4 -4
  62. data/lib/{ms → mspire}/mzml/scan_list.rb +3 -3
  63. data/lib/{ms → mspire}/mzml/scan_settings.rb +5 -5
  64. data/lib/{ms → mspire}/mzml/selected_ion.rb +5 -5
  65. data/lib/{ms → mspire}/mzml/software.rb +5 -5
  66. data/lib/{ms → mspire}/mzml/source_file.rb +5 -5
  67. data/lib/{ms → mspire}/mzml/spectrum.rb +33 -20
  68. data/lib/{ms → mspire}/mzml/spectrum_list.rb +4 -4
  69. data/lib/{ms → mspire}/obo.rb +1 -1
  70. data/lib/{ms → mspire}/peak.rb +3 -3
  71. data/lib/{ms → mspire}/peak/point.rb +1 -1
  72. data/lib/{ms → mspire}/plms1.rb +4 -4
  73. data/lib/{ms → mspire}/quant/qspec.rb +4 -4
  74. data/lib/{ms → mspire}/quant/qspec/protein_group_comparison.rb +4 -4
  75. data/lib/{ms → mspire}/spectrum.rb +6 -6
  76. data/lib/{ms → mspire}/spectrum/centroid.rb +1 -1
  77. data/lib/{ms → mspire}/spectrum_like.rb +5 -5
  78. data/lib/{ms → mspire}/user_param.rb +2 -2
  79. data/script/mzml_read_binary.rb +1 -1
  80. data/spec/{ms → mspire}/cv/param_spec.rb +6 -6
  81. data/spec/{ms → mspire}/digester_spec.rb +10 -10
  82. data/spec/{ms → mspire}/error_rate/qvalue_spec.rb +3 -3
  83. data/spec/{ms → mspire}/fasta_spec.rb +10 -10
  84. data/spec/{ms → mspire}/ident/peptide/db_spec.rb +9 -9
  85. data/spec/{ms → mspire}/ident/pepxml/sample_enzyme_spec.rb +10 -10
  86. data/spec/{ms → mspire}/ident/pepxml/search_hit/modification_info_spec.rb +4 -4
  87. data/spec/{ms → mspire}/ident/pepxml_spec.rb +22 -22
  88. data/spec/{ms → mspire}/ident/protein_group_spec.rb +4 -4
  89. data/spec/{ms → mspire}/isotope/aa_spec.rb +3 -3
  90. data/spec/{ms → mspire}/isotope/distribution_spec.rb +4 -4
  91. data/spec/{ms → mspire}/isotope_spec.rb +9 -9
  92. data/spec/{ms → mspire}/mass_spec.rb +8 -8
  93. data/spec/{ms → mspire}/molecular_formula_spec.rb +4 -4
  94. data/spec/{ms → mspire}/mzml/cv_spec.rb +4 -4
  95. data/spec/{ms → mspire}/mzml/data_array_spec.rb +7 -7
  96. data/spec/{ms → mspire}/mzml/file_content_spec.rb +4 -4
  97. data/spec/{ms → mspire}/mzml/file_description_spec.rb +4 -4
  98. data/spec/{ms → mspire}/mzml/index_list_spec.rb +13 -13
  99. data/spec/{ms → mspire}/mzml/plms1_spec.rb +8 -8
  100. data/spec/{ms → mspire}/mzml/referenceable_param_group_spec.rb +6 -6
  101. data/spec/{ms → mspire}/mzml_spec.rb +30 -30
  102. data/spec/{ms → mspire}/peak_spec.rb +10 -10
  103. data/spec/{ms → mspire}/plms1_spec.rb +7 -7
  104. data/spec/{ms → mspire}/quant/qspec_spec.rb +2 -2
  105. data/spec/{ms → mspire}/spectrum_spec.rb +8 -8
  106. data/spec/{ms → mspire}/user_param_spec.rb +8 -8
  107. data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.fasta +0 -0
  108. data/spec/testfiles/{ms → mspire}/ident/peptide/db/uni_11_sp_tr.msd_clvg2.min_aaseq4.yml +0 -0
  109. data/spec/testfiles/{ms → mspire}/mzml/j24z.idx_comp.3.mzML +0 -0
  110. data/spec/testfiles/{ms → mspire}/mzml/mspire_simulated.MSn.check.mzML +0 -0
  111. data/spec/testfiles/{ms → mspire}/mzml/openms.noidx_nocomp.12.mzML +0 -0
  112. data/spec/testfiles/{ms → mspire}/quant/kill_extra_tabs.rb +0 -0
  113. data/spec/testfiles/{ms → mspire}/quant/max_quant_output.provenance.txt +0 -0
  114. data/spec/testfiles/{ms → mspire}/quant/max_quant_output.txt +0 -0
  115. data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv +0 -0
  116. data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp +0 -0
  117. data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.killedextratabs.tsv_qspecgp.csv +0 -0
  118. data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt +0 -0
  119. data/spec/testfiles/{ms → mspire}/quant/pdcd5_final.txt_qspecgp +0 -0
  120. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.CSV.csv +0 -0
  121. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.csv +0 -0
  122. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.csv +0 -0
  123. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv +0 -0
  124. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp +0 -0
  125. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.oneprot.tsv_qspecgp.csv +0 -0
  126. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_qspec.txt +0 -0
  127. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt +0 -0
  128. data/spec/testfiles/{ms → mspire}/quant/pdcd5_lfq_tabdel.txt_qspecgp +0 -0
  129. data/spec/testfiles/{ms → mspire}/quant/remove_rest_of_proteins.rb +0 -0
  130. data/spec/testfiles/{ms → mspire}/quant/unlog_transform.rb +0 -0
  131. metadata +148 -194
  132. data/lib/ms.rb +0 -3
@@ -1,6 +1,6 @@
1
- require 'ms/mzml/list'
1
+ require 'mspire/mzml/list'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  class DataProcessing
6
6
 
@@ -21,7 +21,7 @@ module MS
21
21
  builder
22
22
  end
23
23
 
24
- extend(MS::Mzml::List)
24
+ extend(Mspire::Mzml::List)
25
25
  end
26
26
  end
27
27
  end
@@ -1,6 +1,6 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  # This summarizes the different types of spectra that can be expected in
6
6
  # the file. This is expected to aid processing software in skipping files
@@ -8,7 +8,7 @@ module MS
8
8
  # describe the nativeID format used in the file by referring to an
9
9
  # appropriate CV term.
10
10
  class FileContent
11
- include MS::CV::Paramable
11
+ include Mspire::CV::Paramable
12
12
 
13
13
  def to_xml(builder, &block)
14
14
  builder.fileContent do |fc_n|
@@ -1,8 +1,8 @@
1
- require 'ms/mzml/file_content'
2
- require 'ms/mzml/source_file'
3
- require 'ms/mzml/contact'
1
+ require 'mspire/mzml/file_content'
2
+ require 'mspire/mzml/source_file'
3
+ require 'mspire/mzml/contact'
4
4
 
5
- module MS
5
+ module Mspire
6
6
  class Mzml
7
7
  class FileDescription
8
8
 
@@ -1,4 +1,4 @@
1
- module MS
1
+ module Mspire
2
2
  class Mzml
3
3
  # A simple array of indices but #[] has been overloaded to find an index
4
4
  # by name
@@ -12,7 +12,7 @@ module MS
12
12
 
13
13
  # @param [Object] an Integer (index number) or a Symbol (:spectrum or
14
14
  # :chromatogram)
15
- # @return [MS::Mzml::Index] an index object
15
+ # @return [Mspire::Mzml::Index] an index object
16
16
  def [](int_or_symbol)
17
17
  if int_or_symbol.is_a?(Integer)
18
18
  old_bracket_slice(int_or_symbol)
@@ -1,11 +1,11 @@
1
- require 'ms/cv/paramable'
2
- require 'ms/mzml/component'
3
- require 'ms/mzml/list'
1
+ require 'mspire/cv/paramable'
2
+ require 'mspire/mzml/component'
3
+ require 'mspire/mzml/list'
4
4
 
5
- module MS
5
+ module Mspire
6
6
  class Mzml
7
7
  class InstrumentConfiguration
8
- include MS::CV::Paramable
8
+ include Mspire::CV::Paramable
9
9
 
10
10
  # (required) the id that this guy can be referenced from
11
11
  attr_accessor :id
@@ -25,13 +25,13 @@ module MS
25
25
  def to_xml(builder)
26
26
  builder.instrumentConfiguration(id: @id) do |inst_conf_n|
27
27
  super(builder)
28
- MS::Mzml::Component.list_xml(components, inst_conf_n)
28
+ Mspire::Mzml::Component.list_xml(components, inst_conf_n)
29
29
  inst_conf_n.softwareRef(ref: @software.id) if @software
30
30
  end
31
31
  builder
32
32
  end
33
33
 
34
- self.extend(MS::Mzml::List)
34
+ self.extend(Mspire::Mzml::List)
35
35
  end
36
36
  end
37
37
  end
@@ -1,6 +1,6 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
 
6
6
  # MUST supply a *child* term of MS:1000792 (isolation window attribute) one or more times
@@ -15,7 +15,7 @@ module MS
15
15
  # e.g.: MS:1000828 (isolation window lower offset)
16
16
  # e.g.: MS:1000829 (isolation window upper offset)
17
17
  class IsolationWindow
18
- include MS::CV::Paramable
18
+ include Mspire::CV::Paramable
19
19
  end
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
 
2
- module MS
2
+ module Mspire
3
3
  class Mzml
4
4
  # Methods for simple List objects (scanList, instrumentConfigurationList,
5
5
  # etc.)
@@ -1,7 +1,7 @@
1
1
 
2
- require 'ms/plms1'
2
+ require 'mspire/plms1'
3
3
 
4
- module MS
4
+ module Mspire
5
5
  class Mzml
6
6
  # will use scan numbers if use_scan_nums is true, otherwise it will use index
7
7
  # numbers in place of scan nums
@@ -28,7 +28,7 @@ module MS
28
28
  end
29
29
  # plms1 only requires that the obect respond to :each, giving a spectrum
30
30
  # object, so an Mzml object will work.
31
- MS::Plms1.new(scan_nums, retention_times, self)
31
+ Mspire::Plms1.new(scan_nums, retention_times, self)
32
32
  end
33
33
  end
34
34
  end
@@ -1,11 +1,11 @@
1
- require 'ms/mzml/list'
2
- require 'ms/mzml/selected_ion'
1
+ require 'mspire/mzml/list'
2
+ require 'mspire/mzml/selected_ion'
3
3
 
4
- module MS
4
+ module Mspire
5
5
  class Mzml
6
6
  # The method of precursor ion selection and activation
7
7
  class Precursor
8
- # (optional) the MS::Mzml::Spectrum object from which the precursor is
8
+ # (optional) the Mspire::Mzml::Spectrum object from which the precursor is
9
9
  # derived
10
10
  attr_accessor :spectrum
11
11
 
@@ -35,12 +35,12 @@ module MS
35
35
  end
36
36
  builder.precursor(atts) do |prec_n|
37
37
  @isolation_window.to_xml(prec_n) if @isolation_window
38
- MS::Mzml::SelectedIon.list_xml(@selected_ions, prec_n) if @selected_ions
38
+ Mspire::Mzml::SelectedIon.list_xml(@selected_ions, prec_n) if @selected_ions
39
39
  @activation.to_xml(prec_n) if @activation
40
40
  end
41
41
  end
42
42
 
43
- extend(MS::Mzml::List)
43
+ extend(Mspire::Mzml::List)
44
44
 
45
45
  end
46
46
  end
@@ -1,9 +1,9 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  class ProcessingMethod
6
- include MS::CV::Paramable
6
+ include Mspire::CV::Paramable
7
7
 
8
8
  attr_accessor :order, :software
9
9
 
@@ -1,6 +1,6 @@
1
- require 'ms/mzml/list'
1
+ require 'mspire/mzml/list'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  class Product
6
6
  attr_accessor :isolation_window
@@ -15,7 +15,7 @@ module MS
15
15
  end
16
16
  end
17
17
 
18
- extend(MS::Mzml::List)
18
+ extend(Mspire::Mzml::List)
19
19
  end
20
20
  end
21
21
  end
@@ -1,14 +1,14 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
 
6
6
  # need to call to_xml_definition (or use
7
- # MS::Mzml::ReferenceableParamGroupList.list_xml) to get the xml for the
7
+ # Mspire::Mzml::ReferenceableParamGroupList.list_xml) to get the xml for the
8
8
  # object itself (and not a reference). Merely callying #to_xml will
9
9
  # result in a referenceableParamGroupRef being created.
10
10
  class ReferenceableParamGroup
11
- include MS::CV::Paramable
11
+ include Mspire::CV::Paramable
12
12
 
13
13
  attr_accessor :id
14
14
 
@@ -1,9 +1,9 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  class Run
6
- include MS::CV::Paramable
6
+ include Mspire::CV::Paramable
7
7
 
8
8
  # required
9
9
  attr_accessor :default_instrument_configuration
@@ -1,10 +1,10 @@
1
- require 'ms/cv/paramable'
2
- require 'ms/mzml/list'
1
+ require 'mspire/cv/paramable'
2
+ require 'mspire/mzml/list'
3
3
 
4
- module MS
4
+ module Mspire
5
5
  class Mzml
6
6
  class Sample
7
- include MS::CV::Paramable
7
+ include Mspire::CV::Paramable
8
8
 
9
9
  attr_accessor :id, :name
10
10
 
@@ -21,7 +21,7 @@ module MS
21
21
  builder
22
22
  end
23
23
 
24
- extend(MS::Mzml::List)
24
+ extend(Mspire::Mzml::List)
25
25
  end
26
26
  end
27
27
  end
@@ -1,11 +1,11 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
  class Scan
6
- include MS::CV::Paramable
6
+ include Mspire::CV::Paramable
7
7
 
8
- # (optional) the MS::Mzml::Spectrum object from which the precursor is
8
+ # (optional) the Mspire::Mzml::Spectrum object from which the precursor is
9
9
  # derived. (the sourceFileRef is derived from this spectrum object if
10
10
  # from_external_source_file == true)
11
11
  attr_accessor :spectrum
@@ -1,6 +1,6 @@
1
- require 'ms/cv/paramable'
1
+ require 'mspire/cv/paramable'
2
2
 
3
- module MS
3
+ module Mspire
4
4
  class Mzml
5
5
 
6
6
  # MUST supply a *child* term of MS:1000570 (spectra combination) only once
@@ -10,7 +10,7 @@ module MS
10
10
  # e.g.: MS:1000575 (mean of spectra)
11
11
  # e.g.: MS:1000795 (no combination)
12
12
  class ScanList < Array
13
- include MS::CV::Paramable
13
+ include Mspire::CV::Paramable
14
14
 
15
15
  def initialize(opts={params: []}, &block)
16
16
  describe!(*opts[:params])
@@ -1,10 +1,10 @@
1
- require 'ms/mzml/list'
2
- require 'ms/cv/paramable'
1
+ require 'mspire/mzml/list'
2
+ require 'mspire/cv/paramable'
3
3
 
4
- module MS
4
+ module Mspire
5
5
  class Mzml
6
6
  class ScanSettings
7
- include MS::CV::Paramable
7
+ include Mspire::CV::Paramable
8
8
 
9
9
  attr_accessor :id
10
10
 
@@ -21,7 +21,7 @@ module MS
21
21
  builder
22
22
  end
23
23
 
24
- extend(MS::Mzml::List)
24
+ extend(Mspire::Mzml::List)
25
25
 
26
26
  end
27
27
  end
@@ -1,8 +1,8 @@
1
- require 'ms/mzml/list'
2
- require 'ms/cv/paramable'
1
+ require 'mspire/mzml/list'
2
+ require 'mspire/cv/paramable'
3
3
 
4
4
 
5
- module MS
5
+ module Mspire
6
6
  class Mzml
7
7
  # MUST supply a *child* term of MS:1000455 (ion selection attribute) one or more times
8
8
  #
@@ -11,8 +11,8 @@ module MS
11
11
  # e.g.: MS:1000633 (possible charge state)
12
12
  # e.g.: MS:1000744 (selected ion m/z)
13
13
  class SelectedIon
14
- include MS::CV::Paramable
15
- extend(MS::Mzml::List)
14
+ include Mspire::CV::Paramable
15
+ extend(Mspire::Mzml::List)
16
16
  end
17
17
  end
18
18
  end
@@ -1,11 +1,11 @@
1
1
  require 'mspire'
2
- require 'ms/mzml/list'
3
- require 'ms/cv/paramable'
2
+ require 'mspire/mzml/list'
3
+ require 'mspire/cv/paramable'
4
4
 
5
- module MS
5
+ module Mspire
6
6
  class Mzml
7
7
  class Software
8
- include MS::CV::Paramable
8
+ include Mspire::CV::Paramable
9
9
 
10
10
  attr_accessor :id, :version
11
11
 
@@ -22,7 +22,7 @@ module MS
22
22
  builder
23
23
  end
24
24
 
25
- extend(MS::Mzml::List)
25
+ extend(Mspire::Mzml::List)
26
26
  end
27
27
  end
28
28
  end
@@ -1,11 +1,11 @@
1
- require 'ms/cv/paramable'
2
- require 'ms/mzml/list'
1
+ require 'mspire/cv/paramable'
2
+ require 'mspire/mzml/list'
3
3
  require 'pathname'
4
4
 
5
- module MS
5
+ module Mspire
6
6
  class Mzml
7
7
  class SourceFile
8
- include MS::CV::Paramable
8
+ include Mspire::CV::Paramable
9
9
 
10
10
  DEFAULT_SOURCEFILE_ID = 'sourcefile1'
11
11
 
@@ -44,7 +44,7 @@ module MS
44
44
  builder
45
45
  end
46
46
 
47
- extend(MS::Mzml::List)
47
+ extend(Mspire::Mzml::List)
48
48
  end
49
49
  end
50
50
  end
@@ -1,11 +1,11 @@
1
- require 'ms/mzml/data_array_container_like'
2
- require 'ms/spectrum_like'
3
- require 'ms/mzml/data_array'
4
- require 'ms/mzml/scan_list'
5
- require 'ms/mzml/precursor'
6
- require 'ms/mzml/product'
7
-
8
- module MS
1
+ require 'mspire/mzml/data_array_container_like'
2
+ require 'mspire/spectrum_like'
3
+ require 'mspire/mzml/data_array'
4
+ require 'mspire/mzml/scan_list'
5
+ require 'mspire/mzml/precursor'
6
+ require 'mspire/mzml/product'
7
+
8
+ module Mspire
9
9
  class Mzml
10
10
 
11
11
  # MAY supply a *child* term of MS:1000465 (scan polarity) only once
@@ -39,10 +39,10 @@ module MS
39
39
  # e.g.: MS:1000796 (spectrum title)
40
40
  # et al.
41
41
  class Spectrum
42
- include MS::SpectrumLike
43
- include MS::Mzml::DataArrayContainerLike
42
+ include Mspire::SpectrumLike
43
+ include Mspire::Mzml::DataArrayContainerLike
44
44
 
45
- # (optional) an MS::Mzml::SourceFile object
45
+ # (optional) an Mspire::Mzml::SourceFile object
46
46
  attr_accessor :source_file
47
47
 
48
48
  # (optional) The identifier for the spot from which this spectrum was derived, if a
@@ -64,13 +64,14 @@ module MS
64
64
  # currently being described, ordered.
65
65
  attr_accessor :products
66
66
 
67
+ # retention time in seconds
67
68
  attr_accessor :retention_time
68
69
  # when properly implemented, this will access the first scan and the
69
70
  # 'scan start time' cv element.
70
71
 
71
72
  # takes a Nokogiri node and sets relevant properties
72
73
  def self.from_xml(xml)
73
- spec = MS::Mzml::Spectrum.new(xml[:id])
74
+ spec = Mspire::Mzml::Spectrum.new(xml[:id])
74
75
 
75
76
  params = {}
76
77
  xml.xpath("./cvParam").each do |cvparam|
@@ -84,27 +85,39 @@ module MS
84
85
  # this is a quick hack to get retention time, implement fully as shown
85
86
  # below!
86
87
  cv_param = xml.xpath("./scanList/scan/cvParam[@accession='MS:1000016']").first
87
- retention_time = cv_param && cv_param['value'].to_f
88
+ if cv_param
89
+ retention_time = cv_param['value'].to_f
90
+ units = cv_param['unitAccession']
91
+ multiplier =
92
+ case units
93
+ when 'UO:0000010' ; 1 # second
94
+ when 'UO:0000031' ; 60 # minute
95
+ when 'UO:0000032' ; 3600 # hour
96
+ when 'UO:0000028' ; 0.001 # millisecond
97
+ else raise 'unsupported units'
98
+ end
99
+ retention_time *= multiplier
100
+ end
88
101
 
89
102
  # this is roughly how the scan list stuff should be implemented:
90
103
  =begin
91
- sl_obj = MS::Mzml::ScanList.new
104
+ sl_obj = Mspire::Mzml::ScanList.new
92
105
 
93
106
  # TODO: need to slot in all the other info in reasonable ways
94
107
  # TODO: need to make sure we deal with referencable params
95
108
  scan_list = xml.xpath('.scanList/scan').each do |scan_n|
96
- sl_obj << MS::Mzml::Scan.from_xml(scan_n)
109
+ sl_obj << Mspire::Mzml::Scan.from_xml(scan_n)
97
110
  end
98
111
  =end
99
112
 
100
113
  data_arrays = xml.xpath('./binaryDataArrayList/binaryDataArray').map do |binary_data_array_n|
101
114
  accessions = binary_data_array_n.xpath('./cvParam').map {|node| node['accession'] }
102
115
  base64 = binary_data_array_n.xpath('./binary').text
103
- MS::Mzml::DataArray.from_binary(base64, accessions)
116
+ Mspire::Mzml::DataArray.from_binary(base64, accessions)
104
117
  end
105
118
  # if there is no spectrum, we will still return a spectrum object, it
106
119
  # just has no mzs or intensities
107
- data_arrays = [MS::Mzml::DataArray.new, MS::Mzml::DataArray.new] if data_arrays.size == 0
120
+ data_arrays = [Mspire::Mzml::DataArray.new, Mspire::Mzml::DataArray.new] if data_arrays.size == 0
108
121
  spec.data_arrays = data_arrays
109
122
  spec.retention_time = retention_time
110
123
  spec
@@ -114,7 +127,7 @@ module MS
114
127
  #
115
128
  # This would generate a spectrum of ms_level=2 :
116
129
  #
117
- # MS::Mzml::Spectrum.new(0, "scan=1", 'MS:1000511')
130
+ # Mspire::Mzml::Spectrum.new(0, "scan=1", 'MS:1000511')
118
131
  #
119
132
  def initialize(id, opts={params: []}, &block)
120
133
  @id = id
@@ -130,8 +143,8 @@ module MS
130
143
  atts[:spotID] = @spot_id if @spot_id
131
144
  super(builder, atts) do |node|
132
145
  @scan_list.list_xml( node ) if @scan_list
133
- MS::Mzml::Precursor.list_xml(@precursors, node) if @precursors
134
- MS::Mzml::Product.list_xml(@products, node) if @products
146
+ Mspire::Mzml::Precursor.list_xml(@precursors, node) if @precursors
147
+ Mspire::Mzml::Product.list_xml(@products, node) if @products
135
148
  end
136
149
  end
137
150