Sha256: b9ed0910cf522fa8c23d44fc060fe5d5b81885954378142913e9aa024f6d3e4d
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
#!/usr/bin/ruby require 'spec/mzxml/parser' require 'optparse' require 'ostruct' require 'lmat' # defaults: opt = {} opt[:baseline] = 0.0 opt[:newext] = ".lmat" opt[:inc_mz] = 1.0 # get options: opts = OptionParser.new do |op| op.banner = "usage: #{File.basename(__FILE__)} [options] file.mzXML ..." op.separator "" op.separator "(sums m/z values that round to the same bin)" op.separator "" op.on("--mz_inc N", Float, "m/z increment (def: 1.0)") {|n| opt[:mz_inc] = n.to_f} op.on("--mz_start N", Float, "m/z start (def: start of 1st full scan)") {|n| opt[:start_mz] = n.to_f} op.on("--mz_end N", Float, "m/z end (def: end of 1st full scan)") {|n| opt[:end_mz] = n.to_f} op.on("--baseline N", Float, "value for missing indices (def: #{opt[:baseline]})") {|n| opt[:baseline] = n.to_f} op.on("--ascii", "generates an lmata file instead") {opt[:ascii] = true} op.on("-v", "--verbose") {$VERBOSE = true} end opts.parse! if ARGV.size < 1 puts opts end ARGV.each do |file| parser = Spec::MzXML::Parser.new (start_mz, end_mz) = parser.start_and_end_mz(file) (times, spectra) = parser.times_and_spectra(file) times.map! do |tm| tm.to_f end args = { :start_mz => start_mz, :end_mz => end_mz, :start_tm => times.first, :end_tm => times.last, :inc_tm => nil, } args.merge!(opt) lmat = LMat.new.from_raw_spectra(times, spectra, args) outfile = file.sub(/\.mzXML$/, opt[:newext]) if args[:ascii] outfile << "a" lmat.print(outfile) else lmat.write(outfile) end puts("OUTPUT: #{outfile}") if $VERBOSE end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mspire-0.2.0 | bin/mzxml_to_lmat.rb |
mspire-0.2.1 | bin/mzxml_to_lmat.rb |
mspire-0.2.2 | bin/mzxml_to_lmat.rb |
mspire-0.2.4 | bin/mzxml_to_lmat.rb |