From a390b68da85bfda213cce5b946b97abd4c45a350 Mon Sep 17 00:00:00 2001 From: Ido Bar Date: Wed, 20 Mar 2024 20:07:12 +1000 Subject: [PATCH 1/2] Update snap.rb to fix failure to build index --- lib/transrate/snap.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transrate/snap.rb b/lib/transrate/snap.rb index f68a07d..78bf910 100644 --- a/lib/transrate/snap.rb +++ b/lib/transrate/snap.rb @@ -138,7 +138,7 @@ 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) From ca05de6ac78e965dfe1c72dd3ec067d97ad5194a Mon Sep 17 00:00:00 2001 From: Ido Bar Date: Fri, 22 Mar 2024 10:31:37 +1000 Subject: [PATCH 2/2] Update snap.rb to handle deleting of non-empty index folders --- lib/transrate/snap.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/transrate/snap.rb b/lib/transrate/snap.rb index 78bf910..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 @@ -141,7 +142,7 @@ def build_index file, threads 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)