[Bio] / FigKernelPackages / SSserver.pm Repository:
ViewVC logotype

View of /FigKernelPackages/SSserver.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (download) (as text) (annotate)
Wed Jun 24 16:24:24 2009 UTC (10 years, 5 months ago) by olson
Branch: MAIN
Changes since 1.5: +4 -2 lines
switch to the servers.nmpdr.org name

package SSserver;

#
# This is a SAS Component
#

use LWP::UserAgent;
use Data::Dumper;
use YAML;

use strict;

sub new
{
    my($class, $server_url) = @_;

    $server_url = "http://servers.nmpdr.org/subsystem/server.cgi" unless $server_url;
#    $server_url = "http://bio-macpro-2.mcs.anl.gov/~disz/FIG/subsystem_server_sapling.cgi" unless $server_url;
#    $server_url = "http://bio-big.mcs.anl.gov/server/FIG/subsystem_server_sapling.cgi" unless $server_url;
    
    #$server_url = "http://bio-macpro-1.mcs.anl.gov/ross-proj/FIG/co_occurs_server.cgi" unless $server_url;

    my $self = {
        server_url => $server_url,
        ua => LWP::UserAgent->new(),
    };
    $self->{ua}->timeout(30*60);
    return bless $self, $class;
}

sub is_in_subsystem {
        my ($self, @args) = @_;
        return $self->run_query("is_in_subsystem", @args);
}
sub is_in_subsystem_with {
        my ($self, @args) = @_;
        return $self->run_query("is_in_subsystem_with", @args);
}

sub all_subsystems {
        my ($self, @args) = @_;
        return $self->run_query("all_subsystems", @args);
}

sub subsystem_spreadsheet {
        my ($self, @args) = @_;
        return $self->run_query("subsystem_spreadsheet", @args);
}


sub metabolic_reconstruction {
        my ($self, @args) = @_;
        return $self->run_query("metabolic_reconstruction", @args);
}

sub run_query
{
    my($self, $function, @args ) = @_;

	    my $arg_string = Dump(@args);
            my $form = [function => $function,
                        args => "$arg_string"];

            my $res = $self->{ua}->post($self->{server_url}, $form);
            if ($res->is_success)
            {
		return Load($res->content);
            }
            else
            {
                die "error on post " . $res->content;
            }
}


1;




MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3