Class: Ms::Mascot::Dump::Mgf

Inherits:
Tap::Tasks::Dump
  • Object
show all
Defined in:
lib/ms/mascot/dump/mgf.rb

Overview

:startdoc::task dumps a fragment spectrum as mgf

Formats the data produced by an Ms::Mascot::Fragment task as an mgf. The configurations specify various details of the dump, including the precision and default headers.

% tap run -- fragment TVQQEL --: dump/mgf

:startdoc::task-

Examples:

# reformat an mgf file (inefficient but works)
% rap load/mgf --file OLD_FILE --:i dump/mgf --mz-precision 2 > NEW_FILE

Constant Summary collapse

HEADER_MAP =

Maps common variations of header keys (typically output by a fragment task) to Mgf::Entry header strings.

{:parent_ion_mass => 'PEPMASS'}

Instance Method Summary collapse

Instance Method Details

#dump(obj, io) ⇒ Object

Dumps the object to io as YAML.



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ms/mascot/dump/mgf.rb', line 37

def dump(obj, io)
  unless obj.kind_of?(Ms::Mascot::Mgf::Entry)
    data, headers = obj
    mgf_headers = format_headers(headers)
    obj = Ms::Mascot::Mgf::Entry.new(mgf_headers, data)
  end
  
  io << prefix if prefix
  obj.dump(io, config)
  io << suffix if suffix
end