[Bio] / FigKernelScripts / svr_roles_to_reactions.pl Repository:
ViewVC logotype

View of /FigKernelScripts/svr_roles_to_reactions.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Mon Mar 7 19:50:41 2011 UTC (8 years, 11 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, myrast_rel40, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_release_3_0, mgrast_dev_03252011, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_10262011
New script for reactions of roles.

use strict;
use SeedUtils;
use SAPserver;
use ScriptThing;

# This is a SAS Component

=head1 svr_roles_to_reactions

Extend a set of roles to include the associated reactions

=head2 Introduction


    svr_roles_to_reactions < table.with.roles.as.last.column > extended.table

=head2 Command-Line Arguments

=over 4

=item -c=Column

Specifies the column in the input table that is believed to contain the role.


=head2 Output

A table with 1 added columnn containing reactions IDs. Since some roles trigger
multiple reactions, there may be more output lines than input lines. Those roles
that do not trigger any reactions will be missing from the output.


use Getopt::Long;
my $usage = "svr_roles_to_reactions [-c Column] < table.with.roles > extended.table\n";

my $column;
my $url = '';

my $rc = GetOptions( 
                     "c=i" => \$column,
                     "url=s" => \$url

$rc or print STDERR $usage and exit;

# Get the server object.
my $sapServer = SAPserver->new(url => $url);
# The main loop processes chunks of input, 1000 lines at a time.
while (my @tuples = ScriptThing::GetBatch(\*STDIN, undef, $column)) {
    # Ask the server for the reactions.
    my $roleHash = $sapServer->role_reactions(-ids => [map { $_->[0] } @tuples]);
    # Output the results for these roles.
    for my $tuple (@tuples) {
        # Get this line and the relevant role.
        my ($role, $line) = @$tuple;
        # Get this role's reactions.
        for my $reaction (@{$roleHash->{$role}}) {
            # Output the line with the subsystem and classification appended.
            print "$line\t$reaction\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3