]> git.donarmstrong.com Git - biopieces.git/blob - www/cgi-bin/index.cgi
added www
[biopieces.git] / www / cgi-bin / index.cgi
1 #!/usr/bin/env perl
2
3 # Copyright (C) 2006-2009 Martin A. Hansen.
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 # http://www.gnu.org/copyleft/gpl.html
20
21 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
22
23 use strict;
24 use warnings;
25
26 use lib "/Users/maasha/biopieces/code_perl/";
27
28 use CGI;
29 use Data::Dumper;
30 use Maasha::Common;
31 use Maasha::XHTML;
32
33 my ( $cgi, $script, @html );
34
35 $cgi = new CGI;
36
37 $script = Maasha::Common::get_scriptname();
38
39 push @html, Maasha::XHTML::html_header(
40     cgi_header  => 1,
41     title       => "KISS Genome Browser",
42 #    css_file    => "test.css",
43     author      => "Martin A. Hansen, mail\@maasha.dk",
44     description => "Biopieces bacterial genome browser - KISS",
45     keywords    => [ qw( KISS Biopieces genome browser bacterium bacteria prokaryote prokaryotes ) ],
46     no_cache    => 1,
47 );
48
49 push @html, Maasha::XHTML::h1( txt => "KISS Genome Browser", class => "center" );
50 push @html, Maasha::XHTML::form_beg( action => $script, method => "get", enctype => "multipart/form-data" );
51
52 push @html, sec_navigate( $cgi );
53 push @html, sec_browse();
54
55 push @html, Maasha::XHTML::form_end;
56 push @html, Maasha::XHTML::body_end;
57 push @html, Maasha::XHTML::html_end;
58
59 print "$_\n" foreach @html;
60
61
62 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
63
64
65 sub sec_navigate
66 {
67     my ( $cgi,   # CGI object
68        ) = @_;
69
70     # Returns a list.
71
72     my ( $list_clade, $list_genome, $list_assembly, $list_contig, $def_clade, $def_genome, $def_assembly, $def_contig, $def_start, $def_end, @html );
73
74     $list_clade    = nav_list_clade();
75     $list_genome   = nav_list_genome();
76     $list_assembly = nav_list_assembly();
77     $list_contig   = nav_list_contig();
78
79     $def_clade     = nav_def_clade( $cgi );
80     $def_genome    = nav_def_genome( $cgi );
81     $def_assembly  = nav_def_assembly( $cgi );
82     $def_contig    = nav_def_contig( $cgi );
83     $def_start     = nav_def_start( $cgi );
84     $def_end       = nav_def_end( $cgi );
85
86     push @html, Maasha::XHTML::table_beg( summary => "Navigation table" );
87     push @html, Maasha::XHTML::table_row_simple( tr => [ qw( Clade Genome Assembly Contig Start End ) ], align => 'center' );
88     push @html, Maasha::XHTML::table_row_simple( tr => [
89         Maasha::XHTML::menu( name => "nav_clade",    options => $list_clade,    selected => $def_clade ),
90         Maasha::XHTML::menu( name => "nav_genome",   options => $list_genome,   selected => $def_genome ),
91         Maasha::XHTML::menu( name => "nav_assembly", options => $list_assembly, selected => $def_assembly ),
92         Maasha::XHTML::menu( name => "nav_contig",   options => $list_contig,   selected => $def_contig ),
93         Maasha::XHTML::text( name => "nav_start", value => $def_start, size => 20 ),
94         Maasha::XHTML::text( name => "nav_end",   value => $def_end,   size => 20 ), 
95         Maasha::XHTML::submit( name => "nav_submit", value => "Submit" ),
96     ] );
97     push @html, Maasha::XHTML::table_end;
98
99     return wantarray ? @html : \@html;
100 }
101
102
103 sub sec_browse
104 {
105     my ( @html );
106
107     push @html, Maasha::XHTML::object( type   => "image/svg+xml",
108                                        # data   => "/Users/maasha/test.svg",
109                                        data   => "test.svg",
110                                        name   => "owMain",
111                                        width  => "1200",
112                                        height => "800" );
113
114     return wantarray ? @html : \@html;
115 }
116
117
118 sub nav_list_clade
119 {
120     my ( $list_clade );
121
122     $list_clade = [ qw( Eukaryote Bacillus Fish ) ];
123
124     return wantarray ? @{ $list_clade } : $list_clade;
125 }
126
127
128 sub nav_list_genome
129 {
130     my ( $list_genome );
131
132     $list_genome = [ qw( S.aur_COL E.col B.sub ) ];
133
134     return wantarray ? @{ $list_genome } : $list_genome;
135 }
136
137
138 sub nav_list_assembly
139 {
140     my ( $list_assembly );
141
142     $list_assembly = [ qw( 2008-02-21 2009-01-23 ) ];
143
144     return wantarray ? @{ $list_assembly } : $list_assembly;
145 }
146
147
148 sub nav_list_contig
149 {
150     my ( $list_contig );
151
152     $list_contig = [ qw( chr1 chr2 ) ];
153
154     return wantarray ? @{ $list_contig } : $list_contig;
155 }
156
157
158 sub nav_def_clade
159 {
160     my ( $def_clade );
161
162     if ( defined $cgi->param( 'nav_clade' ) )
163     {
164         $def_clade = $cgi->param( 'nav_clade' );
165     }
166     else
167     {
168         $def_clade = "Bacteria";
169     }
170
171     return $def_clade;
172 }
173
174
175 sub nav_def_genome
176 {
177     my ( $def_genome );
178
179     if ( defined $cgi->param( 'nav_genome' ) )
180     {
181         $def_genome = $cgi->param( 'nav_genome' );
182     }
183     else
184     {
185         $def_genome = "S.aur_COL";
186     }
187
188     return $def_genome;
189 }
190
191
192 sub nav_def_assembly
193 {
194     my ( $def_assembly );
195
196     if ( defined $cgi->param( 'nav_assembly' ) )
197     {
198         $def_assembly = $cgi->param( 'nav_assembly' );
199     }
200     else
201     {
202         $def_assembly = "2009-01-23";
203     }
204
205     return $def_assembly;
206 }
207
208
209 sub nav_def_contig
210 {
211     my ( $def_contig );
212
213     if ( defined $cgi->param( 'nav_contig' ) )
214     {
215         $def_contig = $cgi->param( 'nav_contig' );
216     }
217     else
218     {
219         $def_contig = "chr1";
220     }
221
222     return $def_contig;
223 }
224
225
226 sub nav_def_start
227 {
228     my ( $def_start );
229
230     if ( defined $cgi->param( 'nav_start' ) )
231     {
232         $def_start = $cgi->param( 'nav_start' );
233     }
234     else
235     {
236         $def_start = 1;
237     }
238
239     return $def_start;
240 }
241
242
243 sub nav_def_end
244 {
245     my ( $def_end );
246     
247     if ( defined $cgi->param( 'nav_end' ) )
248     {
249         $def_end = $cgi->param( 'nav_end' );
250     }
251     else
252     {
253         $def_end = 2809422;
254     }
255
256     return $def_end;
257 }
258
259
260 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
261
262
263 __END__
264
265
266