Permalink
Browse files

This commit was manufactured by cvs2svn to create tag

'bioperl-devel-1-1-1'.

svn path=/bioperl-live/tags/bioperl-devel-1-1-1/; revision=4913
  • Loading branch information...
1 parent 60ef2d2 commit e85b78e6b6f7f83c86db6f38a8dd17c9e2dfe9c5 nobody committed Oct 13, 2002
Showing with 0 additions and 381 deletions.
  1. +0 −248 Bio/Tools/Run/WrapperBase.pm
  2. +0 −133 t/StandAloneBlast.t
@@ -1,248 +0,0 @@
-# $Id$
-#
-# BioPerl module for Bio::Tools::Run::WrapperBase
-#
-# Cared for by Jason Stajich <jason@bioperl.org>
-#
-# Copyright Jason Stajich
-#
-# You may distribute this module under the same terms as perl itself
-
-# POD documentation - main docs before the code
-
-=head1 NAME
-
-Bio::Tools::Run::WrapperBase - A Base object for wrappers around executables
-
-=head1 SYNOPSIS
-
-# do not use this object directly, it provides the following methods
-# for its subclasses
-
- my $errstr = $obj->error_string();
- my $exe = $obj->executable();
- $obj->save_tempfiles($booleanflag)
- my $outfile= $obj->outfile_name();
- my $outfile= $obj->tempdir(); # get a temporary dir for executing
- my $io = $obj->io; # Bio::Root::IO object
- my $cleanup= $obj->cleanup(); # remove tempfiles
-
-=head1 DESCRIPTION
-
-Describe the object here
-
-=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
-the Bioperl mailing list. Your participation is much appreciated.
-
- bioperl-l@bioperl.org - General discussion
- http://bioperl.org/MailList.shtml - About the mailing lists
-
-=head2 Reporting Bugs
-
-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
-email or the web:
-
- bioperl-bugs@bioperl.org
- http://bioperl.org/bioperl-bugs/
-
-=head1 AUTHOR - Jason Stajich
-
-Email jason@bioperl.org
-
-Describe contact details here
-
-=head1 CONTRIBUTORS
-
-Additional contributors names and emails here
-
-=head1 APPENDIX
-
-The rest of the documentation details each of the object methods.
-Internal methods are usually preceded with a _
-
-=cut
-
-
-# Let the code begin...
-
-
-package Bio::Tools::Run::WrapperBase;
-use vars qw(@ISA);
-use strict;
-
-# Object preamble - inherits from Bio::Root::Root
-
-use Bio::Root::RootI;
-use Bio::Root::IO;
-
-@ISA = qw(Bio::Root::RootI);
-
-
-
-=head2 error_string
-
- Title : error_string
- Usage : $obj->error_string($newval)
- Function: Where the output from the last analysus run is stored.
- Returns : value of error_string
- Args : newvalue (optional)
-
-
-=cut
-
-sub error_string{
- my ($self,$value) = @_;
- if( defined $value) {
- $self->{'_error_string'} = $value;
- }
- return $self->{'_error_string'} || '';
-}
-
-
-=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
-
-sub no_param_checks{
- my ($self,$value) = @_;
- if( defined $value || ! defined $self->{'no_param_checks'} ) {
- $value = 0 unless defined $value;
- $self->{'no_param_checks'} = $value;
- }
- return $self->{'no_param_checks'};
-}
-
-=head2 save_tempfiles
-
- Title : save_tempfiles
- Usage : $obj->save_tempfiles($newval)
- Function:
- Returns : value of save_tempfiles
- Args : newvalue (optional)
-
-
-=cut
-
-sub save_tempfiles{
- my ($self,$value) = @_;
- if( defined $value) {
- $self->{'save_tempfiles'} = $value;
- }
- return $self->{'save_tempfiles'};
-}
-
-=head2 outfile_name
-
- Title : outfile_name
- Usage : my $outfile = $wrapper->outfile_name();
- Function: Get/Set the name of the output file for this run
- (if you wanted to do something special)
- Returns : string
- Args : [optional] string to set value to
-
-
-=cut
-
-sub outfile_name{
- my ($self,$nm) = @_;
- if( defined $nm || ! defined $self->{'_outfilename'} ) {
- $nm = 'mlc' unless defined $nm;
- $self->{'_outfilename'} = $nm;
- }
- return $self->{'_outfilename'};
-}
-
-
-=head2 tempdir
-
- Title : tempdir
- Usage : my $tmpdir = $self->tempdir();
- Function: Retrieve a temporary directory name (which is created)
- Returns : string which is the name of the temporary directory
- Args : none
-
-
-=cut
-
-sub tempdir{
- my ($self) = @_;
-
- unless( $self->{'_tmpdir'} ) {
- $self->{'_tmpdir'} = $self->io->tempdir();
- }
- unless( -d $self->{'_tmpdir'} ) {
- mkdir($self->{'_tmpdir'},0777);
- }
- $self->{'_tmpdir'};
-}
-
-=head2 cleanup
-
- Title : cleanup
- Usage : $wrapper->cleanup();
- Function: Will cleanup the tempdir directory after a PAML run
- Returns : none
- Args : none
-
-
-=cut
-
-sub cleanup{
- my ($self) = @_;
- $self->io->_io_cleanup();
- if( defined $self->{'_tmpdir'} &&
- -d $self->{'_tmpdir'} ) {
- $self->io->rmtree($self->{'_tmpdir'});
- }
-}
-
-=head2 io
-
- Title : io
- Usage : $obj->io($newval)
- Function: Gets a L<Bio::Root::IO> object
- Returns : L<Bio::Root::IO> object
- Args : none
-
-
-=cut
-
-sub io{
- my ($self) = @_;
- unless( defined $self->{'io'} ) {
- $self->{'io'} = new Bio::Root::IO(-verbose => $self->verbose());
- }
- return $self->{'io'};
-}
-
-=head2 version
-
- Title : version
- Usage : $version = $wrapper->version()
- Function: Returns the program version (if available)
- Returns : string representing version of the program
- Args : [Optional] value to (re)set version string
-
-
-=cut
-
-sub version{
- my ($self,@args) = @_;
- return undef;
-}
-
-1;
View
@@ -1,133 +0,0 @@
-# -*-Perl-*-
-## Bioperl Test Harness Script for Modules
-## $Id$
-#
-
-use strict;
-use constant NUMTESTS => 10;
-BEGIN {
- eval { require Test; };
- if( $@ ) {
- use lib 't';
- }
- use Test;
- plan tests => NUMTESTS;
-}
-
-END {
- foreach( $Test::ntest..NUMTESTS) {
- skip('Blast or env variables not installed correctly',1);
- }
- unlink('blastreport.out');
-}
-
-use Bio::Tools::BPlite;
-use Bio::Tools::Run::StandAloneBlast;
-use Bio::SeqIO;
-use Bio::AlignIO;
-use Bio::Seq;
-use Bio::Root::IO;
-use Bio::SearchIO;
-
-ok(1);
-my $verbose = -1;
-my ($blast_report, $hsp, @testresults);
-
-my $nt_database = 'ecoli.nt';
-my $amino_database = 'swissprot';
-
-my @params = ('program' => 'blastn', 'database' => $nt_database ,
- '_READMETHOD' => 'SearchIO',
- 'output' => 'blastreport.out');
-my $factory = Bio::Tools::Run::StandAloneBlast->new('-verbose' => $verbose,
- @params);
-
-ok $factory;
-
-my $inputfilename = Bio::Root::IO->catfile("t","data","test.txt");
-my $program = 'blastn';
-
-my $blast_present = Bio::Tools::Run::StandAloneBlast->exists_blast();
-if( ! $blast_present ) {
- skip('Blast not installed',1);
- exit;
-} else {
- ok($blast_present);
-}
-if( ! defined $Bio::Tools::Run::StandAloneBlast::DATADIR ) {
- print STDERR "must have BLASTDIR and BLASTDB or BLASTDATADIR env variable set\n";
- exit();
-}
-my $nt_database_file = Bio::Root::IO->catfile($Bio::Tools::Run::StandAloneBlast::DATADIR, $nt_database);
-ok($nt_database_file, qr/$nt_database/);
-my $amino_database_file = Bio::Root::IO->catfile($Bio::Tools::Run::StandAloneBlast::DATADIR, $amino_database);
-my $file_present = -e $nt_database_file;
-my $file_present2 = -e $amino_database_file;
-unless ($blast_present && $file_present && $file_present2) {
- warn "blast program or databases [$nt_database,$amino_database] not found. Skipping rest of tests\n";
- exit 0;
-}
-
-if ($nt_database eq 'ecoli.nt') {
- $testresults[3] = '$blast_report->num_hits == 1' ;
- $testresults[4] = '$hsp->score == 182';
- $testresults[5] = '$hsp->score == 182';
-} else {
- $testresults[3] = '$blast_report->num_hits';
- $testresults[4] = '$hsp->score';
- $testresults[5] = '$hsp->score';
-}
-if ($amino_database eq 'swissprot') {
- $testresults[8] = '$blast_report->number_of_iterations == 2';
-} else {
- $testresults[8] = '$blast_report->number_of_iterations';
-
-}
- $blast_report = $factory->blastall($inputfilename);
-ok $testresults[3];
-
-$factory->_READMETHOD('BPlite'); # Note required leading underscore in _READMETHOD
-
-my $str = Bio::SeqIO->new(-file=>Bio::Root::IO->catfile("t","data","dna2.fa") , '-format' => 'Fasta', );
-my $seq1 = $str->next_seq();
-my $seq2 = $str->next_seq();
-
-my $BPlite_report = $factory->blastall($seq1);
-my $sbjct = $BPlite_report->nextSbjct;
- $hsp = $sbjct->nextHSP;
-ok $testresults[4];
-
-
-my @seq_array =($seq1,$seq2);
-my $seq_array_ref = \@seq_array;
-
-my $BPlite_report2 = $factory->blastall(\@seq_array);
- $sbjct = $BPlite_report2->nextSbjct;
- $hsp = $sbjct->nextHSP;
-ok $testresults[5];
-
-@params = ('-verbose' => $verbose,
- 'program' => 'blastp'); # This used to be blastp but atleast on my implementation it should be T
-$factory = Bio::Tools::Run::StandAloneBlast->new(@params);
-
-$str = Bio::SeqIO->new(-file=>Bio::Root::IO->catfile("t","data","amino.fa") , '-format' => 'Fasta', );
-my $seq3 = $str->next_seq();
-my $seq4 = $str->next_seq();
-
-my $bl2seq_report = $factory->bl2seq($seq3, $seq4);
-$hsp = $bl2seq_report->next_feature;
-ok $hsp->hit()->start, 167, " failed creating or parsing bl2seq report object";
-
-
-@params = ('database' => $amino_database);
-$factory = Bio::Tools::Run::StandAloneBlast->new(@params);
-
-
-my $iter = 2;
-$factory->j($iter); # 'j' is blast parameter for # of iterations
-my $new_iter = $factory->j();
-
-ok $new_iter, 2, " failed setting blast parameter";
-
-$blast_report = $factory->blastpgp($seq3);
-ok $testresults[8];

0 comments on commit e85b78e

Please sign in to comment.