From ff5751ece9bcd3d810fb104757e9ea612e516d97 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 3 Feb 2012 09:06:53 +0000 Subject: [PATCH] rounding up work on denoise_seq git-svn-id: http://biopieces.googlecode.com/svn/trunk@1745 74ccb610-7750-0410-82ae-013aeee3265d --- code_ruby/lib/maasha/usearch.rb | 9 +++++---- code_ruby/test/maasha/test_seq.rb | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/code_ruby/lib/maasha/usearch.rb b/code_ruby/lib/maasha/usearch.rb index 1618f50..7aa14b4 100644 --- a/code_ruby/lib/maasha/usearch.rb +++ b/code_ruby/lib/maasha/usearch.rb @@ -85,9 +85,9 @@ class Usearch # Method to execute ustar alignment. def ustar - @command << %Q{grep "^[SH]" #{@outfile} > #{@outfile}.sub} - - execute + command = %Q{grep "^[SH]" #{@outfile} > #{@outfile}.sub} + system(command) + raise "Command failed: #{command}" unless $?.success? File.rename "#{@outfile}.sub", @outfile @@ -199,8 +199,9 @@ class Usearch # The command is composed of bits from the @command variable. def execute @command.unshift "nice -n 19" - @command << "> /dev/null 2>&1" unless @options[:verbose] + @command << "--quiet" unless @options[:verbose] command = @command.join(" ") + $stderr.puts "Running command: #{command}" if @options[:verbose] system(command) raise "Command failed: #{command}" unless $?.success? diff --git a/code_ruby/test/maasha/test_seq.rb b/code_ruby/test/maasha/test_seq.rb index 927937e..9a8deef 100755 --- a/code_ruby/test/maasha/test_seq.rb +++ b/code_ruby/test/maasha/test_seq.rb @@ -538,10 +538,10 @@ class TestSeq < Test::Unit::TestCase end def test_Seq_mask_seq_hard_bang_returns_correctly - @entry.seq = "ATCG" - @entry.qual = "RSTU" + @entry.seq = "-ATCG" + @entry.qual = "RRSTU" - assert_equal("NNCG", @entry.mask_seq_hard!(20).seq) + assert_equal("-NNCG", @entry.mask_seq_hard!(20).seq) end def test_Seq_mask_seq_soft_bang_with_nil_seq_raises @@ -558,13 +558,6 @@ class TestSeq < Test::Unit::TestCase assert_raise(SeqError) { @entry.mask_seq_soft!(20) } end - def test_Seq_mask_seq_soft_bang_returns_correctly - @entry.seq = "ATCG" - @entry.qual = "RSTU" - - assert_equal("atCG", @entry.mask_seq_soft!(20).seq) - end - def test_Seq_mask_seq_soft_bang_with_bad_cutoff_raises assert_raise(SeqError) { @entry.mask_seq_soft!(-1) } assert_raise(SeqError) { @entry.mask_seq_soft!(41) } @@ -577,6 +570,13 @@ class TestSeq < Test::Unit::TestCase assert_nothing_raised { @entry.mask_seq_soft!(0) } assert_nothing_raised { @entry.mask_seq_soft!(40) } end + + def test_Seq_mask_seq_soft_bang_returns_correctly + @entry.seq = "-ATCG" + @entry.qual = "RRSTU" + + assert_equal("-atCG", @entry.mask_seq_soft!(20).seq) + end end -- 2.39.2