Parent Directory
|
Revision Log
Revision 1.8 - (view) (download) (as text)
1 : | disz | 1.1 | |
2 : | package SSserver; | ||
3 : | |||
4 : | olson | 1.4 | # |
5 : | parrello | 1.8 | # This is a SAS Component. |
6 : | olson | 1.4 | # |
7 : | |||
8 : | disz | 1.1 | use LWP::UserAgent; |
9 : | use Data::Dumper; | ||
10 : | use YAML; | ||
11 : | |||
12 : | use strict; | ||
13 : | |||
14 : | sub new | ||
15 : | { | ||
16 : | my($class, $server_url) = @_; | ||
17 : | |||
18 : | parrello | 1.8 | # $server_url = "http://servers.nmpdr.org/subsystem/subsystem_server_sapling.cgi" unless $server_url; |
19 : | $server_url = "http://bio-macpro-1.mcs.anl.gov/~parrello/FIG/subsystem_server_sapling.cgi" unless $server_url; | ||
20 : | disz | 1.1 | #$server_url = "http://bio-macpro-1.mcs.anl.gov/ross-proj/FIG/co_occurs_server.cgi" unless $server_url; |
21 : | |||
22 : | my $self = { | ||
23 : | server_url => $server_url, | ||
24 : | ua => LWP::UserAgent->new(), | ||
25 : | }; | ||
26 : | disz | 1.5 | $self->{ua}->timeout(30*60); |
27 : | disz | 1.1 | return bless $self, $class; |
28 : | } | ||
29 : | |||
30 : | sub is_in_subsystem { | ||
31 : | my ($self, @args) = @_; | ||
32 : | return $self->run_query("is_in_subsystem", @args); | ||
33 : | } | ||
34 : | sub is_in_subsystem_with { | ||
35 : | my ($self, @args) = @_; | ||
36 : | return $self->run_query("is_in_subsystem_with", @args); | ||
37 : | } | ||
38 : | |||
39 : | sub all_subsystems { | ||
40 : | my ($self, @args) = @_; | ||
41 : | return $self->run_query("all_subsystems", @args); | ||
42 : | } | ||
43 : | |||
44 : | parrello | 1.8 | sub pegs_in_subsystems { |
45 : | my ($self, @args) = @_; | ||
46 : | return $self->run_query("pegs_in_subsystems", @args); | ||
47 : | } | ||
48 : | |||
49 : | disz | 1.1 | sub subsystem_spreadsheet { |
50 : | my ($self, @args) = @_; | ||
51 : | return $self->run_query("subsystem_spreadsheet", @args); | ||
52 : | } | ||
53 : | |||
54 : | |||
55 : | disz | 1.5 | sub metabolic_reconstruction { |
56 : | my ($self, @args) = @_; | ||
57 : | return $self->run_query("metabolic_reconstruction", @args); | ||
58 : | } | ||
59 : | |||
60 : | disz | 1.1 | sub run_query |
61 : | { | ||
62 : | my($self, $function, @args ) = @_; | ||
63 : | |||
64 : | my $arg_string = Dump(@args); | ||
65 : | my $form = [function => $function, | ||
66 : | args => "$arg_string"]; | ||
67 : | |||
68 : | my $res = $self->{ua}->post($self->{server_url}, $form); | ||
69 : | if ($res->is_success) | ||
70 : | { | ||
71 : | disz | 1.2 | return Load($res->content); |
72 : | disz | 1.1 | } |
73 : | else | ||
74 : | { | ||
75 : | die "error on post " . $res->content; | ||
76 : | } | ||
77 : | } | ||
78 : | |||
79 : | |||
80 : | 1; | ||
81 : | |||
82 : | |||
83 : |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |