Class: Bio::Assembly::Ace

Inherits:
Bio::Assembly show all
Defined in:
lib/bio-assembly/ace.rb

Defined Under Namespace

Classes: Contig, Read

Instance Method Summary collapse

Methods inherited from Bio::Assembly

open, register_parser

Constructor Details

#initialize(path) ⇒ Ace

Returns a new instance of Ace.



10
11
12
13
# File 'lib/bio-assembly/ace.rb', line 10

def initialize(path)
  @file = File.new(path, 'r') 
  parse_as
end

Instance Method Details

#each_contigObject



15
16
17
18
19
20
21
# File 'lib/bio-assembly/ace.rb', line 15

def each_contig
    each_identifier do |identifier, attrs|
      next unless identifier == 'CO'
      contig = parse_contig(attrs)
      yield(contig)   
    end
end

#to_aceObject



23
24
25
26
27
28
# File 'lib/bio-assembly/ace.rb', line 23

def to_ace
  ace = ""
  ace += "AS " + num_contigs.to_s + " " + num_reads.to_s + "\n\n"
  each_contig { |contig| ace += contig.to_ace + "\n" }
  ace
end