Class: ConvertUtil
- Inherits:
-
Object
- Object
- ConvertUtil
- Defined in:
- lib/protk/convert_util.rb
Class Method Summary collapse
- .ensure_mzml_indexed(run_file) ⇒ Object
- .index_mzml(mzml_file) ⇒ Object
- .unindexed_mzml?(mzml_file) ⇒ Boolean
Class Method Details
.ensure_mzml_indexed(run_file) ⇒ Object
6 7 8 9 10 |
# File 'lib/protk/convert_util.rb', line 6 def self.ensure_mzml_indexed(run_file) if unindexed_mzml?(run_file) index_mzml(run_file) end end |
.index_mzml(mzml_file) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/protk/convert_util.rb', line 12 def self.index_mzml(mzml_file) Dir.mktmpdir do |tmpdir| genv=Constants.instance %x["#{genv.msconvert} -o #{tmpdir} #{mzml_file}"] indexed_file = Dir["#{tmpdir}/*"][0] FileUtils.mv(indexed_file, mzml_file) end end |
.unindexed_mzml?(mzml_file) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/protk/convert_util.rb', line 21 def self.unindexed_mzml?(mzml_file) reader = LibXML::XML::Reader.file(mzml_file) reader.read reader.name == "mzML" end |