Permalink
Browse files

get MAFFT working

  • Loading branch information...
1 parent e8e99fa commit 66bc3e8197091832388256371cc2385a27675983 Chris Fields committed Apr 14, 2011
Showing with 31 additions and 35 deletions.
  1. +30 −33 lib/Bio/Tools/Run/Alignment/MAFFT.pm
  2. +1 −2 t/MAFFT.t
@@ -77,11 +77,8 @@ use Bio::Seq;
use Bio::SeqIO;
use Bio::SimpleAlign;
use Bio::AlignIO;
-use Bio::Root::Root;
-use Bio::Root::IO;
-use Bio::Factory::ApplicationFactoryI;
-use Bio::Tools::Run::WrapperBase;
-@ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase
+
+use base qw(Bio::Root::Root Bio::Tools::Run::WrapperBase
Bio::Factory::ApplicationFactoryI);
BEGIN {
@@ -109,7 +106,7 @@ BEGIN {
=cut
sub program_name {
- return 'mafft';
+ return 'mafft';
}
=head2 executable
@@ -125,29 +122,29 @@ sub program_name {
=cut
sub executable {
- my ($self, $exename, $exe,$warn) = @_;
- $exename = $self->program_name unless (defined $exename );
-
- if( defined $exe && -x $exe ) {
- $self->{'_pathtoexe'}->{$exename} = $exe;
- }
- unless( defined $self->{'_pathtoexe'}->{$exename} ) {
- my $f = $self->program_path($exename);
- $exe = $self->{'_pathtoexe'}->{$exename} = $f if(-e $f && -x $f );
-
- # This is how I meant to split up these conditionals --jason
- # if exe is null we will execute this (handle the case where
- # PROGRAMDIR pointed to something invalid)
- unless( $exe ) { # we didn't find it in that last conditional
- if( ($exe = $self->io->exists_exe($exename)) && -x $exe ) {
- $self->{'_pathtoexe'}->{$exename} = $exe;
- } else {
- $self->warn("Cannot find executable for $exename") if $warn;
- $self->{'_pathtoexe'}->{$exename} = undef;
- }
- }
- }
- return $self->{'_pathtoexe'}->{$exename};
+ my ($self, $exename, $exe,$warn) = @_;
+ $exename = $self->program_name unless (defined $exename );
+
+ if( defined $exe && -x $exe ) {
+ $self->{'_pathtoexe'}->{$exename} = $exe;
+ }
+ unless( defined $self->{'_pathtoexe'}->{$exename} ) {
+ my $f = $self->program_path($exename);
+ $exe = $self->{'_pathtoexe'}->{$exename} = $f if(-e $f && -x $f );
+
+ # This is how I meant to split up these conditionals --jason
+ # if exe is null we will execute this (handle the case where
+ # PROGRAMDIR pointed to something invalid)
+ unless( $exe ) { # we didn't find it in that last conditional
+ if( ($exe = $self->io->exists_exe($exename)) && -x $exe ) {
+ $self->{'_pathtoexe'}->{$exename} = $exe;
+ } else {
+ $self->warn("Cannot find executable for $exename") if $warn;
+ $self->{'_pathtoexe'}->{$exename} = undef;
+ }
+ }
+ }
+ return $self->{'_pathtoexe'}->{$exename};
}
@@ -322,7 +319,7 @@ sub align {
my ($param_string,$outstr) = $self->_setparams();
# run mafft
- return &_run($self, $infilename, $param_string,$outstr);
+ return $self->_run($infilename, $param_string,$outstr);
}
=head2 _run
@@ -341,15 +338,15 @@ sub align {
sub _run {
my ($self,$infilename,$paramstr,$outstr) = @_;
- my $commandstring = $self->executable($self->method)." $paramstr $infilename $outstr";
+ my $commandstring = $self->executable()." $paramstr $infilename $outstr";
$self->debug( "mafft command = $commandstring \n");
my $status = system($commandstring);
my $outfile = $self->outfile();
if( !-e $outfile || -z $outfile ) {
- $self->warn( "MAFFT call crashed: $? [command $commandstring]\n");
- return;
+ $self->warn( "MAFFT call crashed: $? [command $commandstring]\n");
+ return;
}
my $in = Bio::AlignIO->new('-file' => $outfile,
View
@@ -30,7 +30,7 @@ SKIP: {
$factory->executable($factory->method);
test_skip(-requires_executable => $factory,
- -tests => 13);
+ -tests => 13);
my $version = $factory->version;
ok($version);
@@ -60,6 +60,5 @@ SKIP: {
is $aln->num_sequences, 7;
my $s1_perid = $aln->average_percentage_identity;
ok($s1_perid);
-
}
}

0 comments on commit 66bc3e8

Please sign in to comment.