Permalink
Browse files

Remove unused code

  • Loading branch information...
1 parent b047cb4 commit ff5b2ecd9eb36feb08c1efd69f6f695bf42e69d6 @bosborne bosborne committed Dec 6, 2011
Showing with 48 additions and 13 deletions.
  1. +24 −13 lib/Bio/Tools/Run/Phylo/FastTree.pm
  2. +24 −0 lib/Bio/Tools/Run/Phylo/Phyml.pm
@@ -224,7 +224,6 @@ sub _run {
# If -nt is not set check the alphabet of the input
$self->_alphabet($file) if ( ! $self->nt );
- $self->nt(1) if ( $self->_alphabet eq 'dna' );
my $exe = $self->executable || return;
my $param_str = $self->arguments . " " . $self->_setparams($file);
@@ -275,11 +274,15 @@ sub _write_alignfile {
my $out = Bio::AlignIO->new(
-file => ">$tempfile",
- -format => 'fasta'
+ -format => 'phylip'
);
$out->write_aln($align);
$out->close();
+ undef($out);
close($tfh);
+ undef($tfh);
+
+ die "Alignment file $tempfile was not created" if ( ! -e $tempfile );
$tempfile;
}
@@ -288,24 +291,32 @@ sub _write_alignfile {
Title : _alphabet
Usage : my $alphabet = $self->_alphabet;
- Function: Get the alphabet of the input
+ Function: Get the alphabet of the input alignment, defaults to 'dna'
Returns : 'dna' or 'protein'
- Args :
+ Args : Alignment file
=cut
sub _alphabet {
my ($self,$file) = @_;
+
+ if ( $file ) {
+ if ( -e $file ) {
+ my $in = Bio::AlignIO->new(-file => $file);
+ my $aln = $in->next_aln;
+ # arbitrary, the first one
+ my $seq = $aln->get_seq_by_pos(1);
+ my $alphabet = $seq->alphabet;
+ $self->{_alphabet} = $alphabet;
+
+ $self->nt(1) if ( $alphabet eq 'dna' );
+ } else {
+ die "File $file can not be found";
+ }
+ }
- return $self->{_alphabet} if $self->{_alphabet};
-
- my $in = Bio::AlignIO->new(-file => $file);
- my $aln = $in->next_aln;
- # arbitrary, the first one
- my $seq = $aln->get_seq_by_pos(1);
- $self->{_alphabet} = $seq->alphabet;
-
- $self->{'_alphabet'};
+ # default is 'dna'
+ return $self->{'_alphabet'} || 'dna';
}
=head2 _setparams
@@ -920,6 +920,29 @@ sub bootstrap {
return $self->{_bootstrap};
}
+=head2 command
+
+ Title : command
+ Usage : $factory->command(...);
+ Function:
+ Returns : string
+ Args : None to get, integer to set.
+
+=cut
+
+sub command {
+ my ( $self, $value ) = @_;
+ if ( defined($value) ) {
+ if ($value =~ /$PROGRAM_NAME/ ) {
+ $self->{_command} = $value;
+ }
+ else {
+ $self->throw("$value is not a $PROGRAM_NAME command");
+ }
+ }
+ return $self->{_command} || '';
+}
+
=head2 Internal methods
These methods are private and should not be called outside this class.
@@ -942,6 +965,7 @@ sub _run {
$output_stat_file = '_phyml_stat.txt';
}
+ $self->command($command);
$self->debug("Phyml command = $command\n");
`$command`;

0 comments on commit ff5b2ec

Please sign in to comment.