Back to index

python-biopython  1.60
TwoPoint.py
Go to the documentation of this file.
00001 """Perform two-point crossovers between the genomes of two organisms.
00002 
00003 This module performs two-point crossover between two genomes.
00004 There are two flavors: OnePointCrossover (Point) and TwoPointCrossover.
00005 
00006 TwoPointCrossover is the minimal crossover technique that
00007 facilitates diverse genome length.  Do not use this if you need to
00008 maintain consistent genome length.
00009 
00010 TwoPointCrossover:
00011 genome 1 --       A B*C D E F
00012 genome 2 --       a b c*d e f
00013 
00014 new genome 1 --   A B d e f
00015 new genome 2 --   a b c C D E F
00016 
00017 """
00018 # standard modules
00019 from GeneralPoint import TwoCrossover
00020 
00021 class TwoPointCrossover(TwoCrossover):
00022     """Perform two point crossover between genomes at some defined rate.
00023 
00024     This performs a crossover between two genomes at some defined frequency.
00025     The location of the points of crossover are chosen randomly if the
00026     crossover meets the probability to occur.  
00027     """
00028     def __init__(self, crossover_prob = .1):
00029         """Initialize to do crossovers at the specified probability.
00030         """
00031         TwoCrossover.__init__(self, 2, crossover_prob)