bin/mzML2mgf.rb in mzml-0.2.0 vs bin/mzML2mgf.rb in mzml-0.2.2
- old
+ new
@@ -19,35 +19,20 @@
#now loop through each spectrum.. sort first to be the same as msconvert
sorted_keys = mzml.parse_index_list[:spectrum].keys.sort{ |x,y| x.split('=')[3].to_i <=> y.split('=')[3].to_i }
sorted_keys.each do |k|
-
s = mzml.spectrum(k)
unless s.precursor_list.nil? || s.precursor_list.empty?
-
-
- #now we print!
-
puts "BEGIN IONS"
puts "TITLE=#{s.id}"
puts "RTINSECONDS=#{s.retention_time}"
puts "PEPMASS=#{s.precursor_mass} #{s.precursor_intensity}"
-
0.upto(s.mz.length-1) do |i|
-
- puts "#{sprintf('%5.7f', s.mz[i])} #{sprintf('%4.9f', s.intensity[i])}"
-
+ puts "#{sprintf('%0.7f', s.mz[i]).to_f} #{sprintf('%0.2f', s.intensity[i]).to_f}"
end
-
-
puts "END IONS"
-
-
end
-
-
-
end