Class: Bio::Assembly::Caf
- Inherits:
-
Bio::Assembly
- Object
- Bio::Assembly
- Bio::Assembly::Caf
- Defined in:
- lib/bio-assembly/caf.rb
Defined Under Namespace
Instance Method Summary collapse
-
#each_contig ⇒ Object
iterator that return one contig at a time.
-
#initialize(path) ⇒ Caf
constructor
A new instance of Caf.
Methods inherited from Bio::Assembly
Constructor Details
#initialize(path) ⇒ Caf
Returns a new instance of Caf.
8 9 10 |
# File 'lib/bio-assembly/caf.rb', line 8 def initialize(path) @file = File.new(path, 'r') end |
Instance Method Details
#each_contig ⇒ Object
iterator that return one contig at a time
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bio-assembly/caf.rb', line 12 def each_contig contig = Contig.new feature = Hash.new @file.each do |line| feature = parse_blocks(line,feature) # search the file for CAF blocks like DNA and Sequence if feature[:type] == :read and feature[:parsed] read = convert_to_read(feature) contig.add_read(read) feature = Hash.new elsif feature[:type] == :contig and feature[:parsed] contig = convert_to_contig(contig,feature) yield contig contig = Contig.new feature = Hash.new end end end |