| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Webservice::InterMine::Simple::Service; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
37
|
|
|
|
1
|
|
|
|
|
39
|
|
|
4
|
1
|
|
|
1
|
|
661
|
use Webservice::InterMine::Simple::Query; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
47
|
|
|
5
|
1
|
|
|
1
|
|
1073
|
use Webservice::InterMine::Simple::Template; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
50
|
|
|
6
|
1
|
|
|
1
|
|
1616
|
use LWP; |
|
|
1
|
|
|
|
|
58539
|
|
|
|
1
|
|
|
|
|
35
|
|
|
7
|
1
|
|
|
1
|
|
928
|
use MIME::Base64; |
|
|
1
|
|
|
|
|
751
|
|
|
|
1
|
|
|
|
|
82
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use constant USER_AGENT => 'WebserviceInterMinePerlAPIClient'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
378
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Webservice::InterMine::Simple::Service |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $service = get_service("http://www.flymine.org/query/service"); |
|
18
|
|
|
|
|
|
|
my $query = $service->new_query; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$query->add_view("Organism.shortName", "Organism.taxonId"); |
|
21
|
|
|
|
|
|
|
$query->add_constraint({path => "Organism.genus", op => "=", value => "Rattus"}); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@rows = $query2->results_table; |
|
24
|
|
|
|
|
|
|
for my $row (@rows) { |
|
25
|
|
|
|
|
|
|
print "name: $row->[0], id: $row->[1]\n"; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This is a basic representation of a connection to an InterMine web-service. It has |
|
31
|
|
|
|
|
|
|
some facilities for handling simple queries and templates. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 new - Construct a new service. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Parameters: |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item root => $url |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The root url of the webservice. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item token => $token |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
The authorisation token of the user (optional) |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item user => $username |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
The login name of the user (optional - requires a password) |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item pass => $password |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The password of the user. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=back |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
|
62
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
63
|
0
|
|
|
|
|
|
my $self = {@_}; |
|
64
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
|
65
|
0
|
|
|
|
|
|
$ua->env_proxy; |
|
66
|
0
|
|
|
|
|
|
$ua->agent(USER_AGENT); |
|
67
|
0
|
0
|
0
|
|
|
|
if ($self->{user} and $self->{pass}) { |
|
68
|
0
|
|
|
|
|
|
my $auth_string = join(':', $self->{user}, $self->{pass}); |
|
69
|
0
|
|
|
|
|
|
$ua->default_header( Authorization => encode_base64($auth_string) ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
0
|
|
|
|
|
|
$self->{ua} = $ua; |
|
72
|
0
|
|
|
|
|
|
return bless $self, $class; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 new_from_xml |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Construct a new query from an XML serialisation. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Parameters: |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * source_file => $filename |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * source_string => $string |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Only one source argument is required. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub new_from_xml { |
|
94
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
95
|
0
|
|
|
|
|
|
my %args = @_; |
|
96
|
0
|
|
|
|
|
|
$args{service} = $self; |
|
97
|
0
|
|
|
|
|
|
return Webservice::InterMine::Simple::Query->new_from_xml(%args); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 new_query |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Construct a new blank query. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub new_query { |
|
107
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
108
|
0
|
|
|
|
|
|
my %args = @_; |
|
109
|
0
|
|
|
|
|
|
$args{service} = $self; |
|
110
|
0
|
|
|
|
|
|
return Webservice::InterMine::Simple::Query->new(%args); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 template($name) |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Construct a new template object to retrieve results from the template |
|
116
|
|
|
|
|
|
|
with the given name. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub template { |
|
121
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
122
|
0
|
|
|
|
|
|
my $name = shift; |
|
123
|
0
|
|
|
|
|
|
my %args = ( |
|
124
|
|
|
|
|
|
|
name => $name, |
|
125
|
|
|
|
|
|
|
service => $self, |
|
126
|
|
|
|
|
|
|
); |
|
127
|
0
|
|
|
|
|
|
return Webservice::InterMine::Simple::Template->new(%args); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=over 4 |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * L For a more powerful alternative |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=back |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Alex Kalderimis C<< >> |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 BUGS |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Please report any bugs or feature requests to C. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SUPPORT |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
perldoc Webservice::InterMine |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can also look for information at: |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=over 4 |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * InterMine |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * Documentation |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=back |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Copyright 2006 - 2011 FlyMine, all rights reserved. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
171
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
1; |
|
177
|
|
|
|
|
|
|
|