Bio-MLST-Check
view release on metacpan or search on metacpan
t/data/expected_three_contigs_one_unknown.unknown_allele.recA-1~.fa
t/data/expected_three_mlst_best_results.allele.csv
t/data/expected_three_mlst_best_results.genomic.csv
t/data/expected_three_mlst_results.allele.csv
t/data/expected_three_mlst_results.genomic.csv
t/data/expected_two_concatenated_alleles.fa
t/data/expected_two_mlst_results.allele.csv
t/data/expected_two_mlst_results.genomic.csv
t/data/fake_executables/another_executable.sh
t/data/fake_executables/executable.sh
t/data/fake_executables/not_executable.sh
t/data/gdh_fake_blast_output.sh
t/data/homo_sapiens.txt
t/data/missing_web_database.xml
t/data/overall_databases.xml
t/data/purA.tfa
t/data/recA.tfa
t/requires_external.t
weaver.ini
xt/author/00-compile.t
xt/author/pod-syntax.t
lib/Bio/MLST/Check.pm view on Meta::CPAN
-start => 1,
-end => length($self->_concat_sequences->[$i])
));
}
$out->write_aln($aln);
}
sub input_fasta_files_exist
{
my($self) = @_;
my $file_not_found = 0;
for my $fastafile (@{$self->_input_fasta_files})
{
unless( -e $fastafile )
{
print qq[Input fasta file not found: $fastafile\n];
$file_not_found++;
}
}
return $file_not_found ? 0:1;
}
no Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
t/Validate/Executable.t view on Meta::CPAN
BEGIN {
use Test::Most;
use_ok('Bio::MLST::Validate::Executable');
}
note("Test the executables which the Perl code depends on. Really this is checking if blastn/makeblastdb available and runable.");
my $current_dir = getcwd();
my $not_defined;
my $does_not_exist = $current_dir . '/t/data/fake_executables/does_not_exist.sh';
my $not_executable = $current_dir . '/t/data/fake_executables/not_executable.sh';
my $executable = $current_dir . '/t/data/fake_executables/executable.sh';
my $another_executable = $current_dir . '/t/data/fake_executables/another_executable.sh';
my $in_path = 'perl';
my $validator = Bio::MLST::Validate::Executable->new();
{
my @warnings;
local $SIG{__WARN__} = sub { push( @warnings, @_ ) };
dies_ok(
sub { $validator->preferred_executable( $not_defined, [] ) },
"The executable is not defined and theres no defaults, so it should die."
);
dies_ok(
sub { $validator->preferred_executable( $not_defined, [$does_not_exist] ) },
"The executable is not defined and the default executable doesnt exist, so it should die."
);
dies_ok(
sub { $validator->preferred_executable( $not_defined, [ $does_not_exist, $not_executable ] ) },
"The executable is not defined and the default executables doesnt exist or are not executable, so it should die."
);
dies_ok(
sub { $validator->preferred_executable( $not_executable, [$does_not_exist] ) },
"The executable is not executable and the default does not exist, so it should die."
);
dies_ok(
sub { $validator->preferred_executable( $does_not_exist, [$not_executable] ) },
"The executable does not exist and the default is not executable so it should die."
);
is( @warnings, 2, "There should be 2 warnings if the input executable and the default are problematic" );
}
note("The input executable is valid, but the defaults are not. Check that only the valid input executable is returned.");
is( $validator->preferred_executable( $executable, [] ),
$executable, "Valid input executable and no defaults, so the valid input executable is chosen." );
is( $validator->preferred_executable( $executable, [$does_not_exist] ),
$executable, "Valid input executable, where the default does not exist, so the valid input executable is chosen." );
is( $validator->preferred_executable( $executable, [$another_executable] ),
$executable, "Valid input executable where the default is also valid, so the valid input executable is chosen." );
is( $validator->preferred_executable( $executable, [ $not_executable, $another_executable ] ),
$executable, "Valid input executable, where the defaults contain good and bad executables, so the valid input executable is chosen." );
{
my @warnings;
local $SIG{__WARN__} = sub { push( @warnings, @_ ) };
note("The input executable is not valid, but all of the defaults are, make sure the valid default gets chosen.");
is( $validator->preferred_executable( $not_executable, [ $executable, $another_executable ] ),
$executable, "The input executable is not executable, and all the defaults are valid, so choose the first default." );
is( $validator->preferred_executable( $not_defined, [ $executable, $another_executable ] ),
$executable, "The input executable is not defined, and all the defaults are valid, so choose the first default." );
is( $validator->preferred_executable( $not_defined, [ $another_executable, $executable ] ),
$another_executable,
"The input executable is not defined, and all the defaults are valid, but reversed, so choose the first default." );
is( $validator->preferred_executable( $not_executable, [ $does_not_exist, $executable, $another_executable ] ),
$executable, "The input executable is not executable, and the first default is not valid, so choose the next valid default." );
is( $validator->preferred_executable( $not_executable, [ $executable, $does_not_exist, $another_executable ] ),
$executable, "The input executable is not executable, and one of the defaults does not exist so choose the first one that is valid." );
is( @warnings, 3, "There should be 3 warning messages about choosing the executable" );
}
is( $validator->preferred_executable( $executable, [$in_path] ), $executable, "Good executable, default in PATH." );
is( $validator->preferred_executable( $in_path, [$executable] ), $in_path, "Executable in PATH, good default." );
is( $validator->preferred_executable( $in_path, [$does_not_exist] ), $in_path, "Executable in PATH, bad default." );
done_testing();
( run in 0.602 second using v1.01-cache-2.11-cpan-0a987023a57 )