# Returns nothing.
+ my ( $new_session );
+
if ( defined $cookie->{ 'USER' } and $cookie->{ 'USER' } ne '' and -d "$cookie->{ 'SESSION_DIR' }/$cookie->{ 'USER' }" )
{
- $session->{ 'TIME' } = Maasha::Common::time_stamp();
- $session->{ 'PAGE' } = $cookie->{ 'PAGE' };
- $session->{ 'CLADE' } = $cookie->{ 'CLADE' };
- $session->{ 'GENOME' } = $cookie->{ 'GENOME' };
- $session->{ 'ASSEMBLY' } = $cookie->{ 'ASSEMBLY' };
- $session->{ 'CONTIG' } = $cookie->{ 'CONTIG' };
- $session->{ 'Q_ID' } = $cookie->{ 'Q_ID' };
- $session->{ 'S_BEG' } = $cookie->{ 'S_BEG' };
- $session->{ 'S_END' } = $cookie->{ 'S_END' };
- $session->{ 'STRAND' } = $cookie->{ 'STRAND' };
- $session->{ 'NAV_START' } = $cookie->{ 'PAGE' } eq 'browse' ? $cookie->{ 'NAV_START' } : undef;
- $session->{ 'NAV_END' } = $cookie->{ 'PAGE' } eq 'browse' ? $cookie->{ 'NAV_END' } : undef;
-
- Maasha::BGB::Session::session_store( "$cookie->{ 'SESSION_DIR' }/$cookie->{ 'USER' }/session.json", $session );
+ $new_session->{ 'PASSWORD' } = $session->{ 'PASSWORD' };
+ $new_session->{ 'SESSION_ID' } = $session->{ 'SESSION_ID' };
+ $new_session->{ 'TIME' } = Maasha::Common::time_stamp();
+ $new_session->{ 'PAGE' } = $cookie->{ 'PAGE' };
+
+ if ( $cookie->{ 'PAGE' } eq 'browse' )
+ {
+ $new_session->{ 'CLADE' } = $cookie->{ 'CLADE' };
+ $new_session->{ 'GENOME' } = $cookie->{ 'GENOME' };
+ $new_session->{ 'ASSEMBLY' } = $cookie->{ 'ASSEMBLY' };
+ $new_session->{ 'CONTIG' } = $cookie->{ 'CONTIG' };
+ $new_session->{ 'NAV_START' } = $cookie->{ 'NAV_START' };
+ $new_session->{ 'NAV_END' } = $cookie->{ 'NAV_END' };
+ }
+ elsif ( $cookie->{ 'PAGE' } eq 'contig' )
+ {
+ $new_session->{ 'CLADE' } = $cookie->{ 'CLADE' };
+ $new_session->{ 'GENOME' } = $cookie->{ 'GENOME' };
+ $new_session->{ 'ASSEMBLY' } = $cookie->{ 'ASSEMBLY' };
+ }
+ elsif ( $cookie->{ 'PAGE' } eq 'assembly' )
+ {
+ $new_session->{ 'CLADE' } = $cookie->{ 'CLADE' };
+ $new_session->{ 'GENOME' } = $cookie->{ 'GENOME' };
+ }
+ elsif ( $cookie->{ 'PAGE' } eq 'genome' )
+ {
+ $new_session->{ 'CLADE' } = $cookie->{ 'CLADE' };
+ }
+ elsif ( $cookie->{ 'PAGE' } eq 'export' )
+ {
+ $new_session->{ 'CLADE' } = $cookie->{ 'CLADE' };
+ $new_session->{ 'GENOME' } = $cookie->{ 'GENOME' };
+ $new_session->{ 'ASSEMBLY' } = $cookie->{ 'ASSEMBLY' };
+ $new_session->{ 'CONTIG' } = $cookie->{ 'CONTIG' };
+ $new_session->{ 'Q_ID' } = $cookie->{ 'Q_ID' };
+ $new_session->{ 'S_BEG' } = $cookie->{ 'S_BEG' };
+ $new_session->{ 'S_END' } = $cookie->{ 'S_END' };
+ $new_session->{ 'STRAND' } = $cookie->{ 'STRAND' };
+ }
+
+ Maasha::BGB::Session::session_store( "$cookie->{ 'SESSION_DIR' }/$cookie->{ 'USER' }/session.json", $new_session );
}
}
}
-sub cookie_page_next
-{
- # Martin A. Hansen, November 2009.
-
- # Returns the next page in the taxonomy path.
-
- my ( $cookie, # cookie hash
- ) = @_;
-
- # Returns a string.
-
- my ( $i );
-
- for ( $i = 0; $i < @{ $cookie->{ 'LIST_PAGES' } }; $i++ ) {
- last if $cookie->{ 'PAGE' } eq $cookie->{ 'LIST_PAGES' }->[ $i ];
- }
-
- return $cookie->{ 'LIST_PAGES' }->[ $i + 1 ];
-}
-
-
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PAGES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
push @html, page_dna( $cookie );
} elsif ( $cookie->{ 'PAGE' } eq 'export' ) {
push @html, page_export( $cookie );
- } else {
- push @html, page_taxonomy( $cookie );
+ } elsif ( $cookie->{ 'PAGE' } eq 'clade' ) {
+ push @html, page_clade( $cookie );
+ } elsif ( $cookie->{ 'PAGE' } eq 'genome' ) {
+ push @html, page_genome( $cookie );
+ } elsif ( $cookie->{ 'PAGE' } eq 'assembly' ) {
+ push @html, page_assembly( $cookie );
+ } elsif ( $cookie->{ 'PAGE' } eq 'contig' ) {
+ push @html, page_contig( $cookie );
}
return wantarray ? @html : \@html;
}
-sub page_taxonomy
+sub page_clade
+{
+ # Martin A. Hansen, March 2010.
+
+ # Renders the clade selection page.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html );
+
+ push @html, section_taxonomy_table( $cookie );
+ push @html, section_clade( $cookie );
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub page_genome
+{
+ # Martin A. Hansen, March 2010.
+
+ # Renders the genome selection page.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html );
+
+ push @html, section_taxonomy_table( $cookie );
+ push @html, section_genome( $cookie );
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub page_assembly
+{
+ # Martin A. Hansen, March 2010.
+
+ # Renders the clade selection page.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html );
+
+ push @html, section_taxonomy_table( $cookie );
+ push @html, section_assembly( $cookie );
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub page_contig
{
# Martin A. Hansen, November 2009.
my ( @html );
push @html, section_taxonomy_table( $cookie );
- push @html, section_taxonomy_select( $cookie );
+ push @html, section_contig( $cookie );
return wantarray ? @html : \@html;
}
}
-sub section_taxonomy_select
+sub section_clade
{
- # Martin A. Hansen, November 2009.
+ # Martin A. Hansen, March 2010.
- # Returns a HTML section with selection choices
+ # Returns a HTML section with clade selection choices
# for navigating the taxonomy tree.
my ( $cookie, # cookie hash
# Returns a list.
- my ( $list, @html, $item, $href );
+ my ( @html, $clade, $href );
+
+ push @html, Maasha::XHTML::h2( txt => "Select clade", class => 'center' );
+
+ push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center', cellpadding => '5px' );
+
+ foreach $clade ( @{ $cookie->{ 'LIST_CLADE' } } )
+ {
+ $href = "$cookie->{ 'SCRIPT' }?page=genome";
+ $href .= "&session_id=$cookie->{ 'SESSION_ID' }";
+ $href .= "&user=$cookie->{ 'USER' }";
+ $href .= "&clade=$clade";
+
+ push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $clade, href => $href ) ] );
+ }
+
+ push @html, Maasha::XHTML::table_end;
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub section_genome
+{
+ # Martin A. Hansen, March 2010.
+
+ # Returns a HTML section with genome selection choices
+ # for navigating the taxonomy tree.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
- $list = "LIST_" . uc $cookie->{ 'PAGE' };
+ my ( @html, $genome, $href );
- push @html, Maasha::XHTML::h2( txt => "Select $cookie->{ 'PAGE' }", class => 'center' );
+ push @html, Maasha::XHTML::h2( txt => "Select genome", class => 'center' );
push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center', cellpadding => '5px' );
- foreach $item ( @{ $cookie->{ $list } } )
+ foreach $genome ( @{ $cookie->{ 'LIST_GENOME' } } )
{
- $cookie->{ uc $cookie->{ 'PAGE' } } = $item;
+ $href = "$cookie->{ 'SCRIPT' }?page=assembly";
+ $href .= "&session_id=$cookie->{ 'SESSION_ID' }";
+ $href .= "&user=$cookie->{ 'USER' }";
+ $href .= "&clade=$cookie->{ 'CLADE' }";
+ $href .= "&genome=$genome";
+
+ push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $genome, href => $href ) ] );
+ }
+
+ push @html, Maasha::XHTML::table_end;
+
+ return wantarray ? @html : \@html;
+}
+
- $href = "$cookie->{ 'SCRIPT' }?page=" . cookie_page_next( $cookie );
+sub section_assembly
+{
+ # Martin A. Hansen, March 2010.
+
+ # Returns a HTML section with assembly selection choices
+ # for navigating the taxonomy tree.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html, $assembly, $href );
+
+ push @html, Maasha::XHTML::h2( txt => "Select assembly", class => 'center' );
+
+ push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center', cellpadding => '5px' );
+
+ foreach $assembly ( @{ $cookie->{ 'LIST_ASSEMBLY' } } )
+ {
+ $href = "$cookie->{ 'SCRIPT' }?page=contig";
+ $href .= "&session_id=$cookie->{ 'SESSION_ID' }";
+ $href .= "&user=$cookie->{ 'USER' }";
+ $href .= "&clade=$cookie->{ 'CLADE' }";
+ $href .= "&genome=$cookie->{ 'GENOME' }";
+ $href .= "&assembly=$assembly";
+
+ push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $assembly, href => $href ) ] );
+ }
+
+ push @html, Maasha::XHTML::table_end;
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub section_contig
+{
+ # Martin A. Hansen, March 2010.
+
+ # Returns a HTML section with contig selection choices
+ # for navigating the taxonomy tree.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html, $contig, $href );
+
+ push @html, Maasha::XHTML::h2( txt => "Select contig", class => 'center' );
+
+ push @html, Maasha::XHTML::table_beg( summary => "Taxonomy select table", align => 'center', cellpadding => '5px' );
+
+ foreach $contig ( @{ $cookie->{ 'LIST_CONTIG' } } )
+ {
+ $href = "$cookie->{ 'SCRIPT' }?page=browse";
$href .= "&session_id=$cookie->{ 'SESSION_ID' }";
$href .= "&user=$cookie->{ 'USER' }";
$href .= "&clade=$cookie->{ 'CLADE' }";
- $href .= "&genome=$cookie->{ 'GENOME' }" if $cookie->{ 'GENOME' };
- $href .= "&assembly=$cookie->{ 'ASSEMBLY' }" if $cookie->{ 'ASSEMBLY' };
- $href .= "&contig=$cookie->{ 'CONTIG' }" if $cookie->{ 'CONTIG' };
+ $href .= "&genome=$cookie->{ 'GENOME' }";
+ $href .= "&assembly=$cookie->{ 'ASSEMBLY' }";
+ $href .= "&contig=$contig";
- push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $item, href => $href ) ] );
+ push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $contig, href => $href ) ] );
}
push @html, Maasha::XHTML::table_end;