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

Diff of /FigKernelPackages/BasicLocation.pm

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

revision 1.9, Wed Apr 19 03:38:32 2006 UTC revision 1.10, Wed Jun 21 03:09:41 2006 UTC
# Line 695  Line 695 
695      return $retVal;      return $retVal;
696  }  }
697    
698    =head3 Merge
699    
700    C<< $loc->Merge($loc2); >>
701    
702    Merge another location into this one. The result will include all bases in both
703    locations and will have the same direction as this location. It is assumed both
704    locations share the same contig.
705    
706    =over 4
707    
708    =item loc2
709    
710    Location to merge into this one.
711    
712    =back
713    
714    =cut
715    
716    sub Merge {
717        # Get the parameters.
718        my ($self, $loc2) = @_;
719        # Get a copy of the other location.
720        my $other = BasicLocation->new($loc2);
721        # Fix the direction so it matches.
722        if ($self->Dir != $other->Dir) {
723            $other->Reverse;
724        }
725        # Combine the other location with this one.
726        $self->Combine($other);
727    }
728    
729  =head2 Virtual Methods  =head2 Virtual Methods
730    
731  These methods are implemented by the subclasses. They are included here for documentation  These methods are implemented by the subclasses. They are included here for documentation
# Line 834  Line 865 
865  =cut  =cut
866  #: Return Type $%;  #: Return Type $%;
867    
   
868  =head3 SetBegin  =head3 SetBegin
869    
870  C<< $loc->SetBegin($newBegin); >>  C<< $loc->SetBegin($newBegin); >>
# Line 938  Line 968 
968  =cut  =cut
969  #: Return Type $%;  #: Return Type $%;
970    
971  1;  =head3 Combine
972    
973    C<< $loc->Combine($other); >>
974    
975    Combine another location with this one. The result will contain all bases in both
976    original locations. Both locations must have the same contig ID and direction.
977    
978    =over 4
979    
980    =item other
981    
982    Other location to combine with this one.
983    
984    =back
985    
986    =cut
987    
988    1;
989    
990  package FBasicLocation;  package FBasicLocation;
991    
# Line 1325  Line 1371 
1371      }      }
1372  }  }
1373    
1374    =head3 Combine
1375    
1376    C<< $loc->Combine($other); >>
1377    
1378    Combine another location with this one. The result will contain all bases in both
1379    original locations. Both locations must have the same contig ID and direction.
1380    
1381    =over 4
1382    
1383    =item other
1384    
1385    Other location to combine with this one.
1386    
1387    =back
1388    
1389    =cut
1390    
1391    sub Combine {
1392        # Get the parameters.
1393        my ($self, $other) = @_;
1394        # If the other location ends past our end, move the endpoint.
1395        if ($other->EndPoint > $self->EndPoint) {
1396            $self->SetEnd($other->EndPoint);
1397        }
1398        # If the other location starts before our begin, move the begin point.
1399        if ($other->Begin < $self->Begin) {
1400            $self->SetBegin($other->Begin);
1401        }
1402    }
1403    
1404  1;  1;
1405    
1406  package BBasicLocation;  package BBasicLocation;
# Line 1708  Line 1784 
1784      }      }
1785  }  }
1786    
1787    =head3 Combine
1788    
1789    C<< $loc->Combine($other); >>
1790    
1791    Combine another location with this one. The result will contain all bases in both
1792    original locations. Both locations must have the same contig ID and direction.
1793    
1794    =over 4
1795    
1796    =item other
1797    
1798    Other location to combine with this one.
1799    
1800    =back
1801    
1802    =cut
1803    
1804    sub Combine {
1805        # Get the parameters.
1806        my ($self, $other) = @_;
1807        # If the other location ends past our end, move the endpoint.
1808        if ($other->EndPoint < $self->EndPoint) {
1809            $self->SetEnd($other->EndPoint);
1810        }
1811        # If the other location starts before our begin, move the begin point.
1812        if ($other->Begin > $self->Begin) {
1813            $self->SetBegin($other->Begin);
1814        }
1815    }
1816    
1817  1;  1;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3