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

Annotation of /FigKernelScripts/glue_tbl_to_metabolic_reconstruction.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.1 #!/usr/bin/perl -w
2 :    
3 :     #
4 :     # This is a SAS Component
5 :     #
6 :    
7 :     #
8 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
9 :     # for Interpretations of Genomes. All Rights Reserved.
10 :     #
11 :     # This file is part of the SEED Toolkit.
12 :     #
13 :     # The SEED Toolkit is free software. You can redistribute
14 :     # it and/or modify it under the terms of the SEED Toolkit
15 :     # Public License.
16 :     #
17 :     # You should have received a copy of the SEED Toolkit Public License
18 :     # along with this program; if not write to the University of Chicago
19 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
20 :     # Genomes at veronika@thefig.info or download a copy from
21 :     # http://www.theseed.org/LICENSE.TXT.
22 :     #
23 :    
24 :     #
25 :     # Takes two files on cmd line: metabolic reconstruction output and tab-delimlited tbl output.
26 :     # Column 2 of the reconstruction is expected to be a protein ID; append the contig/beg/end from the tbl
27 :     # file after that column.
28 :     #
29 :    
30 :     use strict;
31 :    
32 :     @ARGV == 2 or die "Usage: $0 reconstruction-output tbl-output\n";
33 :    
34 :     my $recon = shift;
35 :     my $tbl = shift;
36 :    
37 :     open(R, "<", $recon) or die "cannot open $recon: $!";
38 :     open(T, "<", $tbl) or die "cannot open $tbl: $!";
39 :    
40 :     my %tbl;
41 :     while (<T>)
42 :     {
43 :     chomp;
44 :     my(@a) = split(/\t/);
45 :     $tbl{$a[0]} = [@a];
46 :     }
47 :     close(T);
48 :    
49 :     while (<R>)
50 :     {
51 :     chomp;
52 :     my(@a) = split(/\t/);
53 :     my $l = $tbl{$a[1]};
54 :     if ($l)
55 :     {
56 :     splice(@a, 1, 1, @$l);
57 :     }
58 :     print join("\t", @a), "\n";
59 :     }
60 :    
61 :     close(R);
62 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3