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

Annotation of /FigKernelScripts/svr_reactions_in_model.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 ScriptThing;
5 :     use SAPserver;
6 :    
7 :     #
8 :     # This is a SAS Component
9 :     #
10 :    
11 :    
12 :     =head1 svr_reactions_in_model
13 :    
14 :     Takes as input a table containing model IDs and
15 :     adds a column giving a reaction in the model. Since each model contains
16 :     hundreds of reactions, the output file will be extremely large compared to the
17 :     input file.
18 :    
19 :     ------
20 :     Example: svr_all_models | svr_reactions_in_model > table.with.reactions
21 :    
22 :     would produce a 3-column table: [genomeID, modelID,reactionID]
23 :    
24 :     ------
25 :    
26 :     =back
27 :    
28 :     =head2 Command-Line Options
29 :    
30 :     =over 4
31 :    
32 :     =item -c Column
33 :    
34 :     This is used only if the column containing reaction IDs is not the last.
35 :    
36 :     =back
37 :    
38 :     =head2 Output Format
39 :    
40 :     The standard output is a tab-delimited file. It consists of the input
41 :     file with two extra columns (distance and connected reaction).
42 :    
43 :     =cut
44 :    
45 :     use SeedUtils;
46 :     use SAPserver;
47 :     my $sapObject = SAPserver->new();
48 :     use Getopt::Long;
49 :    
50 :     my $usage = "usage: svr_reactions_in_model [-c column] < models > models.with.reactions";
51 :    
52 :     my $column;
53 :     my $rc = GetOptions('c=i' => \$column,
54 :     );
55 :     if (! $rc) { print STDERR $usage; exit }
56 :    
57 :     while (my @lines = ScriptThing::GetBatch(\*STDIN, 10, $column)) {
58 :     my $reactionsH = $sapObject->models_to_reactions( -ids => [map { $_->[0] } @lines] );
59 :     for my $line (@lines) {
60 :     my ($model, $text) = @$line;
61 :     my $reactions = $reactionsH->{$model};
62 :     for my $reaction (@$reactions) {
63 :     print "$text\t$reaction\n";
64 :     }
65 :     }
66 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3