BioPerl-Run

 view release on metacpan or  search on metacpan

lib/Bio/Tools/Run/Phylo/Molphy/ProtML.pm  view on Meta::CPAN

use vars qw(@ISA $PROGRAMNAME $PROGRAM $MINNAMELEN %VALIDVALUES %VALIDFLAGS);
use strict;
use Bio::Tools::Run::WrapperBase;
use Bio::Tools::Phylo::Molphy;
use Bio::AlignIO;
use Bio::TreeIO;
use Bio::Root::Root;

@ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase );

BEGIN {
    $MINNAMELEN = 25;

    %VALIDFLAGS = (
		   'models' => { # models
		       jtt          => 'j', # Jones, Taylor & Thornton (1992)
		       'jtt-f'      => 'jf', # jtt w/ frequencies
		       dayhoff      => 'd', # Dahoff et al. (1978)
		       'dayhoff-f'  => 'df', # dayhoff w/ frequencies
		       mtrev24      => 'm', # Adachi & Hasegwa (1995)
		       'mtrev24-f'  => 'mf', # mtREV24 w/ frequencies
		       poisson      => 'p', # Poisson
		       proportional => 'pf', # Proportional
		       rsr          => 'r', # Relative Substitution Rate
		       'rsr-f'      => 'rf', # RSR w/ frequencies
		       frequencies  => 'f', # data frequencies
		   },
		   'search' => { # search strategy
		       usertrees     => 'u', # must also supply tree
		       rearrangement => 'R', # local rearrangement
		       lbp           => 'RX', # local boostrap prob
		       exhaustive    => 'e', # exhaustive
		       star          => 's', # star decomposition search (may not be ML)
		       quick         => 'q', # quick add OTU search (may not be ML)
		       distance      => 'D', # ML Distance matrix --> NJDIST
		   },
		   'others' => { # others
		       'norell-bp'   => 'b',
		       sequential    => 'S', # sequential format
		       interleaved   => 'I', # interleaved format
		       minimumevolution => 'M', # minimum evolution
		       verbose       => 'v', # verbose to stderr
		       information    => 'i', # output some information
		       w             => 'w', # some extra information
		   }
		   );
    # this will allow for each of the parameters to also accept the original
    # protML params
    my @toadd;
    foreach my $type ( keys %VALIDFLAGS ) {
	my @keys = keys %{ $VALIDFLAGS{$type} };
	for my $k ( @keys ) {
	    my $v = $VALIDFLAGS{$type}->{$k};
	    $VALIDFLAGS{$type}->{$v} = $v;
	}
    }
    %VALIDVALUES = (num_retained     => sub { my $a = shift;
					      if( $a =~ /^\d+$/) {
						  return 'n';
						  }}, # should be a number
		    percent_retained => sub { my $a = shift;
					      if( $a =~ /^\d+$/ &&
						  $a >= 0 && $a <= 100) {
						  return 'P';
					      }}
		    );


}

=head2 program_name

 Title   : program_name
 Usage   : >program_name()
 Function: holds the program name
 Returns:  string
 Args    : None

=cut

sub program_name {
        return 'protml';
}

=head2 program_dir

 Title   : program_dir
 Usage   : ->program_dir()
 Function: returns the program directory, obtained from ENV variable.
 Returns:  string
 Args    :

=cut

sub program_dir {
        return Bio::Root::IO->catfile($ENV{MOLPHYDIR}) if $ENV{MOLPHYDIR};
}

=head2 new

 Title   : new
 Usage   : my $obj = Bio::Tools::Run::Phylo::Molphy::ProtML->new();
 Function: Builds a new Bio::Tools::Run::Phylo::Molphy::ProtML object
 Returns : Bio::Tools::Run::Phylo::Molphy::ProtML
 Args    : -alignment => the Bio::Align::AlignI object
           -save_tempfiles => boolean to save the generated tempfiles and
                              NOT cleanup after onesself (default FALSE)
           -tree => the Bio::Tree::TreeI object
           -params => a hashref of PAML parameters (all passed to
						    set_parameter)
           -executable => where the protml executable resides

See also: L<Bio::Tree::TreeI>, L<Bio::Align::AlignI>


=cut

sub new {
  my($class,@args) = @_;

  my $self = $class->SUPER::new(@args);



( run in 0.836 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )