Bio::Tools::Run::Phylo Phyml
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::Tools::Run::Phylo::Phyml - Wrapper for rapid reconstruction of phylogenies using Phyml
Package variables
No package variables defined.
Included modules
Bio::AlignIO
Bio::TreeIO
File::Copy
File::Spec
Inherit
Bio::Tools::Run::WrapperBase
Synopsis
  use Bio::Tools::Run::Phylo::Phyml;
# Make a Phyml factory $factory = Bio::Tools::Run::Phylo::Phyml->new(-verbose => 2); # it defaults to protein alignment # change parameters $factory->model('Dayhoff'); # Pass the factory an alignment and run $inputfilename = 't/data/protpars.phy'; $tree = $factory->run($inputfilename); # $tree is a Bio::Tree::Tree object. # or set parameters at object creation my %args = ( -data_type => 'dna', -model => 'HKY', -kappa => 4, -invar => 'e', -category_number => 4, -alpha => 'e', -tree => 'BIONJ', -opt_topology => '0', -opt_lengths => '1', ); $factory = Bio::Tools::Run::Phylo::Phyml->new(%args); # if you need the output files do $factory->save_tempfiles(1); $factory->tempdir($workdir); # and get a Bio::Align::AlignI (SimpleAlign) object from somewhere $tree = $factory->run($aln);
Description
This is a wrapper for running the phyml application by Stephane
Guindon and Olivier Gascuel. You can download it from:
http://atgc.lirmm.fr/phyml/ After downloading, you need to rename a the copy of the program that
runs under your operating system. I.e. phyml_linux into phyml.
You will need to help this Phyml wrapper to find the phyml program.
This can be done in (at least) three ways:
    1.
    Make sure the Phyml executable is in your path. Copy it to, or create
a symbolic link from a directory that is in your path.
    2.
    Define an environmental variable PHYMLDIR which is a
directory which contains the 'phyml' application: In bash:
  export PHYMLDIR=/home/username/phyml_v2.4.4/exe
    In csh/tcsh:
  setenv PHYMLDIR /home/username/phyml_v2.4.4/exe
    3.
    Include a definition of an environmental variable PHYMLDIR in
every script that will use this Phyml wrapper module, e.g.:
  BEGIN { $ENV{PHYMLDIR} = '/home/username/phyml_v2.4.4/exe' }
use Bio::Tools::Run::Phylo::Phyml;
This wrapper has been tested with PHYML v2.4.4 and v.3.0. It may work with
recent Phyml releases using a date format for the format, but the wrapper
hasn't been extensively tested in these cases, so for the moment only the
simpler numbered versions are supported.
In its current state, the wrapper supports only input of one MSA and
output of one tree. It can easily be extended to support more advanced
capabilities of phyml.
Two convienience methods have been added on top of the standard
BioPerl WrapperBase ones: stats() and tree_string(). You can call them
to after running the phyml program to retrieve into a string the statistics
and the tree in Newick format.
Methods
newDescriptionCode
program_nameDescriptionCode
program_dirDescriptionCode
versionDescriptionCode
runDescriptionCode
statsDescriptionCode
tree_stringDescriptionCode
data_typeDescriptionCode
data_formatDescriptionCode
dataset_countDescriptionCode
modelDescriptionCode
kappaDescriptionCode
invarDescriptionCode
category_numberDescriptionCode
alphaDescriptionCode
treeDescriptionCode
opt_topologyDescriptionCode
opt_lengthsDescriptionCode
freqDescriptionCode
optDescriptionCode
searchDescriptionCode
rand_startDescriptionCode
rand_startsDescriptionCode
rand_seedDescriptionCode
no_memory_checkDescriptionCode
bootstrapDescriptionCode
commandDescriptionCode
_run
No description
Code
_setparamsDescriptionCode
_write_phylip_align_fileDescriptionCode
Methods description
newcode    nextTop
 Title   : new
Usage : $factory = Bio::Tools::Run::Phylo::Phyml->new(@params)
Function: creates a new Phyml factory
Returns : Bio::Tools::Run::Phylo::Phyml
Args : Optionally, provide any of the following (default in []):
-data_type => 'dna' or 'protein', [protein]
-dataset_count => integer, [1]
-model => 'HKY'... , [HKY|JTT]
-kappa => 'e' or float, [e]
-invar => 'e' or float, [e]
-category_number => integer, [1]
-alpha => 'e' or float (int v3),[e]
-tree => 'BIONJ' or your own, [BION]
-bootstrap => integer [123]
-opt_topology => boolean [1]
-opt_lengths => boolean [1]
-no_memory_check => boolean [1]
-program_name => string
program_namecodeprevnextTop
 Title   : program_name
Usage : $factory>program_name()
Function: holds the program name
Returns : string
Args : None
program_dircodeprevnextTop
 Title   : program_dir
Usage : $factory->program_dir(@params)
Function: returns the program directory, obtained from ENV variable.
Returns : string
Args : None
versioncodeprevnextTop
 Title   : version
Usage : exit if $prog->version < 1.8
Function: Determine the version number of the program
Example :
Returns : float or undef
Args : none
Phyml before 3.0 did not display the version. Assume 2.44 when can not
determine it.
Some releases do not state version number, only date, so the
version might have to be inferred from this date.
runcodeprevnextTop
 Title   : run
Usage : $factory->run($aln_file);
$factory->run($align_object);
Function: Runs Phyml to generate a tree
Returns : Bio::Tree::Tree object
Args : file name for your input alignment in a format
recognised by AlignIO, OR Bio::Align::AlignI
compliant object (eg. Bio::SimpleAlign).
statscodeprevnextTop
 Title   : stats
Usage : $factory->stats;
Function: Returns the contents of the phyml '_phyml_stat.txt' output file
Returns : string with statistics about the run, undef before run()
Args : none
tree_stringcodeprevnextTop
 Title   : tree_string
Usage : $factory->tree_string;
$factory->run($align_object);
Function: Returns the contents of the phyml '_phyml_tree.txt' output file
Returns : string with tree in Newick format, undef before run()
Args : none
data_typecodeprevnextTop
 Title   : data_type
Usage : $phyml->data_type('nt');
Function: Sets sequence alphabet to 'dna' (nt in v3) or 'aa'
If leaved unset, will be set automatically
Returns : set value, defaults to 'protein'
Args : None to get, 'dna' ('nt') or 'aa' to set.
data_formatcodeprevnextTop
 Title   : data_format
Usage : $phyml->data_format('s');
Function: Sets PHYLIP format to 'i' interleaved or
's' sequential
Returns : set value, defaults to 'i'
Args : None to get, 'i' or 's' to set.
dataset_countcodeprevnextTop
 Title   : dataset_count
Usage : $phyml->dataset_count(3);
Function: Sets dataset number to deal with
Returns : set value, defaults to 1
Args : None to get, positive integer to set.
modelcodeprevnextTop
 Title   : model
Usage : $phyml->model('HKY');
Function: Choose the substitution model to use. One of
JC69 | K2P | F81 | HKY | F84 | TN93 | GTR (DNA) JTT | MtREV | Dayhoff | WAG (amino acids) v3.0: HKY85 (default) | JC69 | K80 | F81 | F84 | TN93 | GTR (DNA) LG (default) | WAG | JTT | MtREV | Dayhoff | DCMut | RtREV | CpREV | VT | Blosum62 | MtMam | MtArt | HIVw | HIVb (amino acids) Returns : Name of the model, v2.4.4 defaults to {HKY|JTT} Args : None to get, string to set.
kappacodeprevnextTop
 Title   : kappa
Usage : $phyml->kappa(4);
Function: Sets transition/transversion ratio, leave unset to estimate
Returns : set value, defaults to 'e'
Args : None to get, float or integer to set.
invarcodeprevnextTop
 Title   : invar
Usage : $phyml->invar(.3);
Function: Sets proportion of invariable sites, leave unset to estimate
Returns : set value, defaults to 'e'
Args : None to get, float or integer to set.
category_numbercodeprevnextTop
 Title   : category_number
Usage : $phyml->category_number(4);
Function: Sets number of relative substitution rate categories
Returns : set value, defaults to 1
Args : None to get, integer to set.
alphacodeprevnextTop
 Title   : alpha
Usage : $phyml->alpha(1.0);
Function: Sets gamma distribution parameter, leave unset to estimate
Returns : set value, defaults to 'e'
Args : None to get, float or integer to set.
treecodeprevnextTop
 Title   : tree
Usage : $phyml->tree('/tmp/tree.nwk');
Function: Sets starting tree, leave unset to estimate a distance tree
Returns : set value, defaults to 'BIONJ'
Args : None to get, newick tree file name to set.
opt_topologycodeprevnextTop
 Title   : opt_topology
Usage : $factory->opt_topology(1);
Function: Choose to optimise the tree topology
Returns : 1 or 0. Default is 1.
Args : None to get, boolean to set.
v2.* only
opt_lengthscodeprevnextTop
 Title   : opt_lengths
Usage : $factory->opt_lengths(0);
Function: Choose to optimise branch lengths and rate parameters
Returns : 1 or 0. Default is 1.
Args : None to get, boolean to set.
v2.* only
freqcodeprevnextTop
 Title   : freq
Usage : $phyml->freq(e); $phyml->freq("0.2, 0.6, 0.6, 0.2");
Function: Sets nucleotide frequences or asks residue to be estimated
according to two models: e or d
Returns : set value,
Args : None to get, string to set.
v3 only.
optcodeprevnextTop
 Title   : opt
Usage : $factory->opt(1);
Function: Optimise tree parameters: tlr|tl|tr|l|n
Returns : {value|n} (default n)
Args : None to get, string to set.
v3.* only
searchcodeprevnextTop
 Title   : search
Usage : $factory->search(SPR);
Function: Tree topology search operation algorithm: NNI|SPR|BEST
Returns : string (defaults to NNI)
Args : None to get, string to set.
v3.* only
rand_startcodeprevnextTop
 Title   : rand_start
Usage : $factory->rand_start(1);
Function: Sets the initial SPR tree to random.
Returns : boolean (defaults to false)
Args : None to get, boolean to set.
v3.* only; only meaningful if $prog->search is 'SPR'
rand_startscodeprevnextTop
 Title   : rand_starts
Usage : $factory->rand_starts(10);
Function: Sets the number of initial random SPR trees
Returns : integer (defaults to 1)
Args : None to get, integer to set.
v3.* only; only valid if $prog->search is 'SPR'
rand_seedcodeprevnextTop
 Title   : rand_seed
Usage : $factory->rand_seed(1769876);
Function: Seeds the random number generator
Returns : random integer
Args : None to get, integer to set.
v3.* only; only valid if $prog->search is 'SPR'
Uses perl rand() to initialize if not explicitely set.
no_memory_checkcodeprevnextTop
 Title   : no_memory_check
Usage : $factory->no_memory_check(1);
Function:
Returns : boolean (defaults to false)
Args : None to get, integer to set.
bootstrapcodeprevnextTop
 Title   : bootstrap
Usage : $factory->bootstrap(100);
Function: Set number of bootstraps
Returns :
Args : None to get, integer to set.
commandcodeprevnextTop
 Title   : command
Usage : $factory->command(...);
Function:
Returns : string
Args : None to get, integer to set.
_setparamscodeprevnextTop
 Title   : _setparams
Usage : Internal function, not to be called directly
Function: Creates a string of params to be used in the command string
Returns : string of params
Args : none
_write_phylip_align_filecodeprevnextTop
 Title   : _write_phylip_align_file
Usage : obj->__write_phylip_align_file($aln)
Function: Internal (not to be used directly)
Writes the alignment into the tmp directory in PHYLIP interlieved format Returns : filename Args : Bio::Align::AlignI
Methods code
newdescriptionprevnextTop
sub new {
    my ( $class, @args ) = @_;
    my $self = $class->SUPER::new(@args);

    # for consistency with other run modules, allow params to be dashless
my %args = @args; while ( my ( $key, $val ) = each %args ) { if ( $key !~ /^-/ ) { delete $args{$key}; $args{ '-' . $key } = $val; } } my ( $data_type, $data_format, $dataset_count, $model, $freq, $kappa, $invar, $category_number, $alpha, $tree, $opt_topology, $opt_lengths, $opt, $search, $rand_start, $rand_starts, $rand_seed, $no_memory_check, $bootstrap, $program_name ) = $self->_rearrange( [ qw( DATA_TYPE DATA_FORMAT DATASET_COUNT MODEL FREQ KAPPA INVAR CATEGORY_NUMBER ALPHA TREE OPT_TOPOLOGY OPT_LENGTHS OPT SEARCH RAND_START RAND_STARTS RAND_SEED NO_MEMORY_CHECK BOOTSTRAP PROGRAM_NAME ) ], %args ); $self->data_type($data_type) if $data_type; $self->data_format($data_format) if $data_format; $self->dataset_count($dataset_count) if $dataset_count; $self->model($model) if $model; $self->freq($freq) if $freq; $self->kappa($kappa) if $kappa; $self->invar($invar) if $invar; $self->category_number($category_number) if $category_number; $self->alpha($alpha) if $alpha; $self->tree($tree) if $tree; $self->opt_topology($opt_topology) if $opt_topology; $self->opt_lengths($opt_lengths) if $opt_lengths; $self->opt($opt) if $opt; $self->search($search) if $search; $self->rand_start($rand_start) if $rand_start; $self->rand_starts($rand_starts) if $rand_starts; $self->rand_seed($rand_seed) if $rand_seed; $self->no_memory_check($no_memory_check) if $no_memory_check; $self->bootstrap($bootstrap) if $bootstrap; $self->program_name($program_name) if $program_name; return $self;
}
program_namedescriptionprevnextTop
sub program_name {
    my ( $self, $value ) = @_;

    if ( defined($value) ) {
      if ( $value =~ /^$PROGRAM_NAME[-a-z]*$/ ) {
        $PROGRAM_NAME = $value;
      } else {
        $self->throw("$value is not a valid program name");
      }
    }

    $PROGRAM_NAME;
}
program_dirdescriptionprevnextTop
sub program_dir {
    return $PROGRAM_DIR;
}
versiondescriptionprevnextTop
sub version {
    my $self = shift;

    return $self->{'_version'} if defined $self->{'_version'};
    my $exe = $self->executable || return;
    my $string = substr `$exe -h`, 0, 40;
    my ($version) = $string =~ /PhyML v([\d+\.]+)/;
    if ( !$version ) {
        $string =~ /PhyML\s+(\d{8})/;

        # 3 was released August 2008
$version = 3 if ( $1 && $1 >= 20080801 ); } $self->{'_version'} = $version; $version ? ( return $version ) : return '2.44';
}
rundescriptionprevnextTop
sub run {
    my ( $self, $in ) = @_;

    if ( ref $in && $in->isa("Bio::Align::AlignI") ) {
        $in = $self->_write_phylip_align_file($in);
    }
    elsif ( !-e $in ) {
        $self->throw( "When not supplying a Bio::Align::AlignI object, "
              . "you must supply a readable filename" );
    }
    elsif ( -e $in ) {
        copy( $in, $self->tempdir );
        my $name =
          File::Spec->splitpath($in);    # name is the last item in the array
$in = File::Spec->catfile( $self->tempdir, $name ); } return $self->_run($in);
}
statsdescriptionprevnextTop
sub stats {
    my $self = shift;
    return $self->{_stats};
}
tree_stringdescriptionprevnextTop
sub tree_string {
    my $self = shift;
    return $self->{_tree};
}
data_typedescriptionprevnextTop
sub data_type {
    my ( $self, $value ) = @_;
    if ( $self->version && $self->version >= 3 ) {
        if ( defined $value ) {
            if ( $value eq 'nt' ) {
                $self->{_data_type} = 'nt';
            }
            else {
                $self->{_data_type} = 'aa';
            }
        }
        return 'aa' unless defined $self->{_data_type};
    }
    else {
        if ( defined $value ) {
            if ( $value eq 'dna' ) {
                $self->{_data_type} = '0';
            }
            else {
                $self->{_data_type} = '1';
            }
        }
        return '1' unless defined $self->{_data_type};
    }
    return $self->{_data_type};
}
data_formatdescriptionprevnextTop
sub data_format {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        $self->throw("PHYLIP format must be 'i' or 's'")
          unless $value eq 'i'
              or $value eq 's';
        $self->{_data_format} = $value;
    }
    return $self->{_data_format} || 'i';
}
dataset_countdescriptionprevnextTop
sub dataset_count {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid positive integer [$value]"
          unless $value =~ /^[-+]?\d*$/ and $value > 0;
        $self->{_dataset_count} = $value;
    }
    return $self->{_dataset_count} || 1;
}
modeldescriptionprevnextTop
sub model {
    my ( $self, $value ) = @_;
    if ( defined($value) ) {
        if ( $self->version && $self->version >= 3 ) {
            unless ( $value =~ /\d{6}/ ) {
                $self->throw(
"Not a valid model name [$value] for current data type (alphabet)"
                ) unless $models3->{ $self->data_type }->{$value};
            }
        }
        else {
            $self->throw(
"Not a valid model name [$value] for current data type (alphabet)"
            ) unless $models->{ $self->data_type }->{$value};
        }
        $self->{_model} = $value;
    }

    if ( $self->{_model} ) {
        return $self->{_model};
    }

    if ( $self->version && $self->version >= 3 ) {
        if ( $self->data_type eq 'aa' ) {
            return 'LG';    # protein
} else { return 'HKY85'; # DNA
} } else { if ( $self->data_type ) { return 'JTT'; # protein
} else { return 'HKY'; # DNA
} }
}
kappadescriptionprevnextTop
sub kappa {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless $value =~ /^[-+]?\d*\.?\d*$/
              or $value eq 'e';
        $self->{_kappa} = $value;
    }
    return 'e' unless defined $self->{_kappa};
    return 'e' if $self->{_kappa} eq 'e';
    return sprintf( "%.1f", $self->{_kappa} );
}
invardescriptionprevnextTop
sub invar {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless $value =~ /^[-+]?\d*\.\d*$/
              or $value eq 'e';
        $self->{_invar} = $value;
    }
    return 'e' unless defined $self->{_invar};
    return 'e' if $self->{_invar} eq 'e';
    return sprintf( "%.1f", $self->{_invar} );
}
category_numberdescriptionprevnextTop
sub category_number {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid postive integer [$value]"
          unless $value =~ /^[+]?\d*$/ and $value > 0;
        $self->{_category_number} = $value;
    }
    return $self->{_category_number} || 1;
}
alphadescriptionprevnextTop
sub alpha {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless $value =~ /^[-+]?\d*\.?\d*$/
              or $value eq 'e';
        $self->{_alpha} = $value;
    }
    return 'e' unless defined $self->{_alpha};
    return 'e' if $self->{_alpha} eq 'e';
    return sprintf( "%.1f", $self->{_alpha} ) || 'e';
}
treedescriptionprevnextTop
sub tree {
    my ( $self, $value ) = @_;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless -e $value or $value eq 'BIONJ';
        $self->{_tree} = $value;
    }
    return $self->{_tree} || 'BIONJ';
}
opt_topologydescriptionprevnextTop
sub opt_topology {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [opt_topology] for to PhyML v3")
      if $self->version && $self->version >= 3;
    if ( defined($value) ) {
        if ($value) {
            $self->{_opt_topology} = 1;
        }
        else {
            $self->{_opt_topology} = 0;
        }
    }
    return $self->{_opt_topology} || 1;
}
opt_lengthsdescriptionprevnextTop
sub opt_lengths {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [opt_lengths] for PhyML v3")
      if $self->version && $self->version >= 3;
    if ( defined($value) ) {
        if ($value) {
            $self->{_opt_lengths} = 1;
        }
        else {
            $self->{_opt_lengths} = 0;
        }
    }
    return $self->{_opt_lengths} || 1;
}
freqdescriptionprevnextTop
sub freq {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [freq] prior to PhyML v3")
      if $self->version < 3;
    if ( defined $value ) {
        die "Invalid value [$value]"
          unless $value =~ /^[\d\. ]$/
              or $value eq 'e'
              or $value eq 'd';
        $self->{_freq} = $value;
    }
    return $self->{_freq};
}
optdescriptionprevnextTop
sub opt {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [opt] prior to PhyML v3")
      if $self->version < 3;
    if ( defined($value) ) {
        $self->{_opt} = $value if $value =~ /tlr|tl|tr|l|n/;
    }
    return $self->{_opt} || 'n';
}
searchdescriptionprevnextTop
sub search {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [search] prior to PhyML v3")
      if $self->version < 3;
    if ( defined($value) ) {
        $self->{_search} = $value if $value =~ /NNI|SPR|BEST/;
    }
    return $self->{_search} || 'NNI';
}
rand_startdescriptionprevnextTop
sub rand_start {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [rand_start] prior to PhyML v3")
      if $self->version < 3;
    if ( defined($value) ) {
        if ($value) {
            $self->{_rand_start} = 1;
        }
        else {
            $self->{_rand_start} = 0;
        }
    }
    return $self->{_rand_start} || 0;
}
rand_startsdescriptionprevnextTop
sub rand_starts {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [rand_starts] prior to PhyML v3")
      if $self->version < 3;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless $value =~ /^[-+]?\d+$/;
        $self->{_rand_starts} = $value;
    }
    return $self->{_rand_starts} || 1;
}
rand_seeddescriptionprevnextTop
sub rand_seed {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [rand_seed] prior to PhyML v3")
      if $self->version < 3;
    if ( defined $value ) {
        die "Invalid number [$value]"
          unless $value =~ /^[-+]?\d+$/;
        $self->{_rand_seed} = $value;
    }
    return $self->{_rand_seed} || int rand 1000000;
}
no_memory_checkdescriptionprevnextTop
sub no_memory_check {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [no_memory_check] prior to PhyML v3")
      if $self->version < 3;
    if ( defined($value) ) {
        if ($value) {
            $self->{_no_memory_check} = 1;
        }
        else {
            $self->{_no_memory_check} = 0;
        }
    }
    return $self->{_no_memory_check} || 0;
}
bootstrapdescriptionprevnextTop
sub bootstrap {
    my ( $self, $value ) = @_;
    $self->throw("Not a valid parameter [bootstrap] prior to PhyML v3")
      if $self->version < 3;
    if ( defined $value ) {
        die "Invalid number [$value]" unless $value =~ /^\d+$/;
        $self->{_bootstrap} = $value;
    }
    return $self->{_bootstrap};
}
commanddescriptionprevnextTop
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} || '';
}
_rundescriptionprevnextTop
sub _run {
    my ( $self, $file ) = @_;

    my $exe = $self->executable || return;

    my $command;
    my $output_stat_file;
    if ( $self->version >= 3 ) {
        $command          = $exe . " -i $file" . $self->_setparams;
        $output_stat_file = '_phyml_stats.txt';
    }
    else {
        $command = $exe . " $file " . $self->arguments . $self->_setparams;
        $output_stat_file = '_phyml_stat.txt';
    }

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

    # stats
{ my $stat_file = $file . $output_stat_file; open( my $FH_STAT, "<", $stat_file ) || $self->throw( "Phyml call ($command) did not give an output [$stat_file]: $?"); local $/; $self->{_stats} .= <$FH_STAT>; } #print $self->{stats};
# tree
my $tree_file = $file . '_phyml_tree.txt'; { open( my $FH_TREE, "<", $tree_file ) || $self->throw("Phyml call ($command) did not give an output: $?"); local $/; $self->{_tree} .= <$FH_TREE>; } open( my $FH_TREE, "<", $tree_file ) || $self->throw("Phyml call ($command) did not give an output: $?"); my $treeio = Bio::TreeIO->new( -format => 'nhx', -fh => $FH_TREE ); my $tree = $treeio->next_tree; # could be faster to parse the tree only if needed?
return $tree;
}
_setparamsdescriptionprevnextTop
sub _setparams {
    my $self = shift;
    my $param_string;

    if ( $self->version >= 3 ) {

        # version 3 or higher
$param_string = ' -d ' . $self->data_type; $param_string .= ' -q ' if $self->data_format eq 's'; $param_string .= ' -n ' . $self->dataset_count if $self->dataset_count > 1; $param_string .= ' -b ' . $self->bootstrap if $self->bootstrap; # $param_string .= ' 0'; # no bootstrap sets
$param_string .= ' -m ' . $self->model; $param_string .= ' -f ' . $self->freq if $self->freq; if ( $self->data_type eq 'dna' ) { $param_string .= ' -t ' . $self->kappa; } $param_string .= ' -v ' . $self->invar; $param_string .= ' -c ' . $self->category_number; $param_string .= ' -a ' . $self->alpha; $param_string .= ' -u ' . $self->tree if $self->tree ne 'BIONJ'; $param_string .= ' -o ' . $self->opt if $self->opt; $param_string .= ' -s ' . $self->search; if ( $self->search eq 'SPR' ) { $param_string .= ' --rand_start ' if $self->rand_start; $param_string .= ' --n_rand_starts ' . $self->rand_starts if $self->rand_starts; $param_string .= ' --r_seed ' . $self->rand_seed; } $param_string .= ' --no_memory_check ' if $self->no_memory_check; } else { # version 2
$param_string = ' ' . $self->data_type; $param_string .= ' ' . $self->data_format; $param_string .= ' ' . $self->dataset_count; $param_string .= ' 0'; # no bootstrap sets
$param_string .= ' ' . $self->model; unless ( $self->data_type ) { # only for DNA
$param_string .= ' ' . $self->kappa; } $param_string .= ' ' . $self->invar; $param_string .= ' ' . $self->category_number; $param_string .= ' ' . $self->alpha; $param_string .= ' ' . $self->tree; $param_string .= ' ' . $self->opt_topology; $param_string .= ' ' . $self->opt_lengths; } return $param_string;
}
_write_phylip_align_filedescriptionprevnextTop
sub _write_phylip_align_file {
    my ( $self, $align ) = @_;

    my $tempfile = File::Spec->catfile( $self->tempdir, "aln$$.phylip" );
    $self->data_format('i');
    my $out = Bio::AlignIO->new(
        '-file'        => ">$tempfile",
        '-format'      => 'phylip',
        '-interleaved' => 0,
        '-longid'      => 1
    );
    $out->write_aln($align);
    $out->close();
    $out = undef;
    return $tempfile;
}

1;
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
SupportTop
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
the web:
  http://bugzilla.open-bio.org/
AUTHOR - Heikki LehvaslaihoTop
heikki at bioperl dot org
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _
GetsettersTop
These methods are used to set and get program parameters before running.
v2 optionsTop
These methods can be used with PhyML v2* only.
v3 optionsTop
These methods can be used with PhyML v3* only.
Internal methodsTop
These methods are private and should not be called outside this class.