diff --git a/lib/transrate/snap.rb b/lib/transrate/snap.rb index f68a07d..2f9e2de 100644 --- a/lib/transrate/snap.rb +++ b/lib/transrate/snap.rb @@ -6,6 +6,7 @@ class SnapError < TransrateError class Snap require 'bio' + require 'fileutils' attr_reader :index_name, :bam, :read_count @@ -138,10 +139,10 @@ def build_index file, threads runner.run if !runner.status.success? err = runner.stderr - if err =~ /Ran out of overflow table namespace/ || err =~ /Trying to use too many overflow entries/ + if err =~ /Ran out of overflow table namespace/ || err =~ /Trying to use too many overflow entries/ || err =~ /Genome is too big for 4 byte genome locations/ logger.warn "Snap index build failed with n = #{n} , increasing +1" n += 1 - Dir.delete(@index_name) if Dir.exist?(@index_name) + FileUtils.rm_rf(@index_name) if Dir.exist?(@index_name) else msg = "Failed to build Snap index\n#{runner.stderr}" raise SnapError.new(msg)