[Bioperl-guts-l] bioperl-live/scripts/utilities remote_blast.PLS, 1.4, 1.5

Brian Osborne bosborne at pub.open-bio.org
Fri Mar 17 10:29:14 EST 2006


Update of /home/repository/bioperl/bioperl-live/scripts/utilities
In directory pub.open-bio.org:/tmp/cvs-serv11236/scripts/utilities

Modified Files:
	remote_blast.PLS 
Log Message:
Evan's version


Index: remote_blast.PLS
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/scripts/utilities/remote_blast.PLS,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** remote_blast.PLS	16 Jan 2006 04:26:30 -0000	1.4
--- remote_blast.PLS	17 Mar 2006 15:29:11 -0000	1.5
***************
*** 1,8 ****
! #!perl -w
  # BioPerl module for remote_blast.pl
  #
! # Cared for by Jason Stajich <jason-at-bioperl-dot-org>
  #
! # Copyright Jason Stajich
  #
  # You may distribute this module under the same terms as perl itself
--- 1,11 ----
! #!/usr/bin/perl -w
! # $Id$
! #
  # BioPerl module for remote_blast.pl
  #
! # Revived by Evan Weaver for bioperl-1.5.1
! # 3/14/2006
  #
! # Copyright Jason Stajich, Evan Weaver
  #
  # You may distribute this module under the same terms as perl itself
***************
*** 17,25 ****
  use Getopt::Long;
  
! $USAGE = "remote_blast.pl [-h] [-p prog] [-d db] [-e expect] [-mod Blast] [-f seqformat] -i seqfile\n";
  
  my ($prog, $db, $expect,$method) = ( 'blastp', 'nr', '10', 'Blast');
  
! my ($sequencefile,$sequenceformat,$help) = (undef, 'fasta',undef);
  
  &GetOptions('prog|p=s'               => \$prog,
--- 20,31 ----
  use Getopt::Long;
  
! $USAGE = "remote_blast.pl [-h] [-p prog] [-d db] [-e expect] [-mod
! Blast] [-f seqformat] -z=\"entrez query\" -v 1 -t output_format -i
! seqfile\n";
  
  my ($prog, $db, $expect,$method) = ( 'blastp', 'nr', '10', 'Blast');
  
! my ($sequencefile,$sequenceformat,$help, $entrez, $outputformat,
! $verbose) = (undef, 'fasta',undef, undef, undef, 1);
  
  &GetOptions('prog|p=s'               => \$prog,
***************
*** 27,34 ****
  				'expect|e=s'             => \$expect,
  				'blsmod|module|method=s' => \$method,
! 				'input|i=s'              => \$sequencefile,  	    
  				'format|f=s'             => \$sequenceformat,
! 				'help|h'                 => \$help, 
! 	    );
  
  if( $help ) {
--- 33,43 ----
  				'expect|e=s'             => \$expect,
  				'blsmod|module|method=s' => \$method,
! 				'input|i=s'              => \$sequencefile,  	
  				'format|f=s'             => \$sequenceformat,
! 				'help|h'                 => \$help,
! 				'entrez|z=s'             => \$entrez,
! 				'output_format|t=s'      => \$outputformat,
! 				'verbose|v=s'            => \$verbose
! 			  );
  
  if( $help ) {
***************
*** 43,53 ****
      die($USAGE . "\n\tMust specify a db to search\n");
  }
  
! my $blastfactory = new Bio::Tools::Run::RemoteBlast (
! 							  '-prog'      => $prog,
! 						     '-data'      => $db,
! 						     '-expect'    => $expect,
! 						     'readmethod' => $method,
! 						     );
  
  # submit_blast can only currenly handle fasta format files so I'll
--- 52,76 ----
      die($USAGE . "\n\tMust specify a db to search\n");
  }
+ if( !defined $sequencefile ) {
+     die($USAGE . "\n\tMust specify an input file\n");
+ }
  
! my $blastfactory = new Bio::Tools::Run::RemoteBlast ('-prog' => $prog,
! 																	  '-data'      => $db,
! 																	  '-expect'    => $expect,
! 																	  'readmethod' => $method,
! 																	 );
! 
! if ($entrez) {
!   if ($verbose) {
!     print "Entrez query (submission side): $entrez\n";
!   }
!   #$Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{ FORMAT_ENTREZ_QUERY} = $entrez;
!   $Bio::Tools::Run::RemoteBlast::HEADER{ ENTREZ_QUERY } = $entrez;
! }
! if ($outputformat) {
!   print "Don't use output format type; it doesn't work.\n";
!   $Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{ FORMAT_TYPE } = $outputformat;
! }
  
  # submit_blast can only currenly handle fasta format files so I'll
***************
*** 63,93 ****
  	}
  	$input = \@seqs;
! } else { 
  	$input = $sequencefile;
  }
! $blastfactory->submit_blast($input);
! print "retrieving blasts..";
! while( my @rids = $blastfactory->each_rid ) {
! 	foreach my $rid ( @rids ) {
! 		my $rc = $blastfactory->retrieve_blast($rid);
! 		if( !ref($rc) ) {
! 			if( $rc < 0 ) { 
! 				# there was an error and this RID is not coming back
! 				$blastfactory->remove_rid($rid);
! 			}
! 			print ".";
! 			sleep 5;
! 		} else { 
! 			print "\n";
! 			$blastfactory->remove_rid($rid);
! 			while( my $sbjct = $rc->next_result ) {		
! 				print "sbjct name is ", $sbjct->query_name, "\n";
! 				while( my $hsp = $sbjct->next_hit ) {
! 					print "score is ", $hsp->score, "\n";
! 				} 
! 			}
! 		}
! 	}
  }
  
  __END__
--- 86,125 ----
  	}
  	$input = \@seqs;
! } else {
  	$input = $sequencefile;
  }
! 
! my $r = $blastfactory->submit_blast($input);
! #my $r = $factory->submit_blast(?amino.fa?);
! 
! print STDERR "waiting...\n" if( $verbose > 0 );
! while ( my @rids = $blastfactory->each_rid ) {
!   foreach my $rid ( @rids ) {
!     my $rc = $blastfactory->retrieve_blast($rid);
!     if( !ref($rc) ) {
!       if( $rc < 0 ) {
!         $blastfactory->remove_rid($rid);
!       }
!       print STDERR "   checking $rid\n" if ( $verbose > 0 );
!       sleep 5;
!     } else {
!       my $result = $rc->next_result();
!       #save the output
!       my $filename = $result->query_name()."\.out";
!       $blastfactory->save_output($filename);
!       $blastfactory->remove_rid($rid);
!       print "\nQuery Name: ", $result->query_name(), "\n";
!       while ( my $hit = $result->next_hit ) {
!         next unless ( $verbose > 0);
!         print "\thit name is ", $hit->name, "\n";
!         while( my $hsp = $hit->next_hsp ) {
!           print "\t\tscore is ", $hsp->score, "\n";
!         }
!       }
!     }
!   }
!   print STDERR scalar(@rids) . " left\n";
  }
+ 	
  
  __END__



More information about the Bioperl-guts-l mailing list