Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed the @contigs array within the parser to lower memory usage

  • Loading branch information...
commit 0179d2a5d5e4413c65cec32f50cf20f87fb58711 1 parent 747d1a4
@fstrozzi fstrozzi authored
Showing with 2 additions and 20 deletions.
  1. +2 −13 lib/bio-assembly.rb
  2. +0 −7 lib/bio-assembly/ace.rb
View
15 lib/bio-assembly.rb
@@ -5,11 +5,10 @@
module Bio
class Assembly
- attr_accessor :contigs
-
+
@@formats = { }
- def self.create(path, format)
+ def self.open(path, format)
streamer = @@formats[format]
if streamer
streamer.new(path)
@@ -22,21 +21,11 @@ def self.register_parser name
@@formats[name] = self
end
- def contigs
- # use each_contig to stream large files
- parse_whole_file if @contigs.empty?
- @contigs
- end
-
def each_contig
# implemented by each format subclass
end
private
-
- def num_contigs
- contigs.size
- end
def num_reads
read_num = 0
View
7 lib/bio-assembly/ace.rb
@@ -9,22 +9,15 @@ class Ace < Bio::Assembly
def initialize(path)
@file = File.new(path, 'r')
- @contigs = Array.new
parse_as
end
def each_contig
- # check if file is already parsed
- if @total_num_contigs.to_i == @contigs.size
- @contigs.each{ |contig| yield contig }
- else
each_identifier do |identifier, attrs|
next unless identifier == 'CO'
contig = parse_contig(attrs)
- @contigs.push contig
yield(contig)
end
- end
end
def to_ace
Please sign in to comment.
Something went wrong with that request. Please try again.