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

Annotation of /FigKernelScripts/svr_function_of.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : parrello 1.1 use strict;
2 : overbeek 1.3 use Data::Dumper;
3 :     use Carp;
4 : parrello 1.1
5 :    
6 : overbeek 1.3 =head1 svr_function_of
7 :    
8 :     Get functions of protein-encoding genes
9 :    
10 :     ------
11 :     Example: svr_all_features 3702.1 peg | svr_function_of
12 :    
13 :     would produce a 2-column table. The first column would contain
14 :     PEG IDs for genes occurring in genome 3702.1, and the second
15 :     would contain the functions of those genes.
16 :     ------
17 : parrello 1.1
18 : overbeek 1.3 The standard input should be a tab-separated table (i.e., each line
19 :     is a tab-separated set of fields). Normally, the last field in each
20 :     line would contain the PEG for which functions are being requested.
21 :     If some other column contains the PEGs, use
22 : parrello 1.1
23 : overbeek 1.3 -c N
24 : parrello 1.1
25 : overbeek 1.3 where N is the column (from 1) that contains the PEG in each case.
26 : parrello 1.1
27 : overbeek 1.3 This is a pipe command. The input is taken from the standard input, and the
28 :     output is to the standard output.
29 : parrello 1.1
30 :     =head2 Command-Line Options
31 :    
32 : overbeek 1.3 =item -c Column
33 : parrello 1.1
34 : overbeek 1.3 This is used only if the column containing PEGs is not the last.
35 : parrello 1.1
36 : overbeek 1.3 =head2 Output Format
37 : parrello 1.1
38 : overbeek 1.3 The standard output is a tab-delimited file. It consists of the input
39 :     file with an extra column added (the function associated with the PEG).
40 : parrello 1.1
41 : overbeek 1.3 =cut
42 : parrello 1.1
43 : overbeek 1.3 use SeedUtils;
44 :     use SAPserver;
45 :     my $sapObject = SAPserver->new();
46 : parrello 1.1
47 : overbeek 1.3 my $usage = "usage: svr_function_of [-c column]";
48 : parrello 1.1
49 : overbeek 1.3 my $column;
50 :     while ($ARGV[0] && ($ARGV[0] =~ /^-/))
51 :     {
52 :     $_ = shift @ARGV;
53 :     if ($_ =~ s/^-c//) { $column = ($_ || shift @ARGV) }
54 :     else { die "Bad Flag: $_" }
55 : parrello 1.1 }
56 :    
57 : overbeek 1.3 my @lines = map { chomp; [split(/\t/,$_)] } <STDIN>;
58 :     if (! $column) { $column = @{$lines[0]} }
59 :     my @fids = map { $_->[$column-1] } @lines;
60 :    
61 :     my $functions = $sapObject->ids_to_functions(-ids => \@fids);
62 :     foreach $_ (@lines)
63 :     {
64 :     print join("\t",@$_,$functions->{$_->[$column-1]}),"\n";
65 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3