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

Annotation of /FigKernelScripts/svr_reactions_to_roles.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 use strict;
2 :    
3 :     use Getopt::Long;
4 :     use SeedUtils;
5 :     use ScriptThing;
6 :     use SAPserver;
7 :    
8 :     #
9 :     # This is a SAS Component
10 :     #
11 :    
12 :    
13 :     =head1 svr_reactions_to_roles
14 :    
15 :     Takes as input a table containing reaction IDs and
16 :     adds a column giving the roles that implement the reactions
17 :    
18 :     ------
19 :     Example: svr_all_reactions | svr_reactions_to_roles > table.with.reactions.and.roles
20 :    
21 :     would produce a 2-column table of reaction IDs and the roles that implement each reaction.
22 :    
23 :     ------
24 :    
25 :     =back
26 :    
27 :     =head2 Command-Line Options
28 :    
29 :     =over 4
30 :    
31 :     =item -c Column
32 :    
33 :     This is used only if the column containing reaction IDs is not the last.
34 :    
35 :     =back
36 :    
37 :     =head2 Output Format
38 :    
39 :     The standard output is a tab-delimited file. It consists of the input
40 :     file with an extra column added (a role that is part of the set that
41 :     implements the reaction ID). Note that this implies that there will
42 :     often be multiple output lines for a single input line.
43 :    
44 :     =cut
45 :    
46 :     use SeedUtils;
47 :     use SAPserver;
48 :     my $sapObject = SAPserver->new();
49 :     use Getopt::Long;
50 :    
51 :     my $usage = "usage: svr_reactions_to_roles [-c column]";
52 :    
53 :     my $column;
54 :     my $rc = GetOptions('c=i' => \$column);
55 :     if (! $rc) { print STDERR $usage; exit }
56 :    
57 :     while (my @lines = ScriptThing::GetBatch(\*STDIN, 10, $column)) {
58 :     my @reactions = map { $_->[0] } @lines;
59 :     my $reactionsH = $sapObject->reactions_to_roles( -ids => \@reactions );
60 :     for my $line (@lines) {
61 :     my ($rxn, $text) = @$line;
62 :     my $roles = $reactionsH->{$rxn};
63 :     for my $role (@$roles) {
64 :     print "$text\t$role\n";
65 :     }
66 :     }
67 :     }
68 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3