Example #1
0
def generate_sequence(haplotype_length, total_number, mutation_rate, recombination_rate):
    global original_haplotype
    global mutated_haplotypes
    global recombinated_haplotypes
    logger = logging.getLogger('control.generate_sequence')
    logger.setLevel(logging.INFO)
    logger.debug("generator.generate_haplotype(%d, %d, %f, %f)" % (haplotype_length, total_number, float(mutation_rate)/100, float(recombination_rate)/100))
    original_haplotype, mutated_haplotypes, recombinated_haplotypes = generator.generate_haplotypes(haplotype_length, total_number, float(mutation_rate)/100, float(recombination_rate)/100)
Example #2
0
 def test_generate_haplotypes(self):
     haplotype_length = random.randint(1,500)
     total_length = random.randint(1,1000)
     mutation_rate = random.random()
     recombination_rate = 1.0 - mutation_rate
     original, mutated_list, recombinant_list = generator.generate_haplotypes(haplotype_length, total_length, mutation_rate, recombination_rate)
     self.assertIsNotNone(original)
     self.assertIsNotNone(mutated_list)
     self.assertIsNotNone(recombinant_list)