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

Annotation of /FigKernelScripts/svr_is_hypo.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : overbeek 1.1 use strict;
2 :     use Data::Dumper;
3 :     use Carp;
4 :    
5 :     #
6 :     # This is a SAS Component
7 :     #
8 :    
9 :    
10 :     =head1 svr_is_hypo [-c N] [-v]
11 :    
12 :     Keep just hypotheticals
13 :    
14 :     ------
15 :    
16 :     Example:
17 :    
18 :     svr_all_features 3702.1 peg | svr_is_hypo
19 :    
20 :     would produce a 1-column table containing the hypotheticals in 3702.1
21 :    
22 :     ------
23 :    
24 :     The standard input should be a tab-separated table (i.e., each line
25 :     is a tab-separated set of fields). Normally, the last field in each
26 :     line would contain the PEG . If some other column contains the PEGs, use
27 :    
28 :     -c N
29 :    
30 :     where N is the column (from 1) that contains the PEG in each case.
31 :    
32 :     This is a pipe command. The input is taken from the standard input, and the
33 :     output is to the standard output.
34 :    
35 :     =head2 Command-Line Options
36 :    
37 :     =over 4
38 :    
39 :     =item -c Column
40 :    
41 :     This is used only if the column containing PEGs is not the last.
42 :    
43 :     -item -v [keep only non-hypotheticals]
44 :    
45 :     =back
46 :    
47 :     =head2 Output Format
48 :    
49 :     This is a filter producing a subset of the input lines.
50 :    
51 :     =cut
52 :    
53 :     use SeedUtils;
54 :     use SAPserver;
55 :     my $sapObject = SAPserver->new();
56 :     use Getopt::Long;
57 :    
58 :     my $usage = "usage: svr_is_hypo [-c column] [-v]";
59 :    
60 :     my $column;
61 :     my $v;
62 :     my $rc = GetOptions('c=i' => \$column,
63 :     'v' => \$v);
64 :     if (! $rc) { print STDERR $usage; exit }
65 :    
66 :     my @lines = map { chomp; [split(/\t/,$_)] } <STDIN>;
67 :     (@lines > 0) || exit;
68 :     if (! $column) { $column = @{$lines[0]} }
69 :     my @fids = map { $_->[$column-1] } @lines;
70 :    
71 :     my $functions = $sapObject->ids_to_functions(-ids => \@fids);
72 :     foreach $_ (@lines)
73 :     {
74 :     my $func = $functions->{$_->[$column-1]};
75 :     my $hypo = &SeedUtils::hypo($func);
76 :     if (((! $v) && $hypo) || ($v && (! $hypo)))
77 :     {
78 :     print join("\t",@$_),"\n";
79 :     }
80 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3