6 /tools/blast/datasets_selectbox.mas - returns html for the select box with all the current blast datasets
10 The name of the select box is "database".
18 The id of the database to be preselected.
24 Lukas Mueller <lam87@cornell.edu> - based on Perl code by Rob Buels and others.
42 memoize '_cached_file_modtime';
43 sub _cached_file_modtime {
47 sub blast_db_prog_selects {
51 my $timestamp = _cached_file_modtime($db)
53 $timestamp = strftime(' (%m-%d-%y)',gmtime _cached_file_modtime($db));
54 #my $seq_count = $db->sequences_count;
56 [$db->blast_db_id, $db->title.$timestamp]
59 my @db_choices = map {
60 my @dbs = map [$_,opt($_)], grep _cached_file_modtime($_), $_->blast_dbs( web_interface_visible => 't');
61 @dbs ? ('__'.$_->name, @dbs) : ()
62 } CXGN::BlastDB::Group->search_like(name => '%',{order_by => 'ordinal, name'});
64 my @ungrouped_dbs = grep _cached_file_modtime($_),CXGN::BlastDB->search( blast_db_group_id => undef, web_interface_visible => 't', {order_by => 'title'} );
66 push @db_choices, '__Other', map [$_,opt($_)], @ungrouped_dbs;
69 @db_choices or return '<span class="ghosted">The BLAST service is temporarily unavailable, we apologize for the inconvenience</span>';
71 # DB select box will either the db_id supplied, or what the user last selected, or the tomato combined blast db
72 my $selected_db_id = $db_id || $prefs->get_pref('last_blast_db_id')
74 my $d = CXGN::BlastDB->retrieve( web_interface_visible => 't', file_base => 'bacs/all_tomato_seqs' );
75 $d &&= $d->blast_db_id
78 #warn "got pref last_blast_db_file_base '$selected_db_file_base'\n";
80 my %prog_descs = ( blastn => 'BLASTN (nucleotide to nucleotide)',
81 blastx => 'BLASTX (nucleotide to protein; query translated to protein)',
82 blastp => 'BLASTP (protein to protein)',
83 tblastx => 'TBLASTX (protein to protein; both database and query are translated)',
84 tblastn => 'TBLASTN (protein to nucleotide; database translated to protein)',
87 my @program_choices = map {
89 if($db->type eq 'protein') {
90 [map [$_,$prog_descs{$_}], 'blastx','blastp']
92 [map [$_,$prog_descs{$_}], 'blastn','tblastx','tblastn']
94 } grep ref, @db_choices;
96 @db_choices = map {ref($_) ? $_->[1] : $_} @db_choices;
98 return hierarchical_selectboxes_html( parentsel => { name => 'database',
101 $selected_db_id ? (selected => $selected_db_id) : (),
103 childsel => { name => 'program',
105 childchoices => \@program_choices
109 my ($databases, $programs, $programs_js) = blast_db_prog_selects($db_id);