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

Diff of /FigKernelScripts/make_coreg_conjectures_based_on_subsys.pl

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

revision 1.3, Mon May 17 13:05:46 2010 UTC revision 1.5, Tue Apr 19 00:11:18 2011 UTC
# Line 3  Line 3 
3  use Carp;  use Carp;
4  use Data::Dumper;  use Data::Dumper;
5  use Statistics::Descriptive;  use Statistics::Descriptive;
6    use ExpressionDir;
7    
8  my($genome,$rawF);  my($expr_dir);
9  my $usage = "usage: make_coreg_conjectures_based_on_subsys Genome RawDataTab BadSubsystems";  my $usage = "usage: make_coreg_conjectures_based_on_subsys expr_dir [subsystems-dir]";
10  (  (
11   ($genome    = shift @ARGV) &&   ($expr_dir   = shift @ARGV)
  ($rawF      = shift @ARGV)  
12  )  )
13      || die $usage;      || die $usage;
14    
15  my %bad_subsystems;  my %sets;
16  if (@ARGV > 0)  if ((@ARGV > 0) && (-s "$ARGV[0]/bindings"))
17    {
18        foreach $_ (`cat $ARGV[0]/bindings`)
19  {  {
20      map { $_ =~ /^(\S.*\S)/; $1 => 1 } `cat $ARGV[0]`;          chop;
21            my($ss,$role,$peg) = split(/\t/,$_);
22            push(@{$sets{$ss}},$peg);
23  }  }
24    }
25    
26    my $exprO = ExpressionDir->new($expr_dir);
27    my $rawF = $exprO->expr_dir . "/rma_normalized.tab";
28    
29    my %bad_subsystems;
30    
31    #my $sapO    = SAPserver->new;
32    
 my $sapO    = SAPserver->new;  
33  my $corrH = &get_corr($rawF);  my $corrH = &get_corr($rawF);
34    
35  my $genomeH = $sapO->genomes_to_subsystems( -ids => [$genome] );  #my $genomeH = $sapO->genomes_to_subsystems( -ids => [$genome] );
36  my @subs = map { ($_->[1] =~ /^\*?(0|-1)$/) ? () : $_->[0] } @{$genomeH->{$genome}};  #my @subs = map { ($_->[1] =~ /^\*?(0|-1)$/) ? () : $_->[0] } @{$genomeH->{$genome}};
37  @subs = grep { ! $bad_subsystems{$_} } @subs;  #@subs = grep { ! $bad_subsystems{$_} } @subs;
38    
39    #my $subH = $sapO->ids_in_subsystems( -subsystems => \@subs,
40    #                                    -genome     => $genome);
41    my $subH = $exprO->ids_in_subsystems();
42    my @subs = sort (@ARGV[0] ? keys(%sets) : keys %$subH);
43    
 my $subH = $sapO->ids_in_subsystems( -subsystems => \@subs,  
                                      -genome     => $genome);  
44  my %bad;  my %bad;
45    
46  foreach my $sub (@subs)  foreach my $sub (@subs)
47  {  {
48      my %pegs;      my %pegs;
49        my @pegs;
50        if (@ARGV[0])
51        {
52            @pegs = sort { &SeedUtils::by_fig_id($a,$b) }@{$sets{$sub}};
53        }
54        else
55        {
56      my $sub_entry = $subH->{$sub};      my $sub_entry = $subH->{$sub};
57      my @pegs = ();          @pegs = ();
58      foreach my $role (keys(%$sub_entry))      foreach my $role (keys(%$sub_entry))
59      {      {
60          my $pegs = $sub_entry->{$role};          my $pegs = $sub_entry->{$role};
61          foreach $_ (@$pegs) { $pegs{$_} = 1 }          foreach $_ (@$pegs) { $pegs{$_} = 1 }
62      }      }
63      @pegs = sort { &SeedUtils::by_fig_id($a,$b) } keys(%pegs);      @pegs = sort { &SeedUtils::by_fig_id($a,$b) } keys(%pegs);
64        }
65    
66      my @sets = grep { @$_ > 1 } split_on_pc(\@pegs,$corrH);      my @sets = grep { @$_ > 1 } split_on_pc(\@pegs,$corrH);
67    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3