[Bio] / FigKernelPackages / FullLocation.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FullLocation.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Wed Jul 27 19:43:33 2005 UTC revision 1.3, Sat Jul 30 23:53:16 2005 UTC
# Line 539  Line 539 
539      return $retVal;      return $retVal;
540  }  }
541    
542    =head3 ExtremeCodon
543    
544    C<< my $loc->ExtremeCodon($dir); >>
545    
546    Return the most extreme codon in the specified direction. This is not always the most
547    extreme location, since the distance to the appropriate edge of the location must be
548    a multiple of 3.
549    
550    =over 4
551    
552    =item dir
553    
554    C<first> to get the codon moving away from the beginning of the location, C<last>
555    to get the codon moving away from the end of the location.
556    
557    =item RETURN
558    
559    Returns the edge location of the desired codon.
560    
561    =back
562    
563    =cut
564    
565    sub ExtremeCodon {
566        # Get the parameters.
567        my ($self, $dir) = @_;
568        my $fig = $self->{fig};
569        # The first task is to determine the starting point and direction for the
570        # search. We start by converting the direction to the same format as the
571        # location direction.
572        my $parity = ($dir eq 'first' ? '-' : '+');
573        # If we're moving in the opposite direction as the location, we're going to
574        # go toward the beginning of the contig; otherwise, we're going toward the
575        # end.
576        my ($multiplier, $endPoint);
577        if ($parity ne $self->Dir) {
578            ($multiplier, $endPoint) = (-3, 1);
579        } else {
580            ($multiplier, $endPoint) = (3, $fig->contig_ln($self->{genomeID}, $self->Contig));
581        }
582        # Now we need the start point, which is determined by direction of this method.
583        my $beginPoint = ($parity eq '-' ? $self->PrevPoint : $self->NextPoint);
584        # Compute the number of positions to move and add it to the begin point.
585        my $retVal = int(($endPoint - $beginPoint) / $multiplier) * $multiplier +
586                     $beginPoint;
587        # Return the codon found.
588        return $retVal;
589    }
590    
591  =head3 Extend  =head3 Extend
592    
593  C<< my  = $loc->Extend($newBegin, $newEnd); >>  C<< my  = $loc->Extend($newBegin, $newEnd); >>

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3