BioPerl-Run
view release on metacpan or search on metacpan
lib/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm view on Meta::CPAN
This option is to be used with gene frequencies datatype
option to specify that all alleles at each locus are in
the input file.
Defaults to NULL
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<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.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
http://redmine.open-bio.org/projects/bioperl/
=head1 AUTHOR - Shawn Hoon
Email shawnh@fugu-sg.org
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
#'
package Bio::Tools::Run::Phylo::Phylip::SeqBoot;
use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR $PROGRAMNAME
@SEQBOOT_PARAMS @OTHER_SWITCHES
%OK_FIELD);
use strict;
use Bio::SimpleAlign;
use Bio::AlignIO;
use Bio::TreeIO;
use Bio::Tools::Run::Phylo::Phylip::Base;
use Bio::Tools::Run::Phylo::Phylip::PhylipConf qw(%Menu);
use Bio::Matrix::PhylipDist;
use Cwd;
# inherit from Phylip::Base which has some methods for dealing with
# Phylip specifics
@ISA = qw(Bio::Tools::Run::Phylo::Phylip::Base);
# You will need to enable the SeqBoot program. This
# can be done in (at least) 3 ways:
#
# 1. define an environmental variable PHYLIPDIR:
# export PHYLIPDIR=/home/shawnh/PHYLIP/bin
#
# 2. include a definition of an environmental variable CLUSTALDIR in
# every script that will use Clustal.pm.
# $ENV{PHYLIPDIR} = '/home/shawnh/PHYLIP/bin';
#
# 3. You can set the path to the program through doing:
# my @params('executable'=>'/usr/local/bin/seqboot');
# my $SeqBoot_factory = Bio::Tools::Run::Phylo::Phylip::SeqBoot->new(@params);
#
BEGIN {
@SEQBOOT_PARAMS = qw(DATATYPE PERMUTE BLOCKSIZE REPLICATES READWEIGHTS READCAT);
@OTHER_SWITCHES = qw(QUIET);
foreach my $attr(@SEQBOOT_PARAMS,@OTHER_SWITCHES) {
$OK_FIELD{$attr}++;
}
}
=head2 program_name
Title : program_name
Usage : >program_name()
Function: holds the program name
Returns: string
Args : None
=cut
sub program_name {
return 'seqboot';
}
=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{PHYLIPDIR}) if $ENV{PHYLIPDIR};
}
lib/Bio/Tools/Run/Phylo/Phylip/SeqBoot.pm view on Meta::CPAN
=head2 _setinput()
Title : _setinput
Usage : Internal function, not to be called directly
Function: Create input file for SeqBoot program
Example :
Returns : name of file containing a multiple alignment in Phylip format
Args : SimpleAlign object reference or input file name
=cut
sub _setinput {
my ($self, $input) = @_;
my ($alnfilename,$tfh);
# a phy formatted alignment file
unless (ref $input) {
# check that file exists or throw
$alnfilename= $input;
unless (-e $input) {return 0;}
return $alnfilename;
}
my @input = ref($input) eq 'ARRAY' ? @{$input}: ($input);
($tfh,$alnfilename) = $self->io->tempfile(-dir=>$self->tempdir);
my $alnIO = Bio::AlignIO->new(-fh => $tfh,
-format=>'phylip',
-idlength=>$self->idlength());
foreach my $input(@input){
# $input should be a Bio::Align::AlignI
$input->isa("Bio::Align::AlignI") || $self->throw("Expecting a Bio::Align::AlignI object");
# Open temporary file for both reading & writing of BioSeq array
$alnIO->write_aln($input);
}
$alnIO->close();
close($tfh);
return $alnfilename;
}
=head2 _setparams()
Title : _setparams
Usage : Internal function, not to be called directly
Function: Create parameter inputs for SeqBoot program
Example :
Returns : parameter string to be passed to SeqBoot
Args : name of calling object
=cut
sub _setparams {
my ($attr, $value, $self);
#do nothing for now
$self = shift;
my $param_string = "";
my $cat = 0;
my $gene_freq = 0;
my %menu = %{$Menu{$self->version}->{'SEQBOOT'}};
foreach my $attr ( @SEQBOOT_PARAMS) {
$value = $self->$attr();
next unless (defined $value);
if ($attr =~/REPLICATES/i){
if( $value !~ /(\d+(\.\d+)?)/ ) {
$self->warn("Expected a number in $attr\n");
next;
}
$param_string .= $menu{'REPLICATES'}."$value\n";
}
elsif($attr=~/DATATYPE/i){
$gene_freq = 1 if $value =~/GENEFREQ/i;
$param_string .= $menu{'DATATYPE'}{uc $value};
}
else {
if($attr =~/ALLELES/i){
if(!$gene_freq){
$self->warn("Alleles options only be used with alleles option");
return;
}
$param_string .=$menu{uc $attr};
}
}
}
$param_string .= $menu{'SUBMIT'};
return $param_string;
}
=head1 Bio::Tools::Run::Wrapper methods
=cut
=head2 no_param_checks
Title : no_param_checks
Usage : $obj->no_param_checks($newval)
Function: Boolean flag as to whether or not we should
trust the sanity checks for parameter values
Returns : value of no_param_checks
Args : newvalue (optional)
=cut
=head2 save_tempfiles
Title : save_tempfiles
Usage : $obj->save_tempfiles($newval)
Function:
Returns : value of save_tempfiles
Args : newvalue (optional)
=cut
=head2 outfile_name
( run in 0.900 second using v1.01-cache-2.11-cpan-5b529ec07f3 )