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

Annotation of /FigKernelScripts/svr_fids_for_md5.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_fids_for_md5
13 :    
14 :     Given a set of md5 protein IDs, compute the FIG IDs of features that produce each
15 :     protein. This script takes as input a table containing md5 protein IDs and
16 :     adds a column containing the associated FIG feature IDs.
17 :    
18 :     ------
19 :     Example:
20 :    
21 :     svr_fids_for_md5 < md5_file > md5_file_with_fids
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 md5 protein 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 (the ID of a feature that produces the
41 :     specified protein). 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 :     use ScriptThing;
51 :    
52 :     my $usage = "usage: svr_fids_for_md5 [-c column]";
53 :    
54 :     my $column;
55 :     my $rc = GetOptions('c=i' => \$column);
56 :     if (! $rc) { print STDERR $usage; exit }
57 :     my $inFile = $ARGV[0] || '-';
58 :     open my $ih, "<$inFile";
59 :    
60 :     while (my @lines = ScriptThing::GetBatch($ih, 1000, $column)) {
61 :     my $md5H = $sapObject->proteins_to_fids(-prots => [map { $_->[0] } @lines] );
62 :     for my $line (@lines) {
63 :     my ($md5, $text) = @$line;
64 :     my $fids = $md5H->{$md5};
65 :     for my $fid (@$fids) {
66 :     print "$text\t$fid\n";
67 :     }
68 :     }
69 :     }
70 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3