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

Annotation of /FigKernelScripts/svr_corr_by_exp.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_corr_by_exp
11 :    
12 :     Get genes that have similar expression profiles.
13 :    
14 :     ------
15 :    
16 :     Example:
17 :    
18 :     svr_all_features 83333.1 peg | svr_corr_by_exp
19 :    
20 :     would produce a 3-column table. The first column would contain
21 :     PEG IDs for genes occurring in genome 3702.1, the second would give the
22 :     Pearson correlation coefficient, and the third would give the PEG that
23 :     seems to have a similar expression profile..
24 :    
25 :     ------
26 :    
27 :     The standard input should be a tab-separated table (i.e., each line
28 :     is a tab-separated set of fields). Normally, the last field in each
29 :     line would contain the PEG for which functions are being requested.
30 :     If some other column contains the PEGs, use
31 :    
32 :     -c N
33 :    
34 :     where N is the column (from 1) that contains the PEG in each case.
35 :    
36 :     This is a pipe command. The input is taken from the standard input, and the
37 :     output is to the standard output.
38 :    
39 :     =head2 Command-Line Options
40 :    
41 :     =over 4
42 :    
43 :     =item -c Column
44 :    
45 :     This is used only if the column containing PEGs is not the last.
46 :    
47 :     =back
48 :    
49 :     =head2 Output Format
50 :    
51 :     The standard output is a tab-delimited file. It consists of lines from
52 :     the input file that are for PEGs that have Pearson correlation
53 :     coefficients that indicate potential correlation. The lines will have
54 :     two appended columns: the Pearson correlation coefficient and the
55 :     functionally PEG that appears to have a correlated profile.
56 :    
57 :     =cut
58 :    
59 :     use SeedUtils;
60 :     use SAPserver;
61 :     my $sapObject = SAPserver->new();
62 :     use Getopt::Long;
63 :    
64 :     my $usage = "usage: svr_corr_by_exp [-c column]";
65 :    
66 :     my $column;
67 :     my $rc = GetOptions('c=i' => \$column);
68 :     if (! $rc) { print STDERR $usage; exit }
69 :    
70 :     my @lines = map { chomp; [split(/\t/,$_)] } <STDIN>;
71 :     if (! $column) { $column = @{$lines[0]} }
72 :     my @fids = map { $_->[$column-1] } @lines;
73 :    
74 :     my $corrH = $sapObject->coregulated_fids(-ids => \@fids);
75 :     foreach $_ (@lines)
76 :     {
77 :     my $peg = $_->[$column-1];
78 :     if (my $x = $corrH->{$peg})
79 :     {
80 :     my @pegs2 = keys(%$x);
81 :     foreach my $peg2 (@pegs2)
82 :     {
83 :     my $pcc = sprintf("%0.3f",$x->{$peg2});
84 :     print join("\t",(@$_,$pcc,$peg2)),"\n";
85 :     }
86 :     }
87 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3