#!@@_perl_root_@@/bin/perl.exe
package GeneInfoCurationPage;

##########################################################
#                                                        #
# dictyBase Extension of GeneInfoCurationPage            #
#                                                        #
##########################################################

use GeneInfoCurationPage_base;
use aliased 'Modware::DataSource::Chado';

BEGIN { %GeneInfoCurationPage:: = %GeneInfoCurationPage_base:: }



########################################################################
sub citationAbstract {
########################################################################
    my ($self, $refNo, $refObj) = @_;
    my $citation = $refObj->formatedCitation; 
    my $abstract = $refObj->abstract;
  
    $abstract =~ s/\///g;

    my $return   = $citation.br.font({-color=>"red"}, " (Reference_no = $refNo)");
       $return  .= br.font({-color=>"red"}, " (Pubmed = ".$refObj->pubmed.")") if $refObj->pubmed;
       $return  .= blockquote($abstract);

    return $return;

}

#
# took out ypd stuff
#
########################################################################
sub displayMainList {
########################################################################
    my ($self) = shift;
    my ($title, $featNm, $featNo, $locusNm, $locusNo, 
	$curated, $notYet,  $total);

	my $schema = Chado->handler;

    if ($self->{'_locusNm'}) {
	$locusNm = $self->{'_locusNm'};
	$locusNo = $self->{'_locusNo'};
	$title = $self->title." for ".$locusNm;

	my $total_count
    = $schema->resultset('Sequence::FeaturePub')
    ->count( { 'feature.uniquename' => $locusNm },
    { join => 'feature', group_by => 'pub_id' ,  cache => 1} );

	$curated = $schema->resultset('Sequence::FeaturePubprop')
    ->search( { 'cv.name' => 'dictyBase_literature_topic', },
    { join => { 'type' => 'cv' } } )->search_related(
    'feature_pub',
    { 'feature.uniquename' => $locusNm },
    {   join     => 'feature',
        group_by => 'pub_id',
        cache    => 1
    }
    )->count;

	$notYet = $total_count - $curated;

    }
    else {
	$featNm = $self->{'_featNm'};
	$featNo = $self->{'_featNo'};
	$title = $self->title." for ".$featNm;
	my $featObj = Feature->new(dbh=>$dbh,
				   feature_name=>$featNm);
	$curated = $featObj->curatedRefNum;
	$notYet = $featObj->notYetCuratedRefNum;
    }
    &printStartPage($self->database, $title, $self->help);  

#    ###########
#    my $ypdPaperNum;
#    my $ypdObj = Ypd_protein_info->new(dbh=>$dbh,
#				       dictyBaseid=>$self->{'_dictyBaseid'});
#    if ($ypdObj) { $ypdPaperNum = $ypdObj->ypdPaperNum; }
#    ###########
					    
    my ($name, $pass, $type);
    if ($locusNo) {
	$type = "Locus";
	$name = $locusNm;
	$pass = "locusNo=$locusNo";
    }
    else {
	$type= "Feature";
	$name = $featNm;
	$pass = "featNo=$featNo";
    }
    if ($curated) { ### the number of the curated papers	
        print p, b("$curated ".a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=".$self->user."&$pass&paperList=Curated"}, "Curated PubMed References for $name")),br;
	
    }
    if ($notYet) { ### the number of the not_yet_curated papers
       	print p, b("$notYet ".a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=".$self->user."&$pass&paperList=NotYet"}, "New PubMed References Not Yet Curated for $name")), br;       
    }

    if (!$curated && !$notYet) {
	print p, b("No PubMed Reference for $name at the moment.");
    }
    print p;
    &printEndPage;
}

#
# changed method named locusList, featureList (did not exist) to 
#   locusArrayRef, featureArrayRef
#
#######################################################################
sub displaySharedAnnotation {
#######################################################################
    my ($self) = shift;
    my $title = "Annotation for Locus and Feature";
    &printStartPage($self->database, $title, $self->help);

    my $refNo = param('refNo');
    my ($locusArrayRef, $featureArrayRef);
    my $refObj = Reference->new(dbh=>$dbh,
				reference_no=>$refNo);
    if (param('locusNo')) {
	$locusArrayRef = $refObj->locusArrayRef;
    }
    elsif (param('featNo')) {
	$featureArrayRef = $refObj->featureArrayRef;
    }
    else {
	$locusArrayRef = $refObj->locusArrayRef;
	$featureArrayRef = $refObj->featureArrayRef;
    }
    print center(h2("reference_no = $refNo")).p;
    my $list;
    foreach my $rowRef (@$locusArrayRef) {
	my ($locusNm) = @$rowRef;
	$list .= li(a({-href=>$configUrl->dictyBaseCGIRoot."gene_page.pl?gene_name=$locusNm", 
		       -target=>'anotherWin'}, $locusNm));
    }
    foreach my $rowRef (@$featureArrayRef) {
	my ($featNm) = @$rowRef;
	$list .= li(a({-href=>$configUrl->dictyBaseCGIRoot."gene_page.pl?featureName=$featNm", 
		       -target=>'anotherWin'}, $featNm));
    }
    print ul($list);
    print 
          "<div align=center>\n",
          "<form>\n",
          "<input type=button value=\"    Close    \" onClick=\"self.close()\">\n",
          "</form>";
    
    &printEndPage;
}
#
#  took added spaces between pipes to get to wrap (long list wan't wrapping)
#
########################################################################
sub topLeftCell {
########################################################################
    my ($self, $name, $refNo, $refObj) = @_;
    
    my @curatedLoci = $refObj->getCuratedLoci;
    my @curatedFeatures = $refObj->getCuratedFeatures;

    my @notYetLoci = $refObj->getNotYetLoci;
    my @notYetFeatures = $refObj->getNotYetFeatures;
    
    my @unlinkedLoci = $refObj->getUnlinkedLoci;
    my @unlinkedFeatures = $refObj->getUnlinkedFeatures;

    my ($curatedList, $notYetList, $unlinkedList);

    my $user = $self->user;
    foreach my $curated (@curatedLoci) {
	my ($locusNm, $locusNo) = split(/:/, $curated);
	$curatedList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&locusNo=$locusNo&refNo=$refNo", -target=>"infowin"}, $locusNm)." | "; 
    }
    foreach my $curated (@curatedFeatures) {
	my ($featNm, $featNo) = split(/:/, $curated);
	$curatedList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&featNo=$featNo&refNo=$refNo", -target=>"infowin"}, $featNm)." | "; 
    }
    if (!$curatedList) { $curatedList = "nothing yet";}
    else { $curatedList =~ s/\| *$//; }

    foreach my $notyet (@notYetLoci) {
	my ($locusNm, $locusNo) = split(/:/, $notyet);
	$notYetList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&locusNo=$locusNo&refNo=$refNo", -target=>"infowin"}, $locusNm); 
	my $locusObj = Locus->new(dbh=>$dbh,
				  locus_no=>$locusNo);
	if ($locusObj) {
	    my ($Rnum, $Rdate, $Edate, $Sdate, $isStd) = 
		split(/:/, $locusObj->geneReservationInfo);
	    if ($isStd =~ /^N/i) {
		$notYetList .= font({-color=>'red'}, "*");
	    }
	}
	$notYetList .= " | ";
    }
    foreach my $notyet (@notYetFeatures) {
	my ($featNm, $featNo) = split(/:/, $notyet);
	$notYetList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&featNo=$featNo&refNo=$refNo", -target=>"infowin"}, $featNm)." | "; 
    }
    if (!$notYetList) { $notYetList = "nothing left";}
    else { $notYetList =~ s/\| *$//; }

    
    foreach my $unlinked (@unlinkedLoci) {

	my ($locusNm, $locusNo) = split(/:/, $unlinked);
	
	$unlinkedList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&locusNo=$locusNo&refNo=$refNo", -target=>"infowin"}, $locusNm)." | "; 
	
    }
    
    foreach my $unlinked (@unlinkedFeatures) {

	my ($featNm, $featNo) = split(/:/, $unlinked);
	$notYetList .= a({-href=>"/db/cgi-bin/dictyBase/curation/geneinfoCuration?user=$user&featNo=$featNo&refNo=$refNo", -target=>"infowin"}, $featNm)." | "; 

    }
    if (!$unlinkedList) { $unlinkedList = "nothing yet"; }
    else {  $unlinkedList =~ s/\| *$//; }

    return 
	table({-width=>'100%', 
            -border=>'0',
	       -cellspacing=>'0',
	       -cellpadding=>'2'},
	      Tr(th({-bgcolor=>"#a4abc2", width=>"50%"},
		    "Annotation Info : $name")).
	      Tr(td({-bgcolor=>"#CCFFCC"},
		    font({-size=>'-1'},
			 strong("Curated for : ").$curatedList))).
	      Tr(td({-bgcolor=>"#b7d8e4"},
		    font({-size=>'-1'},
			 strong("Not yet curated for : ").$notYetList).br.
		    textfield(-name=>'addedLoci',
			      -size=>15). " ".
		    submit(-name=>'submit',
			   -value=>'Add Loci & Curate'))).
	      Tr(td({-bgcolor=>"#CCFFFF"},
		    font({-size=>'-1'},
			 strong("Unlinked from : ").$unlinkedList))));
}

#######################################################################
sub setTopic {
#######################################################################
    my ($self, $topic) = @_;
        if ($topic =~ /^Mutants\/Phenotypes/i) {
	$self->{'_mutphe'} = $topic;
    }
    elsif ($topic =~ /^Genetic Interactions/i) {
	$self->{'_geneticInter'} = $topic;
    }
    elsif ($topic =~ /^Function\/Process/i) {
	$self->{'_funpro'} = $topic;
    }
    elsif ($topic =~ /^Cellular Location/i) {
	$self->{'_cellloc'} = $topic;
    }
    elsif ($topic =~ /^Regulatory Role/i) {
	$self->{'_regulatoryRole'} = $topic;
    }
    elsif ($topic =~ /^Strains\/Constructs/i) {
	$self->{'_strains'} = $topic;
    }
    elsif ($topic =~ /^Synonym/i) {
	$self->{'_synonym'} = $topic;
    }
    elsif ($topic =~ /^Techniques and Reagents/i) {
	$self->{'_tech'} = $topic;
    }
    elsif ($topic =~ /^Other Features/i) {
	$self->{'_other'} = $topic;
    }
    elsif ($topic =~ /^Reviews/i) {
	$self->{'_review'} = $topic;
    }
    elsif ($topic =~ /^Archived Literature/i) {
	$self->{'_archive'} = $topic;
    }
    elsif ($topic =~ /^Selected Review/i) {
	$self->{'_selected'} = $topic;
    }
    elsif ($topic =~ /^Genome-wide Analysis/i) {
	$self->{'_genome'} = $topic;
    }
    elsif ($topic =~ /^Antibodies/i) {
	$self->{'_antibodies'} = $topic;
    }
    elsif ($topic =~ /^DNA\/RNA Sequence Features/i) {
	$self->{'_dnaseq'} = $topic;
    }
    elsif ($topic =~ /^Mapping/i) {
	$self->{'_mapping'} = $topic;
    }
    elsif ($topic =~ /^RNA Levels and Processing/i) {
	$self->{'_rnalevel'} = $topic;
    }
    elsif ($topic =~ /^Translational Regulation/i) {
	$self->{'_translation'} = $topic;
    }
    elsif ($topic =~ /^Protein Functional Domain/i) {
	$self->{'_proteinfunc'} = $topic;
    }
    elsif ($topic =~ /^Protein Physical Properties/i) {
	$self->{'_proteinphys'} = $topic;
    }
    elsif ($topic =~ /^Protein\/Nucleic Acid Structure/i) {
	$self->{'_proteinstruct'} = $topic;
    }
    elsif ($topic =~ /^Protein Processing\/Regulation/i) {
	$self->{'_proteinprocess'} = $topic;
    }
    elsif ($topic =~ /^Protein-Protein Interactions/i) {
	$self->{'_proteinprotein'} = $topic;
    }
    elsif ($topic =~ /^Protein-Nucleic Acid Interactions/i) {
	$self->{'_nucleic'} = $topic;
    }
    elsif ($topic =~ /^Substrates\/Ligands\/Cofactors/i) {
	$self->{'_subst'} = $topic;
    }
    elsif ($topic =~ /^Mammalian Gene Related/i) {
	$self->{'_mammalian'} = $topic;
    }
    elsif ($topic =~ /^Non-mammalian Gene Related/i) {
	$self->{'_nonmammalian'} = $topic;
    }
    elsif ($topic =~ /^Disease Related/i) {
	$self->{'_disease'} = $topic;
    }
    elsif ($topic =~ /^Phylogenetic Analysis/i) {
	$self->{'_phylogenetic'} = $topic;
    }
    elsif ($topic =~ /^Cytoskeleton/i) {
	$self->{'_cytoskeleton'} = $topic;
    }
    elsif ($topic =~ /^Chemotaxis\/Motility/i) {
	$self->{'_chemotaxis'} = $topic;
    }
    elsif ($topic =~ /^Phototaxis\/Thermotaxis/i) {
	$self->{'_phototaxis'} = $topic;
    }
    elsif ($topic =~ /^Mitosis/i) {
	$self->{'_mitosis'} = $topic;
    }
    elsif ($topic =~ /^Endocytosis/i) {
	$self->{'_endocytosis'} = $topic;
    }
    elsif ($topic =~ /^Adhesion/i) {
	$self->{'_adhesion'} = $topic;
    }
    elsif ($topic =~ /^Signal Transduction/i) {
	$self->{'_signalTransduction'} = $topic;
    }
    elsif ($topic =~ /^Regulated By/i) {
	$self->{'_regulatedBy'} = $topic;
    }
    elsif ($topic =~ /^Cell Cycle/i) {
	$self->{'_cellcycle'} = $topic;
    }
    elsif ($topic =~ /^Transcriptional Regulation/i) {
	$self->{'_transcrip'} = $topic;
    }
    elsif ($topic =~ /^Post-Translational Modifications/i) {
	$self->{'_proteinposttranslational'} = $topic;
    }
    elsif ($topic =~ /^Growth/i) {
	$self->{'_growth'} = $topic;
    }
    elsif ($topic =~ /^Development\/Morphogenesis/i) {
	$self->{'_morphogenesis'} = $topic;
    }
    elsif ($topic =~ /^Sporulation\/Germination/i) {
	$self->{'_germination'} = $topic;
    }
    elsif ($topic =~ /^Sexual Cycle/i) {
	$self->{'_sexualCycle'} = $topic;
    }
    elsif ($topic =~ /^Cell Type Localization/i) {
	$self->{'_cellTypeLoc'} = $topic;
    }
}






########################################################################
sub populateVal {
########################################################################
    my ($self, $currentValRef, $dbValRef) = @_;

    #========================================
    # IMPORTANT
    # currentValRef and dbVal ref must be ordered the same!
    #
    #========================================
    push(@$currentValRef, param('mutpheCB') ? param('mutpheCB'):""); 
    push(@$currentValRef, param('geneticInterCB') ? param('geneticInterCB'):""); 
    push(@$currentValRef, param('funproCB') ? param('funproCB'):"");
    push(@$currentValRef, param('celllocCB') ? param('celllocCB'):"");
    push(@$currentValRef, param('regulatoryRoleCB') ? param('regulatoryRoleCB'):"");
    push(@$currentValRef, param('cellcycleCB') ? param('cellcycleCB'):"");
    push(@$currentValRef, param('strainsCB') ? param('strainsCB'):"");
    push(@$currentValRef, param('synonymCB') ? param('synonymCB'):"");
    push(@$currentValRef, param('techCB') ? param('techCB'):"");
    push(@$currentValRef, param('otherCB') ? param('otherCB'):"");
    push(@$currentValRef, param('reviewCB') ? param('reviewCB'):"");
    push(@$currentValRef, param('archiveCB') ? param('archiveCB'):"");
    push(@$currentValRef, param('selectedCB') ? param('selectedCB'):"");
    push(@$currentValRef, param('genomeCB') ? param('genomeCB'):"");
    push(@$currentValRef, param('antibodiesCB') ? param('antibodiesCB'):"");
    push(@$currentValRef, param('dnaseqCB') ? param('dnaseqCB'):"");
    push(@$currentValRef, param('mappingCB') ? param('mappingCB'):"");
    push(@$currentValRef, param('rnalevelCB') ? param('rnalevelCB'):"");
    push(@$currentValRef, param('transcripCB') ? param('transcripCB'):"");
    push(@$currentValRef, param('translationCB') ? param('translationCB'):"");
    push(@$currentValRef, param('proteinfuncCB') ? param('proteinfuncCB'):"");
    push(@$currentValRef, param('proteinphysCB') ? param('proteinphysCB'):"");
    push(@$currentValRef, param('proteinstructCB') ? param('proteinstructCB'):"");
    push(@$currentValRef, param('proteinproteinCB') ? param('proteinproteinCB'):"");
    push(@$currentValRef, param('nucleicCB') ? param('nucleicCB'):"");
    push(@$currentValRef, param('substCB') ? param('substCB'):"");
    push(@$currentValRef, param('mammalianCB') ? param('mammalianCB'):"");
    push(@$currentValRef, param('nonmammalianCB') ? param('nonmammalianCB'):"");
    push(@$currentValRef, param('diseaseCB') ? param('diseaseCB'):"");
    push(@$currentValRef, param('phylogeneticCB') ? param('phylogeneticCB'):"");



    push(@$currentValRef, param('cytoskeletonCB') ? param('cytoskeletonCB'):"");
    push(@$currentValRef, param('chemotaxisCB') ? param('chemotaxisCB'):"");
    push(@$currentValRef, param('mitosisCB') ? param('mitosisCB'):"");
    push(@$currentValRef, param('endocytosisCB') ? param('endocytosisCB'):"");
    push(@$currentValRef, param('adhesionCB') ? param('adhesionCB'):"");
    push(@$currentValRef, param('signalTransductionCB') ? param('signalTransductionCB'):"");
    push(@$currentValRef, param('regulatedByCB') ? param('regulatedByCB'):"");
    push(@$currentValRef, param('cellcycleCB') ? param('cellcycleCB'):"");
    push(@$currentValRef, param('proteinposttranslationalCB') ? param('proteinposttranslationalCB'):"");


    push(@$currentValRef, param('growthCB') ? param('growthCB'):"");
    push(@$currentValRef, param('morphogenesisCB') ? param('morphogenesisCB'):"");
    push(@$currentValRef, param('germinationCB') ? param('germinationCB'):"");
    push(@$currentValRef, param('sexualCycleCB') ? param('sexualCycleCB'):"");
    push(@$currentValRef, param('cellTypeLocCB') ? param('cellTypeLocCB'):"");
    push(@$currentValRef, param('phototaxisCB') ? param('phototaxisCB'):"");

    #========================================
    # IMPORTANT
    # currentValRef and dbVal ref must be ordered the same!
    #
    #========================================
    @$dbValRef = ($self->{'_mutphe'},
		  $self->{'_geneticInter'},
		  $self->{'_funpro'},
		  $self->{'_cellloc'},
		  $self->{'_regulatoryRole'},
		  $self->{'_cellcycle'},
		  $self->{'_strains'},
		  $self->{'_synonym'},
		  $self->{'_tech'},
		  $self->{'_other'},
		  $self->{'_review'},
		  $self->{'_archive'},
		  $self->{'_selected'},
		  $self->{'_genome'},
		  $self->{'_antibodies'},
		  $self->{'_dnaseq'},
		  $self->{'_mapping'},
		  $self->{'_rnalevel'},
		  $self->{'_transcrip'},
		  $self->{'_translation'},
		  $self->{'_proteinfunc'},
		  $self->{'_proteinphys'},
		  $self->{'_proteinstruct'},
		  $self->{'_proteinprotein'},
		  $self->{'_nucleic'},
		  $self->{'_subst'},
		  $self->{'_mammalian'},
		  $self->{'_nonmammalian'},
		  $self->{'_disease'},
		  $self->{'_phylogenetic'},
            $self->{'_cytoskeleton'},
            $self->{'_chemotaxis'},
            $self->{'_mitosis'},
            $self->{'_endocytosis'},
            $self->{'_adhesion'},
            $self->{'_signalTransduction'},
            $self->{'_regulatedBy'},
            $self->{'_cellcycle'},
            $self->{'_proteinposttranslational'},
            $self->{'_growth'},
            $self->{'_morphogenesis'},
            $self->{'_germination'},
            $self->{'_sexualCycle'},
            $self->{'_cellTypeLoc'},
            $self->{'_phototaxis'}
    );
}

########################################################################
sub geneticSection {
########################################################################
    my ($self, $name, $type) = @_;
    my $user = $self->user;
    my $urlRoot = $configUrl->dictyBaseCGIRoot;    
    return
	$self->topicCheckbox("mutpheCB", "Mutants/Phenotypes", $self->{'_mutphe'},  font({-size=>'-1'}, "Mutants/".a({-href=>$urlRoot."$dblink/curation/phenotypeCuration?user=$user&type=$type&feat=$name", -target=>"infowin"},"Phenotypes"))."&nbsp;".a({-href=>'javascript:checkboth()'},
 img({-src=>$configUrl->dictyBaseImages."both.gif", -width=>"30", -height=>"15", -border=>"0"}))).br.
	$self->topicCheckbox("funproCB", "Function/Process", $self->{'_funpro'}, font({-size=>'-1'}, " Function/Process &nbsp;&nbsp;".a({-href=>$urlRoot."$dblink/curation/goCuration?user=$user&type=$type&feat=$name", -target=>"infowin"}, "[GO]"))).br.
	$self->topicCheckbox("celllocCB", "Cellular Location", $self->{'_cellloc'}, font({-size=>'-1'}, " Cellular Location &nbsp;&nbsp;".a({-href=>$urlRoot."$dblink/curation/goCuration?user=$user&type=$type&feat=$name", -target=>"infowin"},"[GO]"))).br.
	$self->topicCheckbox("cytoskeletonCB", "Cytoskeleton", $self->{'_cytoskeleton'}, font({-size=>'-1'}, " Cytoskeleton")).br.
	$self->topicCheckbox("chemotaxisCB", "Chemotaxis/Motility", $self->{'_chemotaxis'}, font({-size=>'-1'}, " Chemotaxis/Motility")).br.
	$self->topicCheckbox("phototaxisCB", "Phototaxis/Thermotaxis", $self->{'_phototaxis'}, font({-size=>'-1'}, " Phototaxis/Thermotaxis")).br.
	$self->topicCheckbox("mitosisCB", "Mitosis", $self->{'_mitosis'}, font({-size=>'-1'}, " Mitosis")).br.
	$self->topicCheckbox("endocytosisCB", "Endocytosis", $self->{'_endocytosis'}, font({-size=>'-1'}, " Endocytosis")).br.
	$self->topicCheckbox("adhesionCB", "Adhesion", $self->{'_adhesion'}, font({-size=>'-1'}, " Adhesion")).br.
	$self->topicCheckbox("signalTransductionCB", "Signal Transduction", $self->{'_signalTransduction'}, font({-size=>'-1'}, " Signal Transduction")).br.

	$self->topicCheckbox("cellcycleCB", "Cell Cycle", $self->{'_cellcycle'}, font({-size=>'-1'}, " Cell Cycle")).br.
	$self->topicCheckbox("geneticInterCB", "Genetic Interactions", $self->{'_geneticInter'}, font({-size=>'-1'}, " Genetic Interactions"));
}


########################################################################
sub nucleicSection {
########################################################################
    my ($self) = @_;
    return 
	$self->topicCheckbox("dnaseqCB", "DNA/RNA Sequence Features", $self->{'_dnaseq'}, font({-size=>'-1'}, " DNA/RNA Sequence Features")).br.
	$self->topicCheckbox("mappingCB", "Mapping", $self->{'_mapping'},font({-size=>'-1'}," Mapping")).br.
	$self->topicCheckbox("rnalevelCB", "RNA Levels and Processing", $self->{'_rnalevel'}, font({-size=>'-1'}," RNA Levels and Processing")).br.
     $self->topicCheckbox("transcripCB", "Transcriptional Regulation", $self->{'_transcrip'}, font({-size=>'-1'}," Transcriptional Regulation")).br.
     $self->topicCheckbox("translationCB", "Translational Regulation", $self->{'_translation'},font({-size=>'-1'}," Translational Regulation")).br.br.br;
}

############################################################################
sub proteinSection {
############################################################################
    my ($self) = @_;

    return 
	$self->topicCheckbox("proteinfuncCB", "Protein Functional Domain", $self->{'_proteinfunc'}, font({-size=>'-1'}," Protein Functional Domain")).br.
	$self->topicCheckbox("proteinphysCB", "Protein Physical Properties", $self->{'_proteinphys'}, font({-size=>'-1'}, " Protein Physical Properties")).br.
     $self->topicCheckbox("proteinstructCB", "Protein/Nucleic Acid Structure", $self->{'_proteinstruct'}, font({-size=>'-1'}, " Protein/Nucleic Acid Structure")).br.
     $self->topicCheckbox("proteinposttranslationalCB", "Post-Translational Modifications", $self->{'_proteinposttranslational'}, font({-size=>'-1'}, " Post-Translational Modifications")).br.
     $self->topicCheckbox("proteinproteinCB", "Protein-Protein Interactions", $self->{'_proteinprotein'}, font({-size=>'-1'}, " Protein-Protein Interactions")).br.
     $self->topicCheckbox("nucleicCB", "Protein-Nucleic Acid Interactions", $self->{'_nucleic'}, font({-size=>'-1'}, " Protein-Nucleic Acid Interactions")).br.
     $self->topicCheckbox("substCB", "Substrates/Ligands/Cofactors", $self->{'_subst'}, font({-size=>'-1'}, " Substrates/Ligands/Cofactors")).br.
	$self->topicCheckbox("regulatedByCB", "Regulated By", $self->{'_regulatedBy'}, font({-size=>'-1'}, " Regulated By")).br.

    	$self->topicCheckbox("regulatoryRoleCB", "Regulatory Role", $self->{'_regulatoryRole'}, font({-size=>'-1'}, " Regulatory Role")).br;

}

########################################################################
sub relatedSection {
########################################################################
    my ($self) = @_;
    return 
	$self->topicCheckbox("mammalianCB", "Mammalian Gene Related", $self->{'_mammalian'}, font({-size=>'-1'}, " Mammalian Gene Related")).br.
 	$self->topicCheckbox("nonmammalianCB", "Non-mammalian Gene Related", $self->{'_nonmammalian'}, font({-size=>'-1'}, " Non-mammalian Gene Related")).br.

	$self->topicCheckbox("diseaseCB", "Disease Related", $self->{'_disease'}, font({-size=>'-1'}," Disease Related")).br.
	$self->topicCheckbox("phylogeneticCB", "Phylogenetic Analysis", $self->{'_phylogenetic'}, font({-size=>'-1'}," Phylogenetic Analysis"));

}

########################################################################
sub lifeCycleSection{
########################################################################
    my ($self) = @_;
    return 
	$self->topicCheckbox("growthCB", "Growth", $self->{'_growth'}, font({-size=>'-1'}, " Growth")).br.
	$self->topicCheckbox("morphogenesisCB", "Development/Morphogenesis", $self->{'_morphogenesis'}, font({-size=>'-1'}, " Development/Morphogenesis")).br.
	$self->topicCheckbox("germinationCB", "Sporulation/Germination", $self->{'_germination'}, font({-size=>'-1'}, " Sporulation/Germination")).br.
	$self->topicCheckbox("sexualCycleCB", "Sexual Cycle", $self->{'_sexualCycle'}, font({-size=>'-1'}, " Sexual Cycle")).br.
	$self->topicCheckbox("cellTypeLocCB", "Cell Type Localization", $self->{'_cellTypeLoc'}, font({-size=>'-1'}, " Cell Type Localization")).br;

}

sub researchSection {
########################################################################
    my ($self) = @_;
    return 
	$self->topicCheckbox("strainsCB", "Strains/Constructs", $self->{'_strains'}, font({-size=>'-1'}," Strains/Constructs")).br.
	$self->topicCheckbox("synonymCB", "Synonym", $self->{'_synonym'}, font({-size=>'-1'}," Synonym")).br.
	$self->topicCheckbox("techCB", "Techniques and Reagents", $self->{'_tech'},
 font({-size=>'-1'}," Techniques and Reagents")).br.
        $self->topicCheckbox("otherCB", "Other Features", $self->{'_other'}, font({-size=>'-1'}," Other Features")).br.
        $self->topicCheckbox("reviewCB", "Reviews", $self->{'_review'}, font({-size=>'-1'}," Reviews")).br.
	$self->topicCheckbox("archiveCB", "Archived Literature", $self->{'_archive'}, font({-size=>'-1'}, " Archived Literature")).br.
	$self->topicCheckbox("selectedCB", "Selected Review", $self->{'_selected'}, font({-size=>'-1'}," Selected Review")).br.
	$self->topicCheckbox("genomeCB", "Genome-wide Analysis", $self->{'_genome'}, font({-size=>'-1'}," Genome-wide Analysis")).br.
	$self->topicCheckbox("antibodiesCB", "Antibodies", $self->{'_antibodies'}, font({-size=>'-1'}," Antibodies"));

}


########################################################################
sub mainInfo {
########################################################################
    my ($self, $name, $refNo, $refObject) = @_;
    my ($self, $name, $refNo, $refObject) = @_;
    my ($filterBy, $type, $No, $typeNm);
    if ($name =~ /^[Y[A-P][LR][0-9]{3}[WC]/i) {
	$filterBy = "FEAT_GENE_INFO";
	$type = "feature";
	$typeNm = "featNo";
	$No = param('featNo');
    }
    else {
	$filterBy = "LOCUS_GENE_INFO";
	$type = "locus";
	$typeNm = "locusNo";
	$No = param('locusNo');
    }
    my (@locuslist, @featlist);
    foreach my $rowRef (@{$refObject->locusArrayRef}) {
	my ($locusNm) = @$rowRef;
	push(@locuslist, $locusNm);
    }
    foreach my $rowRef (@{$refObject->featureArrayRef}) {
	my ($featNm) = @$rowRef;
	push(@featlist, $featNm);
    }
    my ($locuslist, $featlist);
    if (@locuslist > 4) {
        $locuslist = $locuslist[0]."|".$locuslist[1]."|".$locuslist[2]."|". 
		     $locuslist[3].br.
		     a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/geneinfoCuration?user=".$self->user."&refNo=$refNo&$typeNm=$No&shared=1", 
			-target=>"infowin"}, 
		       "FULL LIST").br;
    }
    else {
	$locuslist = join("|", @locuslist); 
    }
    if (@featlist > 4) {
	$featlist = $featlist[0]."|".$featlist[1]."|".$featlist[2]."|". 
	            $featlist[2].br.
                    a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/geneinfoCuration?user=".$self->user."&refNo=$refNo&$typeNm=$No&shared=1", 
			-target=>"infowin"}, 
		       "FULL LIST").br;
    }
    else {
	$featlist = join("|", @featlist);
    }
    my $locusText = "Enter locus names that will share all checked annotations upon submission; separate multiples by |  :";
    my $featText = "Enter feature names that will share all checked annotations upon submission; separate multiples by |  :";
    if ($locuslist) {
	$locusText .= br."This annotation shared by loci : ".font({color=>'red'}, $locuslist);
    }
    if ($featlist) {
	$featText .= br."This annotation shared by features : ".font({color=>'red'}, $featlist);
    }
    return 
    table({-width=>"100%",
	   -border=>'0',
	   -cellspacing=>'0',
	   -cellpadding=>'2'},
	Tr({-bgcolor=>"#869FB6"},
	   th({-colspan=>'2'},
	      u(a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/reference/geneinfo.pl?locus=$name",
		   -target=>"infowin"},
		  "$name Gene Info")." Topics ").
	   font({-size=>'-1'},
		a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/codeCuration?user=".$self->user."&colHeader=TAB_NAME&filterBy=$filterBy", 
		   -target=>"infowin"},
		  "(descriptions)")))).
	Tr({-bgcolor=>"#869FB6"},
	   th(br."Genetics/Cell Biology").
	   th(br."Life Cycle")).
	Tr(td($self->geneticSection($name, $type)).td($self->lifeCycleSection)).
	Tr({-bgcolor=>"#869FB6"},
	   th("Nucleic Information").
	   th("Protein Information")).
	Tr(td($self->nucleicSection).td($self->proteinSection)).
	Tr({-bgcolor=>"#869FB6"},
           th("Related Genes/Proteins").th("Research Aids & Literature")).
	Tr(td($self->relatedSection).td($self->researchSection)).

	Tr(td({-colspan=>'2'},
	      font({-size=>'-1'}, $locusText).
              textfield(-name=>'locuslist',
                        -value=>'',
                        -size=>'30'))).
	Tr(td({-colspan=>'2'},
	      font({-size=>'-1'}, $featText).
	      textfield(-name=>'featlist',
			-value=>'',
			-size=>'30'))).
	Tr(td({-colspan=>'2'},
              submit('commit', 'Submit').
	      reset.
	      hr({-size=>'2'}))).
	Tr(th({-bgcolor=>"#869FB6"},
	      "$name Curation: ").
	   td({-align=>'left'},
	      a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/${type}Curation?user=".$self->user."&type=$type&$type=$name", -target=>"infowin"},
		"\u$type").br.
	      a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/goCuration?user=".$self->user."&type=$type&feat=$name", -target=>"infowin"},
		"Gene Ontology").br.
	      a({-href=>$configUrl->dictyBaseCGIRoot."$dblink/curation/phenotypeCuration?user=".$self->user."&type=$type&feat=$name", -target=>"infowin"},
		  "Phenotype"))));
}

########################################################################
1;
########################################################################



















