Permalink
Browse files

loosened validation for outfmt in BlastMethods to allow quoted multip…

…le values (new blast+ feature); added tests for issue 12 to SABlastPlus.t
  • Loading branch information...
1 parent f8b2750 commit 96ccd9355b4384808934bcff87fab83b919d17ac @majensen majensen committed Jul 26, 2014
Showing with 36 additions and 4 deletions.
  1. +2 −1 lib/Bio/Tools/Run/StandAloneBlastPlus/BlastMethods.pm
  2. +34 −3 t/SABlastPlus.t
@@ -224,8 +224,9 @@ sub run {
$fh->close;
$self->_register_temp_for_cleanup($outfile);
}
+
if ($outformat) {
- unless ($outformat =~ /^[0-9]{1,2}$/) {
+ unless ($outformat =~ /^"?[0-9]{1,2}/) {
$self->throw("Blast run: output format code should be integer 0-10");
}
$blast_args{'-outfmt'} = $outformat;
View
@@ -4,11 +4,12 @@
use strict;
use warnings;
+use lib '../lib';
our $home;
BEGIN {
use Bio::Root::Test;
- test_begin(-tests => 69,
- -requires_modules => [qw( Bio::Tools::Run::BlastPlus)]);
+ test_begin(-tests => 73);
+# -requires_modules => [qw( Bio::Tools::Run::BlastPlus)]);
}
use_ok( 'Bio::Tools::Run::StandAloneBlastPlus' );
@@ -238,7 +239,7 @@ SKIP : {
ok $result = $fac->bl2seq(-method => 'tblastx',
-query => $seq1,
- -subject => $seq2
+ -subject => $seq2,
), "bl2seq (tblastx)";
is $result->num_hits, 1, "got hit";
@@ -267,6 +268,36 @@ SKIP : {
), "bl2seq (blastp)";
is $result->num_hits, 1, "got hit";
+ # issue #12 (https://github.com/bioperl/bioperl-run/issues/12) : 4 tests
+ $sio = Bio::SeqIO->new(-file=>test_input_file('test-spa.fas'));
+ $sio->next_seq;
+ $seq1 = $sio->next_seq;
+ $seq2 = $sio->next_seq;
+
+ lives_ok { $fac->bl2seq(-method => 'tblastx',
+ -query => $seq1,
+ -subject => $seq2,
+ -method_args => [ '-outfmt' => '"6 qseqid sseqid"' ]
+ ) } "bl2seq (tblastx) - multiple outfmt options";
+
+ lives_ok { $fac->bl2seq(-method => 'tblastx',
+ -query => $seq1,
+ -subject => $seq2,
+ -outformat => '"6 qseqid sseqid"',
+ ) } "bl2seq (tblastx) - multiple outfmt options (use method arg)";
+
+ lives_ok { $fac->bl2seq(-method => 'tblastx',
+ -query => $seq1,
+ -subject => $seq2,
+ -outformat => '6 qseqid sseqid',
+ ) } "bl2seq (tblastx) - multiple outfmt options (no explict quotes should also work)";
+
+ lives_ok { $fac->bl2seq(-method => 'tblastx',
+ -query => $seq1,
+ -subject => $seq2,
+ -outformat => '"6"'
+ ) } "bl2seq (tblastx) - multiple outfmt options (a single format number in quotes";
+
$fac->cleanup;
} # SKIP to here

0 comments on commit 96ccd93

Please sign in to comment.