Bio::Tools::Run Cap3
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::Tools::Run::Cap3 - wrapper for CAP3
Package variables
No package variables defined.
Included modules
Bio::Factory::ApplicationFactoryI
Bio::Root::IO
Bio::Root::Root
Bio::Seq
Bio::SeqIO
Bio::Tools::Run::WrapperBase
Inherit
Bio::Factory::ApplicationFactoryI Bio::Root::Root
Synopsis
  # Build a Cap3 factory with an (optional) parameter list
my @params = ('y', '150');
my $factory = Bio::Tools::Run::Cap3->new(@params);
# Specify where CAP3 is installed, if not the default directory (/usr/local/bin): $factory->program_dir('/opt/bio/bin'); # Pass the factory an input file name... my $result = $factory->run($filename); # or an array of Sequence objects my $result = $factory->run(@seqs);
Description
  Wrapper module for CAP3 program
Methods
BEGIN Code
new
No description
Code
AUTOLOAD
No description
Code
program_dir
No description
Code
program_name
No description
Code
run
No description
Code
_setparams
No description
Code
_setinput
No description
Code
Methods description
None available.
Methods code
BEGINTop
BEGIN {
    @PARAMS     = qw(a b c d e f g h i j k m n o p r s t u v w x y z);
$PROGRAMDIR = '/usr/local/bin'; # Authorize attribute fields
foreach my $attr (@PARAMS) { $OK_FIELD{$attr}++;
}
newdescriptionprevnextTop
sub new {
    my ( $caller, @args ) = @_;

    # chained new
my $self = $caller->SUPER::new(@args); $self->{'_program_dir'} = $PROGRAMDIR; # to facilitiate tempfile cleanup
my ( undef, $tempfile ) = $self->io->tempfile(); $self->outfile_name($tempfile); while (@args) { my $attr = shift @args; my $value = shift @args; $self->$attr($value); } return $self;
}
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
    my $self = shift;
    my $attr = $AUTOLOAD;
    $attr =~ s/.*:://;
    my $attr_letter = substr( $attr, 0, 1 );

    # actual key is first letter of $attr unless first attribute
# letter is underscore (as in _READMETHOD), the $attr is a CAP3
# parameter and should be truncated to its first letter only
$attr = ( $attr_letter eq '_' ) ? $attr : $attr_letter; $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; $self->{$attr_letter} = shift if @_; return $self->{$attr_letter};
}
program_dirdescriptionprevnextTop
sub program_dir {
    my($self, $new_dir) = @_;
    if (defined($self)) {
        $self->{'_program_dir'} = $new_dir if (defined($new_dir));
        return $self->{'_program_dir'};
    }
    return $PROGRAMDIR;
}
program_namedescriptionprevnextTop
sub program_name {
    'cap3';
}
rundescriptionprevnextTop
sub run {
	my ($self, $input) = @_;
	my $param_string = $self->_setparams;
	my $exe = $self->executable(undef);
    $self->throw("couldn't find executable for " . $self->program_name() . " in " . $self->program_dir()) if (!defined($exe));
	# Create input file pointer
my $infilename1 = $self->_setinput($input); if (! $infilename1) { $self->throw(" $input ($infilename1) not array of Bio::Seq objects or file name!"); } my $commandstring = $exe . " $infilename1 " . $param_string; open(CAP3, "$commandstring |") || $self->throw(sprintf("%s call crashed: %s %s\n", $self->program_name, $!, $commandstring)); local $/ = undef; my ($result) = <CAP3>; close CAP3; return $result;
}
_setparamsdescriptionprevnextTop
sub _setparams {
    my $self = shift;
    my ( $attr, $value, @execparams );

    @execparams = @PARAMS;

    my $param_string = "";
    for $attr (@execparams)
    {
        $value = $self->$attr();
        next unless ( defined $value );

        # put params in format expected by CAP3
$attr = '-' . $attr; $param_string .= " $attr $value "; } return $param_string;
}
_setinputdescriptionprevnextTop
sub _setinput {
	my ($self, $input1) = @_;
	my ($seq, $temp, $infilename1, $fh ) ;

	# If $input1 is not a reference it better be the name of a file
# with the sequence data...
$self->io->_io_cleanup(); SWITCH: { unless (ref $input1) { $infilename1 = (-e $input1) ? $input1 : 0 ; last SWITCH; } # $input may be an array of BioSeq objects...
if (ref($input1) =~ /ARRAY/i ) { ($fh,$infilename1) = $self->io->tempfile(); $temp = Bio::SeqIO->new(-fh=> $fh, '-format' => 'Fasta'); foreach $seq (@$input1) { unless ($seq->isa("Bio::PrimarySeqI")) {return 0;} $temp->write_seq($seq); } close $fh; $fh = undef; last SWITCH; } $infilename1 = 0; # Set error flag if you get here
} # End SWITCH
return ($infilename1); } 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 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
Support Top
 
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
the bugs and their resolution. Bug reports can be submitted via the
web:
  http://bugzilla.open-bio.org/
AUTHORSTop
Marc Logghe
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _