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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3