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

Annotation of /FigWebServices/fusions.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : olson 1.2 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : efrank 1.1 use FIG;
19 :     my $fig = new FIG;
20 :    
21 :     use HTML;
22 :     use CGI;
23 :     my $cgi = new CGI;
24 :     use GenoGraphics;
25 :    
26 :    
27 :     if (0)
28 :     {
29 :     print $cgi->header;
30 :     my @params = $cgi->param;
31 :     print "<pre>\n";
32 :     foreach $_ (@params)
33 :     {
34 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
35 :     }
36 :     exit;
37 :     }
38 :    
39 :     my $html = [];
40 :     my $peg = $cgi->param('peg');
41 :     if (! $peg)
42 :     {
43 :     push(@$html,$cgi->h1("Sorry, but you need to specify a PEG"));
44 :     &HTML::show_page($cgi,$html);
45 :     exit;
46 :     }
47 :    
48 :     my @fusions = `$FIG_Config::bin/compute_potential_fusions \'$peg\'`;
49 :     if (@fusions < 1)
50 :     {
51 :     push(@$html,$cgi->h1("Sorry, no fusions detected"));
52 :     &HTML::show_page($cgi,$html);
53 :     exit;
54 :     }
55 :    
56 :     my(@contains,@contained_in);
57 :     my($x,$genes,$b,$e,$peg1,$gg);
58 :     foreach $_ (@fusions)
59 :     {
60 :     chop;
61 :     my($contains,$ln,@parts) = split(/\t/,$_);
62 :     if ($contains eq $peg)
63 :     {
64 :     push(@contains,[@parts]);
65 :     $peg_ln = $ln;
66 :     }
67 :     else
68 :     {
69 :     $key = join(",",map { @f = split(/,/,$_); $f[2] } @parts);
70 :     push(@{$contained_in{$key}}, [$contains,$ln,@parts]);
71 :     }
72 :     }
73 :    
74 :     #print &Dumper(["contains",\@contains]);
75 :     if (@contains > 0)
76 :     {
77 :     push(@$html,$cgi->h1("Given PEG is the Potential Fusion (RED)"));
78 :     if (@contains > 10)
79 :     {
80 :     $_ = @contains;
81 :     push(@$html,$cgi->h1("Truncating from $_ to 10 Cases"));
82 :     $#contains = 9;
83 :     }
84 :    
85 :     $gg = [[&FIG::abbrev($fig->org_of($peg)),1,$peg_ln,[[1,$peg_ln,"rightArrow","red",$peg,&HTML::fid_link($cgi,$peg,0,1)]]]];
86 :    
87 :     ($x,$genes,$b,$e,$peg1);
88 :     foreach $x (@contains)
89 :     {
90 :     $genes = [];
91 :     foreach $y (@$x)
92 :     {
93 :     ($b,$e,$peg1) = split(/,/,$y);
94 :     push(@$genes,[$b,$e,"rightArrow","blue",$peg1,&HTML::fid_link($cgi,$peg1,0,1)]);
95 :     }
96 :     push(@$gg,[&FIG::abbrev($fig->org_of($peg1)),1,$peg_ln,$genes]);
97 :     }
98 :     # print &Dumper(["contains-gg",$gg]);
99 :     push(@$html,@{ &GenoGraphics::render($gg,700,4,0,1) });
100 :     push(@$html,$cgi->hr);
101 :     }
102 :    
103 :     #print &Dumper(["contained-in",\%contained_in]);
104 :     my(@keys,$key,$contains,@parts);
105 :     @keys = keys(%contained_in);
106 :     if (@keys > 0)
107 :     {
108 :     push(@$html,$cgi->h1("Given PEG (RED) is Potentially Part of a Fusion in Another Genome"));
109 :     foreach $key (@keys)
110 :     {
111 :     $x = $contained_in{$key};
112 :     if (@$x > 10) { $#{$x} = 9 }
113 :     $gg = [];
114 :     foreach $y (@$x)
115 :     {
116 :     ($contains,$ln,@parts) = @$y;
117 :     push(@$gg,[&FIG::abbrev($fig->org_of($contains)),1,$ln,[[1,$ln,"rightArrow","blue",$contains,&HTML::fid_link($cgi,$contains,0,1)]]]);
118 :     }
119 :     $genes = [];
120 :     my @just_first = @{$x->[0]};
121 :     splice(@just_first,0,2);
122 :     foreach $part (@just_first)
123 :     {
124 :     ($b,$e,$peg1) = split(/,/,$part);
125 :     $color = ($peg1 eq $peg) ? "red" : "green";
126 :     push(@$genes,[$b,$e,"rightArrow",$color,$peg1,&HTML::fid_link($cgi,$peg1,0,1)]);
127 :     }
128 :     push(@$gg,[&FIG::abbrev($fig->org_of($peg)),1,$x->[0]->[1],$genes]);
129 :     # print STDERR &Dumper($gg);
130 :     push(@$html,@{ &GenoGraphics::render($gg,700,4,0,2) });
131 :     push(@$html,$cgi->hr);
132 :     }
133 :     }
134 :    
135 :     &HTML::show_page($cgi,$html);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3