Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborne committed Dec 6, 2011
1 parent b047cb4 commit ff5b2ec
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
37 changes: 24 additions & 13 deletions lib/Bio/Tools/Run/Phylo/FastTree.pm
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
Expand Down
24 changes: 24 additions & 0 deletions lib/Bio/Tools/Run/Phylo/Phyml.pm
Expand Up @@ -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.
Expand All @@ -942,6 +965,7 @@ sub _run {
$output_stat_file = '_phyml_stat.txt';
}

$self->command($command);
$self->debug("Phyml command = $command\n");
`$command`;

Expand Down

0 comments on commit ff5b2ec

Please sign in to comment.