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

Diff of /FigKernelScripts/svr_corr_by_exp.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Tue Feb 8 20:04:44 2011 UTC revision 1.5, Mon Apr 4 02:57:39 2011 UTC
# Line 1  Line 1 
1    
2  use strict;  use strict;
3  use Data::Dumper;  use Data::Dumper;
4  use Carp;  use Carp;
# Line 18  Line 19 
19      svr_all_features 83333.1 peg | svr_corr_by_exp      svr_all_features 83333.1 peg | svr_corr_by_exp
20    
21  would produce a 3-column table.  The first column would contain  would produce a 3-column table.  The first column would contain
22  PEG IDs for genes occurring in genome 3702.1, the second would give the  PEG IDs for genes occurring in genome 83333.1, the second would give the
23  Pearson correlation coefficient, and the third would give the PEG that  Pearson correlation coefficient, and the third would give the PEG that
24  seems to have a similar expression profile..  seems to have a similar expression profile..
25    
# Line 46  Line 47 
47    
48  =item -m Minimum value for the Pearson correlation coefficient  =item -m Minimum value for the Pearson correlation coefficient
49    
50    =item -max MaxReturned [default 1000000]
51    
52    This is used to restrict the number of results displayed for a single incoming line (not a restriction
53    on the number of tatal lines)
54    
55  =back  =back
56    
57  =head2 Output Format  =head2 Output Format
# Line 62  Line 68 
68  use SAPserver;  use SAPserver;
69  my $sapObject = SAPserver->new();  my $sapObject = SAPserver->new();
70  use Getopt::Long;  use Getopt::Long;
71    use ScriptThing;
72    
73  my $usage = "usage: svr_corr_by_exp [-c column]";  my $usage = "usage: svr_corr_by_exp [-c column] [-m minPCC] [-max MaxReturned]";
74    
75  my $column;  my $column;
76    my $maxR  = 100000;
77  my $min_pcc = 0;  my $min_pcc = 0;
78  my $rc  = GetOptions('c=i' => \$column,  my $rc  = GetOptions('c=i' => \$column,
79                       'm=i' => \$min_pcc);                       'max=i'  => \$maxR,
80                         'm=f' => \$min_pcc);
81    
82  if (! $rc) { print STDERR $usage; exit }  if (! $rc) { print STDERR $usage; exit }
83    
84  my @lines = map { chomp; [split(/\t/,$_)] } <STDIN>;  while (my @tuples = ScriptThing::GetBatch(\*STDIN, 5, $column)) {
85  if (! $column)  { $column = @{$lines[0]} }      my $corrH = $sapObject->coregulated_fids(-ids => [map { $_->[0] } @tuples]);
86  my @fids = map { $_->[$column-1] } @lines;      foreach my $tuple (@tuples) {
87            my $printed = 0;
88  my $corrH = $sapObject->coregulated_fids(-ids => \@fids);          my ($peg, $line) = @$tuple;
89  foreach $_ (@lines)          if (my $x = $corrH->{$peg}) {
 {  
     my $peg = $_->[$column-1];  
     if (my $x = $corrH->{$peg})  
     {  
90          my @pegs2 = keys(%$x);          my @pegs2 = keys(%$x);
91          foreach my $peg2 (@pegs2)              foreach my $peg2 (@pegs2) {
         {  
92              my $pcc = sprintf("%0.3f",$x->{$peg2});              my $pcc = sprintf("%0.3f",$x->{$peg2});
93              if ($pcc >= $min_pcc)              if ($pcc >= $min_pcc)
94              {              {
95                  print join("\t",(@$_,$pcc,$peg2)),"\n";                      if ($printed < $maxR)
96                        {
97                            print join("\t",($line,$pcc,$peg2)),"\n";
98                            $printed++;
99                        }
100                    }
101              }              }
102          }          }
103      }      }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3