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

##########################################################
#                                                        #
# dictyBase Extension of printFeatureMod                 #
#                                                        #
##########################################################

use printFeatureMod_base;

BEGIN { %printFeatureMod:: = %printFeatureMod_base:: }

#
# added 'Secondary Feature'
#
# changed feature types to the dicty feature types

########################################################################
sub printFeatureTypes {
########################################################################
    my($types) = @_;
    my @types = split(/\|/, $types);
    my ($default1, @default2);

    my $types = [   
                    'Gene Prediction from Sequencing Center',
                    'Curated Model',
                    'Genomic Fragment' , 
                    'mRNA' ,
                    'EST',
                    'Chromosome',
                    'Contig',
                    'Predicted cDNA'
   ];


   foreach my $type (@types) {
 
      if ( grep (/$type/,@{ $types }) ) {
         $default1 = $type;
      }
      else {
         push(@default2, $type);
      }
   }
   
   # this basically ensures that no radio button is checked if there is no feature type that is defined
   # in the array at the top of this method.  Feature Types should become immutabale though, there
   # is no need to change them. 
    $default1 = '--' if !$default1;
    
    print table(Tr(td("Choose one type:")).
		Tr(td(radio_group(-name=>'featuretype1',
				  -values=>$types,
				  -default=>"$default1"))).
		Tr(td("In addition, this feature is a:")).
		Tr(td(checkbox_group(-name=>'featuretype2',
				     -value=>['incomplete support','Pseudogene','Deleted', 'Secondary'],
				     -default=>\@default2))));
}



#
#  took out 'is on physical map display'
#
#  made 7 (instead of 17) chromosomes in the dropdown
#
#  changed 'Mito' to 'M'
#
########################################################################
sub printFeaturePosInfo {
########################################################################
    my ($chrnum, $beg, $end, $strand, $isPmap) = @_;
    my @chrValues;
    my $default = "chr".$chrnum;
    push(@chrValues, "-chr-");
    if ($chrnum == 7) { $default .= "\/M"; }
    for (my $i = 1; $i <= 7; $i++) {
	my $label = "chr$i";
	if ($i == 7) { $label .= "\/M"; }
	push(@chrValues, $label);
    }
    my @strandValues = ('-strand-', 'watson', 'crick');
    if ($strand =~ /^W/i) { $strand = "watson"; }
    elsif ($strand =~ /^C/i) { $strand = "crick"; }
    else { $strand = ""; }
    if ($isPmap !~ /^Y/i) { $isPmap = ""; }
#    ## KD: if there are not values do this
#    if ((!$chrnum) && (!$beg) && (!$end)) {
#	print table(Tr(td({-align=>'left'},
#		      popup_menu(-name=>'chr',
#				 -value=>\@chrValues,
#			         -default=>$default)).
#		   td(font({-size=>'-1'},
#			 "start_coord ").
#		      textfield('beg', "$beg", '7')).
#		   td(font({-size=>'-1'},
#			 "stop_coord ").
#		      textfield('end', "$end", '7')).
#		   td({align=>'left'},
#		      popup_menu(-name=>'strand',
#				 -value=>\@strandValues,
#				 -default=>$strand)).
#		   td(font({-size=>'-1'},
#		         "comments").
#		      textfield('posInfoUpdLog', '', '40'))).
#		Tr(td({-colspan=>'3'},
#		      font({-size=>'-1'},
#			   checkbox(-name=>'isOnPmap',
#				    -checked=>$isPmap,
#				    -label=>'').
#			   " is on the physical map display"))));
#    }
#    ##KD: else just print values but do not make it editable
#    else {
	print table(Tr(td({-align=>'left'}, "$default, ").
		   td(font({-size=>'-1'},
			 "start_coord = ").
		      "$beg, ").
		   td(font({-size=>'-1'},
			 "stop_coord = ").
		      "$end ").
		   td(font({-size=>'-1'},
			 "strand = ").
		      "$strand ").hidden('strand', "$strand")
             ));
#.
#		   td(font({-size=>'-1'},
#		         "comments").
#		      textfield('posInfoUpdLog', '', '40'))
#.
#		Tr(td({-colspan=>'3'},
#		      font({-size=>'-1'},
#			   checkbox(-name=>'isOnPmap',
#				    -checked=>$isPmap,
#				    -label=>'').
#			   " is on the physical map display"))).
#                Tr(td({-colspan=>'5'},
#			   "To make a change to the coordinates or chromosome, 
#                             use the Update Feature Sequence and Coords tool on 
#                             Curator Central.")));
#    }

}


########################################################################
1;  ##### Return it to the calling program
########################################################################






























