[Bio] / DeJonghStuff / map_model_to_subsystems.pl Repository:
ViewVC logotype

Diff of /DeJonghStuff/map_model_to_subsystems.pl

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

revision 1.1, Fri Nov 4 16:22:36 2005 UTC revision 1.2, Wed Nov 16 22:01:06 2005 UTC
# Line 8  Line 8 
8    
9  my $fig = new FIG;  my $fig = new FIG;
10    
11  my ($genome_id) = @ARGV;  my ($genome_id, $kegg_org_abbrev) = @ARGV;
12    
13  # map from model's gene-reaction associations to KEGG reaction ids, and check against  # map from model's gene-reaction associations to KEGG reaction ids, and check against
14  # corresponding functional roles and reactions for genes in subsystems  # corresponding functional roles and reactions for genes in subsystems
# Line 18  Line 18 
18  open(REACTIONS, "<$FIG_Config::global/Models/$genome_id/reaction_to_kegg_curated");  open(REACTIONS, "<$FIG_Config::global/Models/$genome_id/reaction_to_kegg_curated");
19  open(ALL_PEGS, ">$FIG_Config::global/Models/$genome_id/pegs_to_subsystem");  open(ALL_PEGS, ">$FIG_Config::global/Models/$genome_id/pegs_to_subsystem");
20    
21    print ALL_PEGS "peg\tgene_list\tsubsystem\trole\tclassification0\tclassification1\treactions_for_role\tgene_reactions\tkgml_reactions\tmatched_rids2\n";
22    
23  my (%reaction_abbrev_2_ids);  my (%reaction_abbrev_2_ids);
24    
25  while (my $line = <REACTIONS>)  while (my $line = <REACTIONS>)
# Line 62  Line 64 
64  {  {
65      my @gene_list = @{$peg_2_genes{$peg}};      my @gene_list = @{$peg_2_genes{$peg}};
66      my @gene_reactions = ();      my @gene_reactions = ();
67        my %kgml_reactions = ();
68    
69      foreach my $gene (@gene_list)      foreach my $gene (@gene_list)
70      {      {
# Line 69  Line 72 
72          {          {
73              push @gene_reactions, @{$gene_2_reactions{$gene}};              push @gene_reactions, @{$gene_2_reactions{$gene}};
74          }          }
75    
76            my @tmp = `find $FIG_Config::data/KGML/$kegg_org_abbrev -name "*.xml" -exec grep $gene {} \\;`;
77    
78            foreach my $line (@tmp)
79            {
80                if ($line =~ /reaction="(.*)"/)
81                {
82                    my $reactions = $1;
83    
84                    while ($reactions =~ /rn:(R\d+)/g)
85                    {
86                        $kgml_reactions{$1} = 1;
87                    }
88                }
89            }
90      }      }
91    
92      my $found_ss = 0;      my $found_ss = 0;
# Line 83  Line 101 
101          my $ss_reactions = $ss->get_reactions();          my $ss_reactions = $ss->get_reactions();
102          my $reactions_for_role = $ss_reactions->{$role};          my $reactions_for_role = $ss_reactions->{$role};
103          my %temp = ();          my %temp = ();
104          my %intersection = ();          my %intersection1 = ();
105            my %intersection2 = ();
106    
107          foreach my $rid (@$reactions_for_role) { $temp{$rid} = 1 };          foreach my $rid (@$reactions_for_role) { $temp{$rid} = 1 };
108    
# Line 91  Line 110 
110          {          {
111              if ($temp{$rid})              if ($temp{$rid})
112              {              {
113                  $intersection{$rid} = 1;                  $intersection1{$rid} = 1;
114                }
115            }
116    
117            my @matched_rids1 = keys %intersection1;
118    
119            foreach my $rid (keys %kgml_reactions)
120            {
121                if ($intersection1{$rid})
122                {
123                    $intersection2{$rid} = 1;
124              }              }
125          }          }
126    
127          my @matched_rids = keys %intersection;          my @matched_rids2 = keys %intersection2;
128    
129          print ALL_PEGS "$peg\t@gene_list\t$subsystem\t$role\t$classification[0]\t$classification[1]\t@$reactions_for_role\t@gene_reactions\t", scalar @matched_rids, "\t@matched_rids\n";          print ALL_PEGS "$peg\t@gene_list\t$subsystem\t$role\t$classification[0]\t$classification[1]\t@$reactions_for_role\t@gene_reactions\t@{[ keys %kgml_reactions ]}\t@matched_rids2\n";
130      }      }
131    
132      if (! $found_ss)      if (! $found_ss)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3