Class: Ms::Mascot::Load::Mgf
- Inherits:
-
Tap::Tasks::Load
- Object
- Tap::Tasks::Load
- Ms::Mascot::Load::Mgf
- Defined in:
- lib/ms/mascot/load/mgf.rb
Overview
:startdoc::task loads entries from an mgf file
Load entries from an mgf file. A selector may be specified to select only a subset of entries; by default all entries in the mgf file are returned.
% tap run -- mgf/load --select 1 < MGF_FILE
% tap run -- mgf/load --select 1..10 < MGF_FILE
Entries are always returned as an array, even when the selecton is for a single entry.
Constant Summary collapse
- Archive =
Ms::Mascot::Mgf::Archive
Instance Method Summary collapse
Instance Method Details
#load(arc) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ms/mascot/load/mgf.rb', line 63 def load(arc) case select when Integer entry = arc[select] filter.ok?(entry) ? [entry] : [] when Range filter.filter!(arc[select]) when Array filter.filter!(arc[*select]) when nil arc.select {|entry| filter.ok?(entry) } end end |
#open_io(input) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ms/mascot/load/mgf.rb', line 50 def open_io(input) if input.kind_of?(String) Archive.open(input) {|io| yield(io) } else super(input) do |io| arc = Archive.new(io) result = yield(arc) arc.close result end end end |