#!/usr/bin/perl -w use CGI qw/:standard/; use CGI::Pretty; $CGI::Pretty::INDENT = ""; use Batch; use BioC; use Site; use strict; # Create the global CGI instance our $cgi = new CGI; # Create the global FileManager instance our $fm = new FileManager; # Handle initializing the FileManager session if ($cgi->param('token') || $cgi->cookie('bioctoken')) { my $token = $cgi->param('token') ? $cgi->param('token') : $cgi->cookie('bioctoken'); if ($fm->init_with_token($UPLOAD_DIR, $token)) { error('Upload session has no files') if !($fm->filenames > 0); } else { error("Couldn't load session from token: ". $cgi->param('token')) if $cgi->param('token'); } } if ($cgi->param('Search Text')) { text(); } elsif ($cgi->param('Search Gene Ontology')) { go(); } elsif ($cgi->param('text')) { text(); } elsif ($cgi->param('go')) { go(); } else { form(); } #### Subroutine: form # Make search form form #### sub form { my ($name, @colnames, @probeids, $err); print $cgi->header; site_header('Affymetrix Probe Annotation: annaffy search'); print h1('Affymetrix Probe Annotation: annaffy search'), start_form, hidden('step', 1), p('Chip:'), p(popup_menu('chip', ['hgu133a', 'hgu133b', 'hgu95av2', 'hgu95b', 'hgu95c', 'hgu95d', 'hu6800', 'mgu74av2', 'mgu74b', 'mgu74c', 'rgu34a', 'rgu34b', 'rgu34c', 'rae230a', 'rae230b', 'YEAST'])), p("E-mail address where you would like your job status sent: (optional)", br, textfield('email', '', 40)); print h3('Text:'), p(textfield('text', '', 40)), p('Metadata Type: ', popup_menu('colnames', ['Probe', 'Symbol', 'Description', 'Function', 'Chromosome', 'Chromosome Location', 'GenBank', 'LocusLink', 'Cytoband', 'UniGene', 'PubMed', 'Gene Ontology', 'Pathway'])), p(submit("Search Text")); print h3('Gene Ontology ID:'), p(textfield('go', '', 40)), p(checkbox('descendents','checked','YES','Include descendents')), p(submit("Search Gene Ontology")); print end_form; print <<'END';
Search terms can be separated by either commas or semicolons.
Text searches are exact but case insensitive. Each search term is treated as a Perl compatible regular expression. For example, to find BMP2-5, enter bmp[2-5] as the search text and select Symbol as the metadata type.
To map a set of GenBank accession numbers onto a set of probe ids, simply paste all the GenBank ids into the text field as a comma separated list. (Spaces are okay.) Select GenBank for the metadata type.
Gene Ontology ids can be entered either as bare integers or the familiar GO:XXXXXXX format. A good site for finding gene ontology ids is AmiGO.
END site_footer(); } #### Subroutine: text # Handle text search, redirect web browser to results #### sub text { my $jobname = "aafs-" . rand_token(); my $text = $cgi->param('text'); $text =~ s/^\s+|\s+$//g; $text =~ s/\s+[,;]|[,:]\s+/,/g; my @text = split(/[,;]/, $text); my ($script, $output, $jobsummary, $error, $job); if (!$cgi->param('colnames')) { error("No data columns specified."); } if (!$cgi->param('text')) { error("Please enter text to search."); } if ($cgi->param('email') && !check_email($cgi->param('email'))) { error("Invalid e-mail address."); } $script = generate_r_text($jobname, [@text]); $output = <