#!/usr/local/bin/perl # fbgenequery2.pl (SRS) ## dgg, dec'98, using srs fbgenes indices of .acode data require "getopts.pl"; require "fbperls.pl"; require "fbperls_add.pl"; require "srsperls.pl"; require "fbreslist.pm"; #$debug=1; &fbInits("noprint"); &initSRS($SRSRoot); &fbSetDataVars("FBgn"); # ,1 == shortreport &fbDerivedVars(); $SRSDBName = "FBgn HUgn SGgn ATgn CEgn MGgn ZFgn"; $selfurl= $0; if (index($selfurl,$gopath)==0) { $selfurl= substr($selfurl, length($gopath)); } $searchHints=<
  • Use 'and', 'not', and 'or' boolean terms to refine a complex search.
  • Use '*' at the ends (as in gen* or *gen) to match partial words. SEOF ; #--------- list of all user-defined x-fields coming from forms ---------- @xfields=('xfield1','xfield2'); @xfieldnames=('xfieldname1','xfieldname2'); #--------- list of all fields which require special treatment ---------- $allsymbols="symbol symbol_cs synonym synonym_cs"; #--------- list of all (form+SRS) fields with info on SRS indices ------- ## Note: keep long names same as in the form, assign ## SRS short name if any ("" otherwise) and append ## :digital - if field is digital (date, year etc.) ## :cytoloc - if field is cytolocation (in FB style, digital) ## :CV - if this is CV field ## :SpacedCV -- CV field with spaces in term ## :mixed - if was indexed as both words/sentenses (spaces to _) ## :hasvalue - if this field has any value ("?*" in srs query) ## :orvalues - use OR| to join multiple values of field ## :cyto2kb -- cytologic to kilobase location conversion, including % 100 buckets %FieldEncoder=( "wild", "", "maxhit", "", "release", "", "common_or", "", "oldquery", "", "srs_pipe", "", "sppsubset", "", "libs", "", "claset", "", ## dgg: acc has gone in favor of id "acc", "id", # primary id "id", "id", # primary id "fbid", "id", # primary id "g_acc", "id", # primary id "acs", "acs", ## primary & 2ndary ids "sec_acc", "acs", # secondary acc-like "a_acc", "acs", # secondary acc-like #"all", "xxx", ## dgg,feb98, all is returning odd matches "query", "xxx", "all", "all", ## dgg,feb98, all is returning odd matches "query", "all", "symbol", "sym", "symbol_cs", "Smc", "synonym", "syn", "synonym_cs", "Snc", "name", "gen", "allele", "als", "ext_acc", "ack", "hasdna", "ack:hasvalue", ## asksrs [fbclass-ack:?*] "phenotype", "phe", "aberration", "abr", "transposon", "trp", "ref", "ref", "species", "org", "class", "cla:CV", "cla", "cla:CV", "funct", "fun:CV", "fun", "fun:CV", "struct", "fun:CV", ## new for meow #"homology", "fun:CV", ## new for meow "homology", "hlg", ## new for meow #"csome", "chn:digital", ## new for meow #"gmap", "glc:digital", ## new for meow "csome", "chn", ## new for meow "gmap", "glc", ## new for meow "subcloc", "cel:CV", ## changed from flo "cel", "cel:CV", ## changed from flo "charact", "chr:CV", "chr", "chr:CV", "enzyme", "enz:CV", "enz", "enz:CV", "mincytoloc", "clm:cytoloc", "maxcytoloc", "clx:cytoloc", "cytoloc", "kbl:cyto2kb", ## dgg, convert to kbl ! "kbloc", "kbl:digital", "mindate", "dat:digital", "maxdate", "dat:digital", "date", "dat:digital", ); foreach $FieldName ( keys(%FieldEncoder) ) { $FieldArray{$FieldName}=""; } #----------------------- fields with special actions --------------------- # corrections will be performed through eval %FieldActions=( "id", '&accession_to_standard($FieldName,"gn|al")', "fbid", '&accession_to_standard($FieldName,"gn|al")', "query", '&check_fbid_in_query($FieldName,"gn|al","id")', "g_acc", '&accession_to_standard($FieldName,"gn|al")', "a_acc", '&transfer_to_other_field($FieldName,"acs")', "sec_acc", '&transfer_to_other_field($FieldName,"acs")', "acs", '&accession_to_standard($FieldName)', "sppsubset", '&transfer_to_other_field($FieldName,"species") if($FieldArray{"species"} eq "subset")', "claset", '&decode_gene_classes($FieldName)', "class", '$FieldValue="" if( $FieldValue eq "all" )', #"libs", '$SRSDBName = $FieldValue', "species", '$FieldValue="" if( $FieldValue eq "all" )', "srs_pipe", '$srs_pipe2=$FieldValue', ); ## ## MAIN ## &Getopts("cdg:hilm:n:rstv:x:"); if ($opt_d || $ENV{'REQUEST_METHOD'} eq "POST") { $isdialog = 1; } # if ($opt_i) { $plus = "-+i"; } # if ($opt_l) { $lastonly= 1; } if ($opt_m) { $maxhits = $opt_m; } if ($opt_n) { $indexstart = $opt_n; } # if ($opt_g) { $groupsym="-s $q$opt_g$q"; } if ($opt_s) { $suffix .= "s"; } # if ($opt_t) { $dotitle= 0;} &SetProtocolVars(); ## HTML if ($dohtml) { &retrieve_html_fields(); } ## GOPHER else { if ($isdialog) { chop( $FieldArray{'query'} = ); chop( $maxhits = ); chop( $isturbogo = ); chop( $FieldArray{'symbol'} = ); chop( $FieldArray{'name'} = ); chop( $FieldArray{'mincytoloc'} = ); chop( $FieldArray{'maxcytoloc'} = ); chop( $FieldArray{'allele'} = ); chop( $FieldArray{'class'} = ); chop( $FieldArray{'species'} = ); chop( $FieldArray{'sppsubset'} = ); chop( $FieldArray{'phenotype'} = ); chop( $FieldArray{'ref'} = ); } else { $FieldArray{'query'}= join(' ',@ARGV); if( $ENV{'QUERY_STRING'} && ($ENV{'QUERY_STRING'} ne "") ) { $FieldArray{'query'}=&URLunescape($ENV{'QUERY_STRING'}); } } $query=$FieldArray{'query'}; if( $query!~/FBgn/ && $query!~/species=/ && $query!~/['"]/) { $FieldArray{'species'}="Dmel"; } #" } ## reporting style options # if ($opt_x eq "al") { $xtra='-x '.$FieldArray{'query'}; } #elsif ($opt_x eq "f") { $xtra=$opt_x= "-sfull"; } #elsif ($opt_x eq "c") { $xtra=$opt_x= "-scustom"; } #elsif ($opt_x eq "s") { $xtra=$opt_x= "-sshort"; } #elsif ($opt_x eq "r") { $xtra=$opt_x= "-sreftable"; } $libs= $FieldArray{'libs'}; if ($libs && $libs !~ /all/) { $SRSDBName= $libs; } #$rels= $FieldArray{'release'}; #if ($rels) { # if ($rels =~ /full/) { $sdb = "FBgn"; } # if ($rels =~ /pre/) { # $sdb .= ' ' if ($sdb); ## $sdb .= "FBgnpre"; # } # $SRSDBName = $sdb; # } # &FixGeneQuery(); ##??? $query=""; # KEEP IT HERE $query=&standard_fields_processing($query); ## this one calls SetSRSQueryPipe() ##print "Content-type: text/html\n\n query=$query\n"; if( $srs_pipe2 ne "" ) { ## $query= &SetSRSQueryPipe($query,$srs_pipe2); } $query= '(' . $query . ')' if( &separated_items($query) ); $query = $query . '>' . $srs_pipe2; &fbSetDataVars($srs_pipe2); &fbDerivedVars(); } QUERY: $dowild= ($FieldArray{'wild'} eq 'on'); if ($dowild) { $query =~ s/(\w)]/$1\*]/g; # is this safe?? } &SetViewVars(); ## &DoSRSQuery(); $nmatches= &DoSRSAcodeQuery($query, $askdata, $dowild ); $prettyquery= &humanize_query($query); &fbreslist'init($prettyquery); ##$fbreslist'refineForm= &getRefineDialog($store_query,$prettyquery); if ($nmatches < 2) { &fbreslist'putResultsReports( $nmatches, $askdata, 0) } else { &fbreslist'putResultsList( $nmatches, $askdata, 0); } &KillOldFiles(); &fbexit(0); #************************************************************************* # #************************************************************************* sub getRefineDialog { local($query,$humquery)=@_; local $s= <

    Refine query or find items in related data classes:


    $humquery
    matches
    REOF_BEG ; $s .= "\n
    \n"; $query=&URLescape($query); $s .= '
    '; $s .= '
    '; $s .= ''; return $s; } #************************************************************************* # #************************************************************************* sub decode_gene_classes { local($FieldName)=@_; local($FieldValue,$i,$txt,$add); $FieldValue=$FieldArray{$FieldName}; return if( $FieldValue eq "" ); local(@classes)=("__", # table for decoding classes subsets for genes "gene", # 1 "fusion_gene", # 2 "honorary_gene", # 3 block Dmel setting! "transposon", # 4 "foreign_gene", # 5 block Dmel setting! "safe_element", # 6 "safe_element.h", # 7 block Dmel setting! "mitochondrial_gene", # 8 "virus_symbiont_pathogen", # 9 "foreign_fusion", # 10 block Dmel setting! "sire_element", # 11 "sire_element.h", # 12 block Dmel setting! "non_coding_RNA_gene", # 13 "__"); local($block_Dmel)="x3x5x7x10x12x"; for( $i=1; $i<$#classes; $i++ ) { $txt='x'.$i.'x'; if( $FieldValue=~m|$txt| ) { $add=$classes[$i]; if( !($FieldArray{'class'}=~m|$add|) ) { $FieldArray{'class'}.=' '.$add; } if( ($FieldArray{'species'} eq 'Dmel') && $block_Dmel=~m|$txt| ) { $FieldArray{'species'}=""; } $FieldArray{'class'}=~s|^\s*||; } } $FieldArray{$FieldName}=""; # kill it because it's done return; }