4
# After running this script, you will have a collection of
5
# NCBI BLAST queue submission data files. These can be read by
6
# retrieve_blast.pl to fetch the actual BLAST reports from NCBI.
7
# See comments in retrieve_blast.pl for usage details.
9
#---------------------------------------------------------------------------
10
# PROGRAM : blast_seq.pl
11
# PURPOSE : To submit a set of sequence for Blast analysis and parse the results.
12
# AUTHOR : Steve Chervitz
13
# CREATED : 15 May 1998
14
# REVISION : $Id: blast_seq.pl,v 1.7 2002/01/11 08:05:38 sac Exp $
15
# WEBSITE : http://bio.perl.org/Projects/Blast/
16
# USAGE : blast_seq.pl -h
17
# EXAMPLES : blast_seq.pl -eg
20
# Set the require ".../blast_config.pl" and require ".../seqtools.pl"
21
# to point to the proper location of these files on your system.
22
# See blast_config.pl and seqtools.pl for additional steps.
26
# For all further modifications, refer to the cvs log.
28
# sac, 3 Feb 1999: Added -wait argument to example to prevent timeout
29
# while reading sequence data.
30
# sac, 16 Jun 1998: Added installation comment, require statement comments.
31
#---------------------------------------------------------------------------
33
# Using files in the examples/blast distribution directory:
34
require "../seq/seqtools.pl";
35
require "blast_config.pl";
36
# Proper paths after you install them in your system:
37
#require "/home/steve/bin/bioperl/examples/seq/seqtools.pl";#$require "/home/steve/bin/bioperl/examples/blast/blast_config.pl";
39
use vars qw($ID $VERSION $DESC %runParam %blastParam
40
$opt_parse $opt_table $opt_compress );
42
# Command-line options to be imported into seqtools.pl.
43
# This allows us to set all params we need with one GetOptions() call.
44
@blast_opts = qw(prog=s vers=s db=s html! v=s b=s expect=s gap!
45
filt=s mat=s gap_c=s gap_e=s email=s word=s
46
parse! signif=s strict! stats! best!
47
table=s compress! rem! loc! check_all! desc!
51
$DESC = "Run and parse a set of Blast reports given a set of Fasta formatted sequences";
55
&init_seq(\&blast_seq_usage, @blast_opts);
61
&load_seqs(\&blast_seq);
68
#---------------------
70
#---------------------
74
print STDERR <<"QQ_NOTE_QQ";
76
blast_seq.pl can take potentially many parameters since
77
it incorporates functionalities for both manipulating Fasta
78
sequence (seqtools.pl) and running/parsing Blast reports
79
(blast_config.pl). These parameters will be shown in three sets:
81
(1) parameters for manipulating the sequence file.
82
(2) parameters for running the Blast reports.
83
(3) parameters for parsing the Blast reports.
85
To familiarize yourself with all of the options, it would be a
86
good idea to try using the seq and blast example scripts individually.
90
print STDERR "Hit <RETURN> to view parameters."; <STDIN>;
94
print STDERR "Hit <RETURN> to view Blast run parameters."; <STDIN>;
96
&blast_params; # print both run and parse params.
97
&blast_general_params;
106
(Run this in the examples/blast/ directory of the distribution.)
108
./$ID seq/seqs.fasta -eid -prog blastp -db yeast -signif 1e-5 -table 2 -wait 300
110
(The wait argument is necessary to prevent a possible timeout while reading sequences.)
118
# This method will be called for each sequence in the indicated file.
119
# Each sequence is sent off for blast analysis and then the
120
# resulting blast object is processed further.
124
print STDERR "\nBLASTing sequence ${\$seq->id}\n";
126
$runParam{-seqs} = [ $seq ];
127
$blastParam{-run} = \%runParam;
129
# Verifying the data structure:
130
# print STDERR "Sequence to be blasted:\n";
131
# print STDERR $blastParam{-run}->{-seqs}->[0]->layout();
135
$blast_obj = &create_blast;
138
print STDERR "\nTROUBLE Blasting:\n$@\n";
142
# We no longer can create Blast objects from NCBI submissions
143
# since we get back queue information, not the actual BLAST
144
# report. Hence, create_blast always fails, so there's
147
return 0 unless ref($blast_obj);
149
$opt_compress && $blast_obj->compress_file;
153
&print_table($blast_obj);
155
$blast_obj->display();