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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3