| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TAIR::GeneDescriptions; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22740
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
28839
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
83065
|
|
|
|
1
|
|
|
|
|
41
|
|
|
7
|
1
|
|
|
1
|
|
9743
|
use HTTP::Request::Common; |
|
|
1
|
|
|
|
|
2511
|
|
|
|
1
|
|
|
|
|
749
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
TAIR::GeneDescriptions - Automatically download gene descriptions using locus identifiers (AGI codes) or gene names. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 1.00 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Automatically download gene descriptions using locus identifiers (AGI codes) or gene names. |
|
25
|
|
|
|
|
|
|
(http://www.arabidopsis.org/tools/bulk/genes/index.jsp) |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use TAIR::GeneDescriptions; |
|
29
|
|
|
|
|
|
|
my $TB = TAIR::GeneDescriptions->new(); |
|
30
|
|
|
|
|
|
|
my $verbose = "1"; |
|
31
|
|
|
|
|
|
|
my $input_file = "input_file.txt"; |
|
32
|
|
|
|
|
|
|
my $output_file = "output_file.txt"; |
|
33
|
|
|
|
|
|
|
my ($input_file_hn); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
open($input_file_hn, "<", $input_file) or die("Cannot open $input_file for reading: $!"); |
|
36
|
|
|
|
|
|
|
while (<$input_file_hn>) |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
|
|
|
|
|
|
chomp; |
|
39
|
|
|
|
|
|
|
my $query = $_; |
|
40
|
|
|
|
|
|
|
$TB->connect($query,$verbose); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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 $verbose = shift; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $URLtoPostTo = "http://www.arabidopsis.org/cgi-bin/bulk/genes/gene_descriptions"; |
|
72
|
0
|
|
|
|
|
|
my %Fields = ( |
|
73
|
|
|
|
|
|
|
"search_for" => $query, |
|
74
|
|
|
|
|
|
|
"search_against" => "rep_gene", |
|
75
|
|
|
|
|
|
|
"output_type" => "text", |
|
76
|
|
|
|
|
|
|
"textbox" => "seq" |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $BrowserName = "TAIR"; |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $Browser = new LWP::UserAgent; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if($BrowserName) { $Browser->agent($BrowserName); } |
|
|
0
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my $Page = $Browser->request(POST $URLtoPostTo,\%Fields); |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
if ($Page->is_success) { |
|
88
|
0
|
|
|
|
|
|
my $output_raw = $Page->content; |
|
89
|
0
|
|
|
|
|
|
my @output_array = split("\n", $output_raw); |
|
90
|
0
|
|
|
|
|
|
my $header = $output_array[0]; |
|
91
|
0
|
|
|
|
|
|
shift @output_array; |
|
92
|
0
|
|
|
|
|
|
my @output_itemized; |
|
93
|
0
|
|
|
|
|
|
my $i = 1; |
|
94
|
0
|
|
|
|
|
|
foreach (@output_array){ |
|
95
|
0
|
|
|
|
|
|
my @details = split("\t",$_); |
|
96
|
0
|
0
|
|
|
|
|
if (defined($details[1])) { |
|
97
|
0
|
|
|
|
|
|
my %details = ( |
|
98
|
|
|
|
|
|
|
"i" => $i, |
|
99
|
|
|
|
|
|
|
"locus_identifier" => $details[0], |
|
100
|
|
|
|
|
|
|
"gene_model_name" => $details[1], |
|
101
|
|
|
|
|
|
|
"gene_model_description" => $details[2], |
|
102
|
|
|
|
|
|
|
"gene_model_type" => $details[3], |
|
103
|
|
|
|
|
|
|
"primary_gene_symbol" => $details[4], |
|
104
|
|
|
|
|
|
|
"all_gene_symbols" => $details[5] |
|
105
|
|
|
|
|
|
|
); |
|
106
|
0
|
|
|
|
|
|
shift(@details); |
|
107
|
0
|
|
|
|
|
|
push (@output_itemized, \%details); |
|
108
|
0
|
|
|
|
|
|
$i++; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
} |
|
111
|
0
|
|
|
|
|
|
$tair_master->{'output'}->{$query}=\@output_itemized; |
|
112
|
0
|
0
|
|
|
|
|
if ($verbose == 1){ |
|
113
|
0
|
|
|
|
|
|
print $query, " is done!\n"; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
} |
|
116
|
0
|
|
|
|
|
|
else { print $Page->message; } |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 write |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This subroutine handles output of the program, it writes the results into a specified file name. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub write |
|
127
|
|
|
|
|
|
|
{ |
|
128
|
0
|
|
|
0
|
1
|
|
my $tair_master = shift; |
|
129
|
0
|
|
|
|
|
|
my $output_file = shift; |
|
130
|
0
|
|
|
|
|
|
my ($output_file_hn); |
|
131
|
0
|
|
|
|
|
|
my $output_hash = $tair_master->{'output'}; |
|
132
|
0
|
0
|
|
|
|
|
open($output_file_hn, ">", $output_file) or die("Cannot open $output_file for writing: $!"); |
|
133
|
0
|
|
|
|
|
|
print $output_file_hn "Locus Identifier \t Gene Model Name \t Gene Model Description \t Gene Model Type \t Primary Gene Symbol \t All Gene Symbols \n"; |
|
134
|
0
|
|
|
|
|
|
foreach (keys %$output_hash){ |
|
135
|
0
|
|
|
|
|
|
my $next_query = $_; |
|
136
|
0
|
|
|
|
|
|
foreach(@{$output_hash->{$_}}){ |
|
|
0
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
print $output_file_hn |
|
138
|
|
|
|
|
|
|
$_->{'locus_identifier'},"\t", |
|
139
|
|
|
|
|
|
|
$_->{'gene_model_name'},"\t", |
|
140
|
|
|
|
|
|
|
$_->{'gene_model_description'},"\t", |
|
141
|
|
|
|
|
|
|
$_->{'gene_model_type'},"\t", |
|
142
|
|
|
|
|
|
|
$_->{'primary_gene_symbol'},"\t", |
|
143
|
|
|
|
|
|
|
$_->{'all_gene_symbols'},"\n"; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Haktan Suren, C<< >> |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 BUGS |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
155
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
156
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 SUPPORT |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
perldoc TAIR::GeneDescriptions |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
You can also look for information at: |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=over 4 |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
L |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
L |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * Search CPAN |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
LWP::UserAgent |
|
193
|
|
|
|
|
|
|
HTTP::Request::Common |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Special thanks to LC :) |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Copyright 2011 Haktan Suren. |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
204
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
205
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
1; # End of TAIR::GeneDescriptions |