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

Diff of /FigKernelScripts/pg_roles_in_some_but_not_X.pl

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

revision 1.8, Fri Mar 1 16:00:55 2013 UTC revision 1.9, Wed Apr 10 19:15:29 2013 UTC
# Line 2  Line 2 
2  use Data::Dumper;  use Data::Dumper;
3  use Getopt::Long;  use Getopt::Long;
4  use SeedEnv;  use SeedEnv;
5    use PG;
6    
7  my $usage = "usage: pg_in_some_but_not_X -d Data\n";  my $usage = "usage: pg_in_some_but_not_X -d Data\n";
8  my $dataD;  my $dataD;
# Line 9  Line 10 
10    
11  if ((! $rc) || (! -d $dataD)) { print STDERR $usage; exit }  if ((! $rc) || (! -d $dataD)) { print STDERR $usage; exit }
12    
13    my $pg = new PG($dataD);
14    
15  my %anno;  my %anno;
16  if (-s "$dataD/anno.seed")  if (-s "$dataD/anno.seed")
17  {  {
# Line 19  Line 22 
22      print STDERR "NOTE: you have not included any ASEED genomes in a file $dataD/anno.seed\n";      print STDERR "NOTE: you have not included any ASEED genomes in a file $dataD/anno.seed\n";
23  }  }
24    
25  my$peg_to_func                = &load_funcs($dataD);  my$peg_to_func                = $pg->load_funcs();
26  my($peg_to_seq,$seq_to_pegs)  = &load_seqs($dataD);  my($peg_to_seq,$seq_to_pegs)  = $pg->load_seqs();
27  my($peg_to_fam,$fam_to_pegs) = &load_fams($dataD);  my($peg_to_fam,$fam_to_pegs) = &load_fams($dataD);
28    
29  open(OUT,">","$dataD/role.inconsistencies") || die "could not open $dataD/role.inconsistencies";  open(OUT,">","$dataD/role.inconsistencies") || die "could not open $dataD/role.inconsistencies";
30  my %seen;  my %seen;
31  foreach my $tuple (map { chop; [split(/\t/,$_)] } `cat $dataD/genomes.with.job.and.genomeID`)  foreach my $genome ($pg->genomes)
 {  
     my($name,undef,$rast_job,$rast_genome) = @$tuple;  
     if (open(BINDINGS,"<","/vol/rast-prod/jobs/$rast_job/rp/$rast_genome/Subsystems/bindings"))  
32      {      {
33          &process_genome($peg_to_func,$peg_to_seq,$seq_to_pegs,$peg_to_fam,$fam_to_pegs,\%seen,\*OUT,\*BINDINGS,\%anno);      my $bindings = $pg->subsystem_bindings_for_genome($genome);
34          close(BINDINGS);  
35      }      &process_genome($peg_to_func,$peg_to_seq,$seq_to_pegs,$peg_to_fam,$fam_to_pegs,\%seen,\*OUT,$bindings,\%anno);
36  }  }
37  close(OUT);  close(OUT);
38    
39  sub process_genome {  sub process_genome {
40      my($peg_to_func,$peg_to_seq,$seq_to_pegs,$peg_to_fam,$fam_to_pegs,$seen,$fhO,$fhB,$anno) = @_;      my($peg_to_func,$peg_to_seq,$seq_to_pegs,$peg_to_fam,$fam_to_pegs,$seen,$fhO,$bindings,$anno) = @_;
41      while (defined($_ = <$fhB>))  
42        foreach my $binding (@$bindings)
43      {      {
44          chop;          my($subsys,$role,$peg) = @$binding;
45          my($subsys,$role,$peg) = split(/\t/,$_);  
46          my $func1 = $peg_to_func->{$peg};          my $func1 = $peg_to_func->{$peg};
47          if ($func1 && (index($role,$func1) >= 0))          if ($func1 && (index($role,$func1) >= 0))
48          {          {

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3