[Bio] / FigWebServices / ma_to_tf_nr.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/ma_to_tf_nr.cgi

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

revision 1.1, Fri Jan 20 16:14:37 2006 UTC revision 1.2, Mon Jan 30 21:35:40 2006 UTC
# Line 109  Line 109 
109           $refseq_to_tf{$temp[0]} = [$temp[1]];           $refseq_to_tf{$temp[0]} = [$temp[1]];
110        }        }
111    }    }
112      close(IN2);
113    
114    push(@$new_html,"<HTML><HEAD>    push(@$new_html,"<HTML><HEAD>
115    <TITLE>strep</TITLE>    <TITLE>strep</TITLE>
# Line 156  Line 157 
157  {  {
158    my ($fig,$cgi,$html)=@_;    my ($fig,$cgi,$html)=@_;
159    $new_html = [];    $new_html = [];
160      %significant;
161    $dir = "/home/mkubal/public_html";    $dir = "/home/mkubal/public_html";
162    
163      open(IN2,"$dir/refseq_to_transfactor.txt.nonredundant");
164      %tfs_to_refseq;
165      while ($_ = <IN2>){
166          chomp($_);
167          @temp = split("\t",$_);
168          if($tfs_to_refseq{$temp[1]}){
169              $ref = $tfs_to_refseq{$temp[1]};
170              push(@$ref,$temp[0]);
171          }
172          else{
173             $tfs_to_refseq{$temp[1]} = [$temp[0]];
174          }
175      }
176      close(IN2);
177    
178    
179    print STDERR "made it here\n";    print STDERR "made it here\n";
180    open(IN,"$dir/tfs_to_ratio.txt");    open(IN,"$dir/tfs_to_ratio.txt");
181    %tfs_combinations;    %tfs_combinations;
# Line 186  Line 204 
204    
205    @negative_exclusives;    @negative_exclusives;
206    @positive_exclusives;    @positive_exclusives;
207      @therest;
208    
209    foreach my $k (keys(%tfs_combinations)){    foreach my $k (keys(%tfs_combinations)){
210       print STDERR "k:$k\n";       print STDERR "k:$k\n";
# Line 218  Line 237 
237          }          }
238          else{push(@negative_exclusives,$k)}          else{push(@negative_exclusives,$k)}
239        }        }
240         else{push(@therest,$k)}
241   }   }
242       push(@$new_html,"<HTML><HEAD>       push(@$new_html,"<HTML><HEAD>
243       <TITLE>strep</TITLE>       <TITLE>strep</TITLE>
# Line 233  Line 253 
253          my $observed = $count * (1/2439);          my $observed = $count * (1/2439);
254          my $expected = $tfs_expected{$tfs};          my $expected = $tfs_expected{$tfs};
255          my $ratio = $observed/$expected;          my $ratio = $observed/$expected;
256            if($ratio > 2 ){ $significant{$tfs} = $ratio};
257          my $row_string = "<TR><TD>$tfs</TD><TD>$count</TD><TD>$ratio</TD></TR>";          my $row_string = "<TR><TD>$tfs</TD><TD>$count</TD><TD>$ratio</TD></TR>";
258          push(@$new_html,$row_string);          push(@$new_html,$row_string);
259          print SUMMARY "UP\t$tfs\t$observed\t$expected\t$ratio\n";          print SUMMARY "UP\t$tfs\t$observed\t$expected\t$ratio\n";
# Line 251  Line 272 
272          my $observed = $count * (1/2439);          my $observed = $count * (1/2439);
273          my $expected = $tfs_expected{$tfs};          my $expected = $tfs_expected{$tfs};
274          my $ratio = $observed/$expected;          my $ratio = $observed/$expected;
275            if($ratio > 2 ){ $significant{$tfs} = $ratio};
276          my $row_string = "<TR><TD>$tfs</TD><TD>$count</TD><TD>$ratio</TD></TR>";          my $row_string = "<TR><TD>$tfs</TD><TD>$count</TD><TD>$ratio</TD></TR>";
277          push(@$new_html,$row_string);          push(@$new_html,$row_string);
278          print SUMMARY "DOWN\t$tfs\t$observed\t$expected\t$ratio\n";          print SUMMARY "DOWN\t$tfs\t$observed\t$expected\t$ratio\n";
279        }
280    
281      push(@$new_html,"</TABLE>");
282    
283      push(@$new_html,"<br><br>");
284    
285      push(@$new_html,"<TABLE border><TR><TH>MIXED Transcription Factor Combinations</TH><TH>Number of Genes</TH><TH>Observed/Expected</TH></TR>");
286    
287      foreach my $tfs (@therest)
288      {
289          my $count = $tfs_counts{$tfs};
290            my $observed = $count * (1/2439);
291          my $expected = $tfs_expected{$tfs};
292          my $ratio = $observed/$expected;
293          if($ratio > 2 ){ $significant{$tfs} = $ratio};
294          my $row_string = "<TR><TD>$tfs</TD><TD>$count</TD><TD>$ratio</TD></TR>";
295          push(@$new_html,$row_string);
296          print SUMMARY "MIXED\t$tfs\t$observed\t$expected\t$ratio\n";
297      }
298    
299      push(@$new_html,"</TABLE>");
300    
301      push(@$new_html,"<br><br>");
302    
303      push(@$new_html,"<TABLE border><TR><TH>SIGNIFICANT Transcription Factor Combinations</TH><TH>RefSeq ID</TH><TH>Observed/Expected</TH></TR>");
304    
305    
306      @sorted = sort {$b <=> $a} values(%significant);
307      %sorted_hash;
308      foreach $s (values(%significant)){
309          $sorted_hash{$s} = 1;
310      }
311    
312      @final;
313      %already_in;
314      foreach $s (@sorted){
315          foreach $tfs (keys(%significant)){
316              if($already_in{$tfs}){ $do_nothing = 1}
317              else{
318                  $ratio = $significant{$tfs};
319                  if( $ratio >= $s){
320                      push(@final,$tfs);
321                      $already_in{$tfs} = 1;
322                  }
323              }
324          }
325      }
326    
327      foreach my $tfs (@final)
328      {
329          my $ids = $tfs_to_refseq{$tfs};
330          @id_strings = ();
331          foreach $id (@$ids){
332              $id_string ="<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=NucCore&cmd=search&term=$id'>$id</a>";
333              push(@id_strings,$id_string);
334          }
335    
336          $ids_line = join(",",@id_strings);
337          my $ratio = $significant{$tfs};
338          my $row_string = "<TR><TD>$tfs</TD><TD>$ids_line</TD><TD>$ratio</TD></TR>";
339          push(@$new_html,$row_string);
340          print SUMMARY "SIGNIFICANT\t$tfs\t$id\t$ratio\n";
341       }       }
342    
343       push(@$new_html,"</TABLE>");       push(@$new_html,"</TABLE>");

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3