3 # Copyright (C) 2006-2009 Martin A. Hansen.
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.
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.
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.
19 # http://www.gnu.org/copyleft/gpl.html
21 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
26 use lib $ENV{ 'BP_PERL' };
35 use Maasha::BBrowser::Track;
36 use Maasha::BBrowser::Draw;
38 my ( $cgi, $cookie, @html );
41 $cookie = cookie_default( $cgi );;
43 push @html, Maasha::XHTML::html_header(
45 title => "Biopieces Genome Browser",
46 css_file => "bgb.css",
47 author => "Martin A. Hansen, mail\@maasha.dk",
48 description => "Biopieces Genome Browser",
49 keywords => [ qw( Biopieces biopiece genome browser viewer bacterium bacteria prokaryote prokaryotes ) ],
53 push @html, Maasha::XHTML::h1( txt => "Biopieces Genome Browser", class => 'center' );
54 push @html, Maasha::XHTML::form_beg( action => $cookie->{ 'SCRIPT' }, method => "get", enctype => "multipart/form-data" );
56 push @html, page( $cookie );
58 push @html, Maasha::XHTML::form_end;
59 push @html, Maasha::XHTML::body_end;
60 push @html, Maasha::XHTML::html_end;
62 # push @html, Maasha::XHTML::hdump( [ $cgi->Vars ] ); # DEBUG
63 # push @html, Maasha::XHTML::hdump( $cookie ); # DEBUG
65 print "$_\n" foreach @html;
68 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SUBROUTINES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
71 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> COOKIE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
76 # Martin A. Hansen, November 2009.
78 # Set a cookie with values from the CGI object or defaults.
80 my ( $cgi, # CGI object
85 my ( $cookie, $path );
89 $cookie->{ 'SCRIPT' } = Maasha::Common::get_scriptname();
90 $cookie->{ 'DATA_DIR' } = "Data";
91 $cookie->{ 'LIST_PAGES' } = [ qw( user clade genome assembly contig browse ) ];
92 $cookie->{ 'PAGE' } = $cgi->param( 'page' ) || 'user';
93 $cookie->{ 'USER' } = $cgi->param( 'user' ) || '';
94 $cookie->{ 'CLADE' } = $cgi->param( 'clade' ) || '';
95 $cookie->{ 'GENOME' } = $cgi->param( 'genome' ) || '';
96 $cookie->{ 'ASSEMBLY' } = $cgi->param( 'assembly' ) || '';
97 $cookie->{ 'CONTIG' } = $cgi->param( 'contig' ) || '';
98 $cookie->{ 'Q_ID' } = $cgi->param( 'q_id' );
99 $cookie->{ 'S_BEG' } = $cgi->param( 's_beg' );
100 $cookie->{ 'S_END' } = $cgi->param( 's_end' );
101 $cookie->{ 'STRAND' } = $cgi->param( 'strand' );
102 $cookie->{ 'NAV_START' } = $cgi->param( 'nav_start' );
103 $cookie->{ 'NAV_END' } = $cgi->param( 'nav_end' );
104 $cookie->{ 'ZOOM_IN1' } = $cgi->param( 'zoom_in1' );
105 $cookie->{ 'ZOOM_IN2' } = $cgi->param( 'zoom_in2' );
106 $cookie->{ 'ZOOM_IN3' } = $cgi->param( 'zoom_in3' );
107 $cookie->{ 'ZOOM_OUT1' } = $cgi->param( 'zoom_out1' );
108 $cookie->{ 'ZOOM_OUT2' } = $cgi->param( 'zoom_out2' );
109 $cookie->{ 'ZOOM_OUT3' } = $cgi->param( 'zoom_out3' );
110 $cookie->{ 'MOVE_LEFT1' } = $cgi->param( 'move_left1' );
111 $cookie->{ 'MOVE_LEFT2' } = $cgi->param( 'move_left2' );
112 $cookie->{ 'MOVE_LEFT3' } = $cgi->param( 'move_left3' );
113 $cookie->{ 'MOVE_RIGHT1' } = $cgi->param( 'move_right1' );
114 $cookie->{ 'MOVE_RIGHT2' } = $cgi->param( 'move_right2' );
115 $cookie->{ 'MOVE_RIGHT3' } = $cgi->param( 'move_right3' );
117 $cookie->{ 'IMG_WIDTH' } = 1200;
118 $cookie->{ 'IMG_HEIGHT' } = 800;
119 $cookie->{ 'TRACK_OFFSET' } = 20;
120 $cookie->{ 'TRACK_SPACE' } = 20;
121 $cookie->{ 'RULER_FONT_SIZE' } = 10;
122 $cookie->{ 'RULER_COLOR' } = [ 0, 0, 0 ];
123 $cookie->{ 'SEQ_FONT_SIZE' } = 10;
124 $cookie->{ 'SEQ_COLOR' } = [ 0, 0, 0, ];
125 $cookie->{ 'FEAT_WIDTH' } = 5;
126 $cookie->{ 'FEAT_COLOR' } = [ 0, 0, 0 ];
127 $cookie->{ 'FEAT_MAX' } = 5000;
129 $path = "$cookie->{ 'DATA_DIR' }/Users";
131 $cookie->{ 'LIST_USER' } = Maasha::Filesys::ls_dirs_base( $path ) if -d $path;
133 $path .= "/$cookie->{ 'USER' }";
135 $cookie->{ 'LIST_CLADE' } = Maasha::Filesys::ls_dirs_base( $path ) if -d $path;
137 $path .= "/$cookie->{ 'CLADE' }";
139 $cookie->{ 'LIST_GENOME' } = Maasha::Filesys::ls_dirs_base( $path ) if -d $path;
141 $path .= "/$cookie->{ 'GENOME' }";
143 $cookie->{ 'LIST_ASSEMBLY' } = Maasha::Filesys::ls_dirs_base( $path ) if -d $path;
145 $path .= "/$cookie->{ 'ASSEMBLY' }";
147 $cookie->{ 'LIST_CONTIG' } = Maasha::Filesys::ls_dirs_base( $path ) if -d $path;
149 if ( $cookie->{ 'CONTIG' } )
151 cookie_start( $cookie );
152 cookie_end( $cookie );
153 cookie_zoom( $cookie );
154 cookie_move( $cookie );
157 $cookie->{ 'STRAND' } = '+' if $cookie->{ 'STRAND' } eq ' ';
159 return wantarray ? %{ $cookie } : $cookie;
165 # Martin A. Hansen, November 2009.
167 # Decommify the cookie value for NAV_START and adjust it to
168 # to prevent negative values.
170 my ( $cookie, # cookie hash
175 if ( defined $cookie->{ 'NAV_START' } )
177 $cookie->{ 'NAV_START' } =~ tr/,//d;
178 $cookie->{ 'NAV_START' } = 0 if $cookie->{ 'NAV_START' } < 0;
182 $cookie->{ 'NAV_START' } = 0;
189 # Martin A. Hansen, November 2009.
191 # Decommify the cookie value for NAV_END and adjust it to prevent
192 # overshooting the max value for the contig size as determined
195 my ( $cookie, # cookie hash
202 $max = Maasha::Filesys::file_size( Maasha::BBrowser::Track::path_seq( $cookie ) );
204 if ( defined $cookie->{ 'NAV_END' } )
206 $cookie->{ 'NAV_END' } =~ tr/,//d;
207 $cookie->{ 'NAV_END' } = $max if $cookie->{ 'NAV_END' } > $max;
211 $cookie->{ 'NAV_END' } = $max;
218 # Martin A. Hansen, November 2009.
220 # Adjust the cookie values for NAV_START and NAV_END based
221 # on cookie ZOOM values.
223 my ( $cookie, # cookie hash
228 my ( $max, $dist, $new_dist, $dist_diff );
230 $max = Maasha::Filesys::file_size( Maasha::BBrowser::Track::path_seq( $cookie ) );
232 $dist = $cookie->{ 'NAV_END' } - $cookie->{ 'NAV_START' };
234 if ( defined $cookie->{ 'ZOOM_IN1' } ) {
235 $new_dist = $dist / 1.5;
236 } elsif ( defined $cookie->{ 'ZOOM_IN2' } ) {
237 $new_dist = $dist / 3;
238 } elsif ( defined $cookie->{ 'ZOOM_IN3' } ) {
239 $new_dist = $dist / 10;
240 } elsif ( defined $cookie->{ 'ZOOM_OUT1' } ) {
241 $new_dist = $dist * 1.5;
242 } elsif ( defined $cookie->{ 'ZOOM_OUT2' } ) {
243 $new_dist = $dist * 3;
244 } elsif ( defined $cookie->{ 'ZOOM_OUT3' } ) {
245 $new_dist = $dist * 10;
250 $dist_diff = $dist - $new_dist;
252 $cookie->{ 'NAV_START' } = int( $cookie->{ 'NAV_START' } + ( $dist_diff / 2 ) );
253 $cookie->{ 'NAV_END' } = int( $cookie->{ 'NAV_END' } - ( $dist_diff / 2 ) );
255 $cookie->{ 'NAV_START' } = 0 if $cookie->{ 'NAV_START' } < 0;
256 $cookie->{ 'NAV_END' } = $max if $cookie->{ 'NAV_END' } > $max;
263 # Martin A. Hansen, November 2009.
265 # Adjust the cookie values for NAV_START and NAV_END based
266 # on cookie MOVE values.
268 my ( $cookie, # cookie hash
271 my ( $max, $dist, $shift, $new_start, $new_end );
273 $max = Maasha::Filesys::file_size( Maasha::BBrowser::Track::path_seq( $cookie ) );
275 $dist = $cookie->{ 'NAV_END' } - $cookie->{ 'NAV_START' };
277 if ( defined $cookie->{ 'MOVE_LEFT1' } ) {
278 $shift = -1 * $dist * 0.10;
279 } elsif ( defined $cookie->{ 'MOVE_LEFT2' } ) {
280 $shift = -1 * $dist * 0.475;
281 } elsif ( defined $cookie->{ 'MOVE_LEFT3' } ) {
282 $shift = -1 * $dist * 0.95;
283 } elsif ( defined $cookie->{ 'MOVE_RIGHT1' } ) {
284 $shift = $dist * 0.10;
285 } elsif ( defined $cookie->{ 'MOVE_RIGHT2' } ) {
286 $shift = $dist * 0.475;
287 } elsif ( defined $cookie->{ 'MOVE_RIGHT3' } ) {
288 $shift = $dist * 0.95;
293 $new_start = int( $cookie->{ 'NAV_START' } + $shift );
294 $new_end = int( $cookie->{ 'NAV_END' } + $shift );
296 if ( $new_start > 0 and $new_end < $max )
298 $cookie->{ 'NAV_START' } = $new_start;
299 $cookie->{ 'NAV_END' } = $new_end;
307 # Martin A. Hansen, November 2009.
309 # Returns the href for a taxonomy path terminated at a given
310 # page using information stored in a cookie.
312 my ( $cookie, # cookie hash
322 push @href, "$cookie->{ 'SCRIPT' }?page=$page";
323 push @href, "user=$cookie->{ 'USER' }" if $cookie->{ 'USER' };
324 last if $page eq 'user';
325 push @href, "clade=$cookie->{ 'CLADE' }" if $cookie->{ 'CLADE' };
326 last if $page eq 'clade';
327 push @href, "genome=$cookie->{ 'GENOME' }" if $cookie->{ 'GENOME' };
328 last if $page eq 'genome';
329 push @href, "assembly=$cookie->{ 'ASSEMBLY' }" if $cookie->{ 'ASSEMBLY' };
330 last if $page eq 'assembly';
331 push @href, "contig=$cookie->{ 'CONTIG' }" if $cookie->{ 'CONTIG' };
332 last if $page eq 'contig';
336 return join "&", @href;
342 # Martin A. Hansen, November 2009.
344 # Returns the next page in the taxonomy path.
346 my ( $cookie, # cookie hash
353 for ( $i = 0; $i < @{ $cookie->{ 'LIST_PAGES' } }; $i++ ) {
354 last if $cookie->{ 'PAGE' } eq $cookie->{ 'LIST_PAGES' }->[ $i ];
357 return $cookie->{ 'LIST_PAGES' }->[ $i + 1 ];
361 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PAGES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
366 # Martin A. Hansen, November 2009.
368 # Determines what page to render based on
369 # the cookie's PAGE setting.
371 my ( $cookie, # cookie hash
378 if ( $cookie->{ 'PAGE' } eq 'export' ) {
379 push @html, page_export( $cookie );
380 } elsif ( $cookie->{ 'PAGE' } eq 'browse' ) {
381 push @html, page_browse( $cookie );
382 } elsif ( $cookie->{ 'PAGE' } eq 'dna' ) {
383 push @html, page_dna( $cookie );
385 push @html, page_taxonomy( $cookie );
388 return wantarray ? @html : \@html;
394 # Martin A. Hansen, November 2009.
396 # Renders the export page.
405 push @html, section_taxonomy_table( $cookie );
406 push @html, section_export( $cookie );
408 return wantarray ? @html : \@html;
414 # Martin A. Hansen, November 2009.
416 # Renders the browse page.
425 push @html, section_taxonomy_table( $cookie );
426 push @html, section_navigate( $cookie );
427 push @html, section_browse( $cookie );
429 return wantarray ? @html : \@html;
435 # Martin A. Hansen, November 2009.
437 # Renders the DNA page.
446 push @html, section_taxonomy_table( $cookie );
447 push @html, section_dna( $cookie );
449 return wantarray ? @html : \@html;
455 # Martin A. Hansen, November 2009.
457 # Renders the browse page.
459 my ( $cookie, # cookie hash
466 push @html, section_taxonomy_table( $cookie );
467 push @html, section_taxonomy_select( $cookie );
469 return wantarray ? @html : \@html;
473 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SECTIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
476 sub section_taxonomy_table
478 # Martin A. Hansen, November 2009.
480 # Returns a HTML section with a taxonomy table
481 # showing the location in the taxonomy and with
482 # links to browse the taxonomy.
484 my ( $cookie, # cookie hash
489 my ( $page, @row, @html, $href, $txt );
491 foreach $page ( @{ $cookie->{ 'LIST_PAGES' } } )
493 last if $page eq $cookie->{ 'PAGE' } or $page eq 'browse';
495 $href = cookie_href( $cookie, $page );
497 $txt = ": $cookie->{ uc $page }";
499 push @row, Maasha::XHTML::ln( txt => $page, href => $href, class => 'inline' );
500 push @row, Maasha::XHTML::p( txt => $txt, class => 'inline' );
503 push @html, Maasha::XHTML::table_beg( summary => "Taxonomy table", align => 'center', cellpadding => '5px' );
504 push @html, Maasha::XHTML::table_row_simple( tr => [ join( "\n", @row ) ], align => 'center' );
505 push @html, Maasha::XHTML::table_end;
507 return wantarray ? @html : \@html;
511 sub section_taxonomy_select
513 # Martin A. Hansen, November 2009.
515 # Returns a HTML section with selection choices
516 # for navigating the taxonomy tree.
518 my ( $cookie, # cookie hash
523 my ( $list, @html, $item, $href );
525 $list = "LIST_" . uc $cookie->{ 'PAGE' };
527 push @html, Maasha::XHTML::h2( txt => "Select $cookie->{ 'PAGE' }", class => 'center' );
529 push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center', cellpadding => '5px' );
531 foreach $item ( @{ $cookie->{ $list } } )
533 $cookie->{ uc $cookie->{ 'PAGE' } } = $item;
535 $href = cookie_href( $cookie, cookie_page_next( $cookie ) );
537 push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $item, href => $href ) ] );
540 push @html, Maasha::XHTML::table_end;
542 return wantarray ? @html : \@html;
548 # Martin A. Hansen, November 2009.
550 # Returns a HTML section for navigating in the browser window.
552 my ( $cookie, # cookie hash
559 push @html, Maasha::XHTML::table_beg( summary => "Navigation table", align => 'center' );
560 push @html, Maasha::XHTML::table_row_simple( tr => [
562 Maasha::XHTML::text( name => "nav_start", value => Maasha::Calc::commify( $cookie->{ 'NAV_START' } ), size => 15 ),
564 Maasha::XHTML::text( name => "nav_end", value => Maasha::Calc::commify( $cookie->{ 'NAV_END' } ), size => 15 ),
565 Maasha::XHTML::submit( name => "nav_submit", value => "Submit" ),
567 push @html, Maasha::XHTML::table_end;
569 push @html, Maasha::XHTML::table_beg( summary => "Zoom table", align => 'center' );
570 push @html, Maasha::XHTML::table_row_simple( tr => [
571 Maasha::XHTML::p( txt => 'Move:' ),
572 Maasha::XHTML::submit( name => "move_left3", value => "<<<", title => "move 95% to the left" ),
573 Maasha::XHTML::submit( name => "move_left2", value => "<<", title => "move 47.5% to the left" ),
574 Maasha::XHTML::submit( name => "move_left1", value => "<", title => "move 10% to the left" ),
575 Maasha::XHTML::submit( name => "move_right1", value => ">", title => "move 10% to the rigth" ),
576 Maasha::XHTML::submit( name => "move_right2", value => ">>", title => "move 47.5% to the rigth" ),
577 Maasha::XHTML::submit( name => "move_right3", value => ">>>", title => "move 95% to the right" ),
578 Maasha::XHTML::p( txt => 'Zoom in:' ),
579 Maasha::XHTML::submit( name => "zoom_in1", value => "1.5x" ),
580 Maasha::XHTML::submit( name => "zoom_in2", value => "3x" ),
581 Maasha::XHTML::submit( name => "zoom_in3", value => "10x" ),
582 Maasha::XHTML::p( txt => 'Zoom out:' ),
583 Maasha::XHTML::submit( name => "zoom_out1", value => "1.5x" ),
584 Maasha::XHTML::submit( name => "zoom_out2", value => "3x" ),
585 Maasha::XHTML::submit( name => "zoom_out3", value => "10x" ),
587 push @html, Maasha::XHTML::table_end;
589 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "page", value => "browse" ) );
590 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user", value => "$cookie->{ 'USER' }" ) );
591 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade", value => "$cookie->{ 'CLADE' }" ) );
592 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome", value => "$cookie->{ 'GENOME' }" ) );
593 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => "$cookie->{ 'ASSEMBLY' }" ) );
594 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig", value => "$cookie->{ 'CONTIG' }" ) );
596 return wantarray ? @html : \@html;
607 my ( @tracks, $i, @features, $feat, $elem, $file, $surface, $cr, @html, @img );
609 push @features, [ Maasha::BBrowser::Track::track_ruler( $cookie ) ];
610 push @features, [ Maasha::BBrowser::Track::track_seq( $cookie ) ];
612 @tracks = Maasha::BBrowser::Track::path_tracks( $cookie );
614 for ( $i = 0; $i < @tracks; $i++ )
616 $cookie->{ 'FEAT_COLOR' } = Maasha::BBrowser::Draw::palette( $i );
618 push @features, [ Maasha::BBrowser::Track::track_feature( $tracks[ $i ], $cookie ) ];
621 $file = "fisk.png"; # FIXME
623 $surface = Cairo::ImageSurface->create( 'argb32', $cookie->{ 'IMG_WIDTH' }, $cookie->{ 'TRACK_OFFSET' } );
624 $cr = Cairo::Context->create( $surface );
626 $cr->rectangle ( 0, 0, $cookie->{ 'IMG_WIDTH' }, $cookie->{ 'TRACK_OFFSET' } );
627 $cr->set_source_rgb ( 1, 1, 1 );
630 foreach $feat ( @features ) {
631 Maasha::BBrowser::Draw::draw_feature( $cr, $feat ) if $feat;
634 Maasha::BBrowser::Draw::file_png( $surface, $file );
636 push @img, Maasha::XHTML::img(
638 alt => "Browser Tracks",
639 height => $cookie->{ 'TRACK_OFFSET' },
640 width => $cookie->{ 'IMG_WIDTH' },
642 usemap => "#browser_map"
645 push @img, Maasha::XHTML::map_beg( name => "browser_map", id => "browser_map" );
647 foreach $feat ( @features )
649 foreach $elem ( @{ $feat } )
651 next if $elem->{ 'type' } eq 'text';
653 #$elem->{ 'strand' } = '+' if $elem->{ 'strand' } eq '+';
655 push @img, Maasha::XHTML::area(
656 href => cookie_href( $cookie, "export" ) . "&q_id=$elem->{ 'q_id' }&s_beg=$elem->{ 's_beg' }&s_end=$elem->{ 's_end' }&strand=$elem->{ 'strand' }",
658 coords => "$elem->{ x1 }, $elem->{ y1 }, $elem->{ x2 }, $elem->{ y2 }", title => "$elem->{ 'title' }",
663 push @img, Maasha::XHTML::map_end();
665 push @html, Maasha::XHTML::p( txt => join( "\n", @img ) );
667 @html = Maasha::XHTML::div( txt => join( "\n", @html ), class => 'browse' );
669 return wantarray ? @html : \@html;
675 # Martin A. Hansen, November 2009.
677 # Returns a HTML section with export table.
679 my ( $cookie, # cookie hash
684 my ( @row_dna_contig, @html );
686 push @row_dna_contig, Maasha::XHTML::p( txt => qq(Export Feature: "$cookie->{ 'Q_ID' }" DNA from Contig: ), class => 'inline' );
687 push @row_dna_contig, Maasha::XHTML::p( txt => "$cookie->{ 'CONTIG' } Start: ", class => 'inline' );
688 push @row_dna_contig, Maasha::XHTML::text( name => "s_beg", value => Maasha::Calc::commify( $cookie->{ 'S_BEG' } ), size => 15 );
689 push @row_dna_contig, Maasha::XHTML::p( txt => "End: ", class => 'inline' );
690 push @row_dna_contig, Maasha::XHTML::text( name => "s_end", value => Maasha::Calc::commify( $cookie->{ 'S_END' } ), size => 15 );
691 push @row_dna_contig, Maasha::XHTML::p( txt => "Strand: ", class => 'inline' );
692 push @row_dna_contig, Maasha::XHTML::menu( name => "strand", options => [ qw( + - ) ], selected => $cookie->{ 'STRAND' } );
693 push @row_dna_contig, Maasha::XHTML::submit( name => "export", value => "Export", title => "Fetch DNA from this region" );
695 push @html, Maasha::XHTML::h2( txt => "Export", class => 'center' );
696 push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center' );
697 push @html, Maasha::XHTML::table_row_simple( tr => \@row_dna_contig );
698 push @html, Maasha::XHTML::table_end;
700 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "page", value => "dna" ) );
701 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "user", value => "$cookie->{ 'USER' }" ) );
702 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade", value => "$cookie->{ 'CLADE' }" ) );
703 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome", value => "$cookie->{ 'GENOME' }" ) );
704 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => "$cookie->{ 'ASSEMBLY' }" ) );
705 push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig", value => "$cookie->{ 'CONTIG' }" ) );
707 return wantarray ? @html : \@html;
713 # Martin A. Hansen, November 2009.
715 # Returns a HTML section with extracted DNA.
717 my ( $cookie, # cookie hash
722 my ( @html, $beg, $end, $seq );
724 $beg = $cookie->{ 'S_BEG' };
725 $end = $cookie->{ 'S_END' };
729 $seq = ">$cookie->{ 'CONTIG' }_$beg" . "_$end" . "_$cookie->{ 'STRAND' }\n";
730 $seq .= Maasha::BBrowser::Track::dna_get( $cookie );
732 push @html, Maasha::XHTML::h2( txt => "DNA", class => 'center' );
733 push @html, Maasha::XHTML::pre( txt => $seq );
735 return wantarray ? @html : \@html;
739 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<