| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TAIR::Blast; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26257
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
25
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
27
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
137842
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
63000
|
|
|
|
1
|
|
|
|
|
31
|
|
|
7
|
1
|
|
|
1
|
|
901
|
use HTTP::Request::Common; |
|
|
1
|
|
|
|
|
2227
|
|
|
|
1
|
|
|
|
|
751
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
TAIR::Blast - A module to gather automated BLAST result from TAIR (http://www.arabidopsis.org/Blast/index.jsp) |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 1.01 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This module simply automatically! BLAST any type of sequences (nucleotide, protein) with using different type of algorithm (blastp, blastn, tblastx etc.) by using TAIR Blast engine. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use TAIR::Blast; |
|
27
|
|
|
|
|
|
|
use Bio::DB::Fasta; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $TB = TAIR::Blast->new(); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $fasta_file = "seqs.fasta"; |
|
32
|
|
|
|
|
|
|
my $algorithm = "blastn"; #other set : blastp, blastx, tblastx,tblastn |
|
33
|
|
|
|
|
|
|
my $maxscore; |
|
34
|
|
|
|
|
|
|
my $blast_target_set; |
|
35
|
|
|
|
|
|
|
my $verbose = 1; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $stream = Bio::DB::Fasta->new($fasta_file)->get_PrimarySeq_stream; |
|
38
|
|
|
|
|
|
|
while (my $query = $stream->next_seq) { |
|
39
|
|
|
|
|
|
|
my $query_seq = $query->seq; |
|
40
|
|
|
|
|
|
|
my $result = $TB->connect($query,$query_seq,$algorithm,$maxscore,$blast_target_set,$verbose); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
my $output_file = "output_file.txt"; |
|
43
|
|
|
|
|
|
|
$TB->write($output_file); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Object-oriented master-hash! |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub new |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
0
|
|
|
0
|
1
|
|
my %master_hash; |
|
56
|
0
|
|
|
|
|
|
return(bless(\%master_hash, __PACKAGE__)); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 connect |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Blast parameters, do not mess with them unless you know what you are doing. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub connect |
|
66
|
|
|
|
|
|
|
{ |
|
67
|
0
|
|
|
0
|
1
|
|
my $tair_master = shift; |
|
68
|
0
|
|
|
|
|
|
my $query = shift; |
|
69
|
0
|
|
|
|
|
|
my $query_seq = shift; |
|
70
|
0
|
|
|
|
|
|
my $algorithm = shift; |
|
71
|
|
|
|
|
|
|
#my $out_type = shift; #will be used in v2 |
|
72
|
0
|
|
|
|
|
|
my $maxscore = shift; |
|
73
|
0
|
|
|
|
|
|
my $blast_target_set = shift; |
|
74
|
0
|
|
|
|
|
|
my $verbose = shift; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if (!defined($blast_target_set)) { |
|
77
|
0
|
0
|
|
|
|
|
if ($algorithm =~ /^blast[px]$/i){ |
|
|
|
0
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$blast_target_set = "ATH1_pep"; |
|
79
|
|
|
|
|
|
|
}elsif ($algorithm =~ /^blastn|tblastx|tblastn$/i){ |
|
80
|
0
|
|
|
|
|
|
$blast_target_set = "At_transcripts"; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $URLtoPostTo = "http://www.arabidopsis.org/cgi-bin/Blast/TAIRblast.pl"; |
|
85
|
0
|
|
|
|
|
|
my %Fields = ( |
|
86
|
|
|
|
|
|
|
"Algorithm" => $algorithm, |
|
87
|
|
|
|
|
|
|
"default_db" => "At_transcripts", |
|
88
|
|
|
|
|
|
|
"BlastTargetSet" => $blast_target_set, |
|
89
|
|
|
|
|
|
|
"textbox" => "seq", |
|
90
|
|
|
|
|
|
|
"QueryText" => $query_seq, |
|
91
|
|
|
|
|
|
|
"QueryFilter" => "T", |
|
92
|
|
|
|
|
|
|
"Matrix" => "Blosum62", |
|
93
|
|
|
|
|
|
|
"MaxScore" => "3", |
|
94
|
|
|
|
|
|
|
"Expectation" => "10", |
|
95
|
|
|
|
|
|
|
"MaxAlignments" => $maxscore, |
|
96
|
|
|
|
|
|
|
"NucleicMismatch" => "-3", |
|
97
|
|
|
|
|
|
|
"GappedAlignment" => "T", |
|
98
|
|
|
|
|
|
|
"NucleicMatch" => "1", |
|
99
|
|
|
|
|
|
|
"OpenPenalty" => "0", |
|
100
|
|
|
|
|
|
|
"ExtensionThreshold" => "0", |
|
101
|
|
|
|
|
|
|
"ExtendPenalty" => "0", |
|
102
|
|
|
|
|
|
|
"WordSize" => "0", |
|
103
|
|
|
|
|
|
|
"QueryGeneticCode" => "1", |
|
104
|
|
|
|
|
|
|
"Comment" => "optional, will be added to output for your use", |
|
105
|
|
|
|
|
|
|
"ReplyTo" => "", |
|
106
|
|
|
|
|
|
|
"ReplyVia" => "BROWSER", |
|
107
|
|
|
|
|
|
|
#"ReplyFormat" => $out_type, #will be used in v2 |
|
108
|
|
|
|
|
|
|
"ReplyFormat" => "TABULAR", |
|
109
|
|
|
|
|
|
|
"PageType" => "JavaScr" |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $BrowserName = "TAIR"; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $Browser = new LWP::UserAgent; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
|
if($BrowserName) { $Browser->agent($BrowserName); } |
|
|
0
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $Page = $Browser->request(POST $URLtoPostTo,\%Fields); |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
if ($Page->is_success) { |
|
121
|
0
|
|
|
|
|
|
my $output_raw = $Page->content; |
|
122
|
0
|
|
|
|
|
|
$output_raw =~ s/TAIR Blast Job Pending//g; |
|
123
|
0
|
|
|
|
|
|
my @output_array = split("\n", $output_raw); #[0]query/[1]hit/[10]e-value/[11]Score(bits) |
|
124
|
0
|
|
|
|
|
|
my %output_hsps; |
|
125
|
|
|
|
|
|
|
my @output_hsps; |
|
126
|
0
|
|
|
|
|
|
my $i = 1; |
|
127
|
0
|
|
|
|
|
|
foreach (@output_array){ |
|
128
|
0
|
|
|
|
|
|
my @details = split("\t",$_); |
|
129
|
0
|
0
|
|
|
|
|
if (defined($details[1])) { |
|
130
|
0
|
|
|
|
|
|
my %details = ( |
|
131
|
|
|
|
|
|
|
"hsp" => $i, |
|
132
|
|
|
|
|
|
|
"hits" => $details[1], |
|
133
|
|
|
|
|
|
|
"e-value" => $details[10], |
|
134
|
|
|
|
|
|
|
"score" => $details[11] |
|
135
|
|
|
|
|
|
|
); |
|
136
|
0
|
|
|
|
|
|
shift(@details); |
|
137
|
0
|
|
|
|
|
|
push (@output_hsps, \%details); |
|
138
|
0
|
|
|
|
|
|
$i++; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
} |
|
141
|
0
|
|
|
|
|
|
$tair_master->{'output'}->{$query}=\@output_hsps; |
|
142
|
0
|
0
|
|
|
|
|
if ($verbose == 1){ |
|
143
|
0
|
|
|
|
|
|
print $query, " is blasted!\n"; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
0
|
|
|
|
|
|
else { print $Page->message; } |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 write |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This subroutine handles output of the program, it writes the blast results into a specified file name. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub write |
|
157
|
|
|
|
|
|
|
{ |
|
158
|
0
|
|
|
0
|
1
|
|
my $tair_master = shift; |
|
159
|
0
|
|
|
|
|
|
my $output_file = shift; |
|
160
|
0
|
|
|
|
|
|
my ($output_file_hn); |
|
161
|
0
|
|
|
|
|
|
my $output_hash = $tair_master->{'output'}; |
|
162
|
0
|
0
|
|
|
|
|
open($output_file_hn, ">", $output_file) or die("Cannot open $output_file for writing: $!"); |
|
163
|
0
|
|
|
|
|
|
print $output_file_hn "query\thits\tscore\te-value\n"; |
|
164
|
0
|
|
|
|
|
|
foreach (keys %$output_hash){ |
|
165
|
0
|
|
|
|
|
|
my $next_query = $_; |
|
166
|
0
|
|
|
|
|
|
foreach(@{$output_hash->{$_}}){ |
|
|
0
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
print $output_file_hn $next_query,"\t", |
|
168
|
|
|
|
|
|
|
$_->{'hits'},"\t", |
|
169
|
|
|
|
|
|
|
$_->{'score'},"\t", |
|
170
|
|
|
|
|
|
|
$_->{'e-value'},"\n"; |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Haktan Suren, << >> |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 BUGS |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
182
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
183
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 SUPPORT |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
perldoc TAIR::Blast |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
You can also look for information at: |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=over 4 |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
L |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
L |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
L |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item * Search CPAN |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
L |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=back |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
LWP::UserAgent |
|
220
|
|
|
|
|
|
|
HTTP::Request::Common |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Special thanks to LC :) |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Copyright 2011 Haktan Suren. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
231
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
232
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=cut |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
1; # End of TAIR::Blast |