| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
2
|
|
|
|
|
|
|
# This file is part of G-language Genome Analysis Environment package |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# Copyright (C) 2001-2009 Keio University |
|
5
|
|
|
|
|
|
|
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# $Id: G.pm,v 1.4 2002/07/30 17:40:56 gaou Exp $ |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# G-language GAE is free software; you can redistribute it and/or |
|
10
|
|
|
|
|
|
|
# modify it under the terms of the GNU General Public |
|
11
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
12
|
|
|
|
|
|
|
# version 2 of the License, or (at your option) any later version. |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# G-language GAE is distributed in the hope that it will be useful, |
|
15
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
17
|
|
|
|
|
|
|
# See the GNU General Public License for more details. |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public |
|
20
|
|
|
|
|
|
|
# License along with G-language GAE -- see the file COPYING. |
|
21
|
|
|
|
|
|
|
# If not, write to the Free Software Foundation, Inc., |
|
22
|
|
|
|
|
|
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
#END_HEADER |
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# written by Kazuharu Arakawa at |
|
27
|
|
|
|
|
|
|
# G-language Project, Institute for Advanced Biosciences, Keio University. |
|
28
|
|
|
|
|
|
|
# |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package Bio::Glite; |
|
31
|
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
42332
|
use 5.008; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
31
|
|
|
33
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
34
|
1
|
|
|
1
|
|
1288
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
54580
|
|
|
|
1
|
|
|
|
|
33
|
|
|
35
|
1
|
|
|
1
|
|
1146
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
12431
|
|
|
|
1
|
|
|
|
|
119
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
require Exporter; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
|
9
|
use base qw(Exporter); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1330
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
42
|
|
|
|
|
|
|
COMGA_correlation COMGA_table_maker DoubleHelix Ew P2 RNAfold _blast _clustalw _codon_usage_table _fasta _formatdb aaui align_pathway alignment amino_counter amino_info annotate_with_glimmerM baseParingTest base_counter base_entropy base_individual_information_matrix base_information_content base_relative_entropy base_z_value blastall bui cai calc_pI cbi circular_map codon_compiler codon_counter codon_mva codon_usage cognitor complement consensus_z cor cumulative diffseq dinuc dist_in_cc dnawalk dote enc filter_cds_by_atg find_dif find_dnaAbox find_iteron find_king_of_gene find_ori_ter find_pattern find_tandem find_ter fop foreach_RNAfold foreach_tandem gcsi gcskew gcwin generateGMap genes_from_ori genome_map genome_map2 genome_map3 genomicskew gopac gpac grapher graphical_LTR_search icdi leading_strand least_squares_fit load load_kegg_api longest_ORF ma_filter ma_normalize ma_rfilter markov max maxdex mean median min mindex molecular_weight nucleotide_periodicity oligomer_counter oligomer_search oligomer_translation over_lapping_finder palindrome peptide_mass phx plasmid_map query_arm query_strand read_goa rep_ori_ter run_glimmerM seq2png seqinfo seqret set_essentiality set_gc3 set_goa set_gpac set_operon set_strand shuffleseq signature splitprintseq standard_deviation sum test_gpac to_fasta togoWS translate ttest variance view_cds w_value ws |
|
43
|
|
|
|
|
|
|
load |
|
44
|
|
|
|
|
|
|
say |
|
45
|
|
|
|
|
|
|
p |
|
46
|
|
|
|
|
|
|
puts |
|
47
|
|
|
|
|
|
|
readFile |
|
48
|
|
|
|
|
|
|
writeFile |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $prefix = 'http://rest.g-language.org/'; |
|
56
|
|
|
|
|
|
|
my $upload = $prefix . 'upload/upl.pl'; |
|
57
|
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub load { |
|
60
|
0
|
|
|
0
|
1
|
|
my $this = {}; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
$_[0] = $ua->post($upload, 'Content_Type'=>'form-data', 'Content'=>['file'=>[$_[0]]])->content if(-e $_[0]); |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
foreach my $line (split(/\n/, $ua->get($prefix . $_[0] . '/disclose')->content)){ |
|
65
|
0
|
|
|
|
|
|
my ($feat, $key, $val) = split(/\t/, $line); |
|
66
|
0
|
0
|
|
|
|
|
if(length $val){ |
|
67
|
0
|
|
|
|
|
|
$this->{$feat}->{$key} = $val; |
|
68
|
|
|
|
|
|
|
}else{ |
|
69
|
0
|
|
|
|
|
|
$this->{$feat} = $key; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
foreach my $feat (keys %{$this}){ |
|
|
0
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
next unless($feat =~ /FEATURE/); |
|
75
|
0
|
0
|
|
|
|
|
next unless ($this->{$feat}->{type} =~ /CDS|RNA/); |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
$this->{$this->{$feat}->{gene}} = $this->{$feat} if(length $this->{$feat}->{gene}); |
|
78
|
0
|
0
|
|
|
|
|
$this->{$this->{$feat}->{locus_tag}} = $this->{$feat} if(length $this->{$feat}->{locus_tag}); |
|
79
|
0
|
0
|
|
|
|
|
$this->{'CDS' . $this->{$feat}->{cds}} = $this->{$feat} if($this->{$feat}->{type} eq 'CDS'); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$this->{filename} = $_[0]; |
|
83
|
0
|
|
|
|
|
|
print $ua->get($prefix . $_[0])->content; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return bless $this; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub AUTOLOAD{ |
|
91
|
0
|
|
|
0
|
|
|
our $AUTOLOAD; |
|
92
|
0
|
|
|
|
|
|
my $gb = shift; |
|
93
|
0
|
|
|
|
|
|
my @args = @_; |
|
94
|
0
|
|
|
|
|
|
my @method = split(/::/, $AUTOLOAD); |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my $i = 0; |
|
97
|
0
|
|
|
|
|
|
my (@new_args); |
|
98
|
0
|
|
|
|
|
|
while(defined $args[$i]){ |
|
99
|
0
|
0
|
0
|
|
|
|
if (substr($args[$i], 0, 1) eq '-' && substr($args[$i], 1, 1) !~ /[0-9]/){ |
|
100
|
0
|
0
|
0
|
|
|
|
if(!defined($args[$i + 1]) || substr($args[$i + 1], 0, 1) eq '-' && substr($args[$i + 1], 1, 1) !~ /[0-9]/){ |
|
|
|
|
0
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
push(@new_args, substr($args[$i], 1) . '=' . 1); |
|
102
|
0
|
|
|
|
|
|
$i ++; |
|
103
|
|
|
|
|
|
|
}else{ |
|
104
|
0
|
|
|
|
|
|
push(@new_args, substr($args[$i], 1) . '=' . $args[$i + 1]); |
|
105
|
0
|
|
|
|
|
|
$i += 2; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
}else{ |
|
108
|
0
|
|
|
|
|
|
push(@new_args, $args[$i]); |
|
109
|
0
|
|
|
|
|
|
$i ++; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my $url = $prefix . join('/', $gb->{filename}, $method[-1], @new_args); |
|
114
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new('GET', $url); |
|
115
|
0
|
|
|
|
|
|
my $res = $ua->simple_request($request); |
|
116
|
0
|
|
|
|
|
|
my $result; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
if($res->is_redirect){ |
|
119
|
0
|
|
|
|
|
|
$result = $res->header('Location'); |
|
120
|
|
|
|
|
|
|
}else{ |
|
121
|
0
|
0
|
|
|
|
|
if($res->is_success){ |
|
122
|
0
|
|
|
|
|
|
$result = $ua->get($url)->content; |
|
123
|
|
|
|
|
|
|
}else{ |
|
124
|
0
|
0
|
|
|
|
|
if($res->status_line =~ /404/){ |
|
125
|
0
|
|
|
|
|
|
die("no such function $method[-1]"); |
|
126
|
|
|
|
|
|
|
}else{ |
|
127
|
0
|
|
|
|
|
|
die($res->status_line); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
0
|
0
|
0
|
|
|
|
if($result =~ /\n +/ || $result =~ /http/){ |
|
133
|
0
|
|
|
|
|
|
print $result, "\n"; |
|
134
|
|
|
|
|
|
|
}else{ |
|
135
|
0
|
|
|
|
|
|
return split(/\n/, $result); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
0
|
|
|
sub DESTROY{} |
|
140
|
|
|
|
|
|
|
|
|
141
|
0
|
|
|
0
|
0
|
|
sub p{ print Dumper(@_), "\n"; } |
|
142
|
0
|
|
|
0
|
0
|
|
sub puts{ print @_, "\n"; } |
|
143
|
0
|
|
|
0
|
0
|
|
sub say{ print join(',', @_), "\n"; } |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub readFile{ |
|
146
|
0
|
|
|
0
|
0
|
|
my $file = shift; |
|
147
|
0
|
|
0
|
|
|
|
my $chomp = shift || 0; |
|
148
|
0
|
|
|
|
|
|
my @result; |
|
149
|
|
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
|
open(FILE, $file) || die($!); |
|
151
|
0
|
|
|
|
|
|
while(){ |
|
152
|
0
|
0
|
|
|
|
|
chomp if($chomp); |
|
153
|
0
|
|
|
|
|
|
push(@result, $_); |
|
154
|
|
|
|
|
|
|
} |
|
155
|
0
|
|
|
|
|
|
close(FILE); |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
|
if(wantarray()){ |
|
158
|
0
|
|
|
|
|
|
return @result; |
|
159
|
|
|
|
|
|
|
}else{ |
|
160
|
0
|
|
|
|
|
|
return join('', @result); |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub writeFile{ |
|
166
|
0
|
|
|
0
|
0
|
|
my $data = shift; |
|
167
|
0
|
|
0
|
|
|
|
my $file = shift || "out.txt"; |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
0
|
|
|
|
|
open(OUT, '>' . $file) || die($!); |
|
170
|
0
|
|
|
|
|
|
print OUT $data; |
|
171
|
0
|
|
|
|
|
|
close(OUT); |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
return $file; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
1; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
__END__ |