예제 #1
0
 def test_generate_haplotype_mutation(self):
     haplotype_original = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     haplotype = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.MUTATION, haplotype_original)
     self.assertIsNotNone(haplotype)
     self.assertNotEqual(haplotype, haplotype_original)
     for character in self.invalid_bases:
         self.assertNotIn(character, haplotype)
     for base in haplotype:
         self.assertIn(base, self.bases)
예제 #2
0
 def test_generate_haplotype_inexistent_modification_kind(self):
     haplotype = generator.generate_haplotype(self.haplotype_length, "XPTO")
     self.assertIsNone(haplotype)
     haplotype = generator.generate_haplotype(self.haplotype_length, -1)
     self.assertIsNone(haplotype)
     haplotype = generator.generate_haplotype(self.haplotype_length, None)
     self.assertIsNone(haplotype)
     haplotype = generator.generate_haplotype(self.haplotype_length, True)
     self.assertIsNone(haplotype)
예제 #3
0
 def test_generate_haplotype_recombination(self):
     haplotype_original_one = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     haplotype_original_other = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     while haplotype_original_one == haplotype_original_other:
         haplotype_original_other = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     haplotype = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.RECOMBINATION, haplotype_original_one, haplotype_original_other)
     self.assertIsNotNone(haplotype)
     self.assertNotEqual(haplotype, haplotype_original_one)
     self.assertNotEqual(haplotype, haplotype_original_other)
     for character in self.invalid_bases:
         self.assertNotIn(character, haplotype)
     for base in haplotype:
         self.assertIn(base, self.bases)
예제 #4
0
 def test_generate_haplotype_normal(self):
     haplotype = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     self.assertIsNotNone(haplotype)
     for character in self.invalid_bases:
         self.assertNotIn(character, haplotype)
     for base in haplotype:
         self.assertIn(base, self.bases)
예제 #5
0
 def test_generate_haplotype_mutation_excedent(self):
     haplotype_original = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     haplotype = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.MUTATION, haplotype_original, haplotype_original)
     self.assertIsNone(haplotype)
예제 #6
0
 def test_generate_haplotype_mutation_incomplete(self):
     haplotype_original = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.NONE)
     haplotype = generator.generate_haplotype(self.haplotype_length, generator.ModificationType.MUTATION)
     self.assertIsNone(haplotype)
예제 #7
0
 def test_generate_haplotype_negative_size(self):
     negative_sizes = [random.randint(-(sys.maxint) - 1,0) for x in range(0,1000)]
     for negative_size in negative_sizes:
         haplotype = generator.generate_haplotype(negative_size, generator.ModificationType.NONE)
         self.assertIsNone(haplotype)
예제 #8
0
 def test_generate_haplotype_zero_size(self):
     haplotype = generator.generate_haplotype(0, generator.ModificationType.NONE)
     self.assertIsNone(haplotype)