1 ######################################################################
3 # This conducts and displays the results of a BAC search.
5 ######################################################################
12 use CXGN
::Search
::CannedForms
;
13 use CXGN
::Page
::FormattingHelpers qw
/ blue_section_html
18 use CXGN
::Tools
::Text
;
19 use CXGN
::DB
::Connection
;
20 use CXGN
::Unigene
::Search
;
21 use CatalystX
::GlobalContext
'$c';
24 #################################
25 # Start a new SGN page.
26 our $page = CXGN
::Page
->new( 'Unigene Advanced Search', 'Rob Buels');
27 $page->header('Unigene Search Results'); #print out header immediately so users get 'in progress' message
29 #create the search and query objects
30 my $search = CXGN
::Unigene
::Search
->new;
31 $search->page_size(15); #set 15 unigenes per page
32 my $query = $search->new_query;
35 my %params = $page->get_all_encoded_arguments;
37 eval { #initialize the query object from the page parameters
38 $query->from_request(\
%params);
39 }; if( $EVAL_ERROR ) {
40 if($c->config->{'production_server'}) {
41 print "<b>Invalid search parameters.</b>\n";
43 die $EVAL_ERROR; #die it on
51 # print "<pre>".Dumper($query)."</pre>";
54 my $result = $search->do_search($query);
56 my $sql = $query->to_query_string();
58 #build the HTML to output
59 my $pagination_html = $search->pagination_buttons_html( $query, $result );
62 my @tableheadings = ('Unigene','Build','Length (bp)','# Members');
64 my $querystring = $query->to_query_string;
65 while(my $ug = $result->next_result) {
66 push @tabledata,[ map {$_ || '-'} ('<a href="'.$ug->info_page_href.';'.$querystring.'">'.$ug->external_identifier.'</a>',
67 $ug->build_object->organism_group_name.' #'.$ug->build_object->build_nr,
68 commify_number
(length($ug->seq)),
74 my $results_html = <<EOH
75 <div id="searchresults">
77 . columnar_table_html
(headings
=> \
@tableheadings, data
=> \
@tabledata)
83 print page_title_html
('Unigene Search Results');
85 print blue_section_html
('Unigene Search Results',sprintf('<span class="paginate_summary">%s matches (%0.1f seconds)</span>',commify_number
($result->total_results),$result->time),$results_html);
87 print blue_section_html
('Search Again',CXGN
::Search
::CannedForms
::unigene_search_form
($page,$query));