Exemple #1
0
 def test_find_crispr_target_does_not_find_target_with_part_of_pam(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgc'
     g = self.build_genome(False, s1 + pam + s2)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 0)
Exemple #2
0
 def test_find_crispr_target_does_not_find_target_with_part_of_pam(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgc'
     g = self.build_genome(False, s1 + pam + s2)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 0)
Exemple #3
0
 def test_find_crispr_target_only_finds_perfect_match_to_guide(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False, s1 + pam + s2)
     guide = 'aaaaa' + s1[-15:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 0)
Exemple #4
0
 def test_find_crispr_target_only_finds_perfect_match_to_guide(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False, s1 + pam + s2)
     guide = 'aaaaa' + s1[-15:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 0)
Exemple #5
0
 def test_find_crispr_target_finds_target_on_reverse_strand(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False, str(Seq(s1 + pam + s2).reverse_complement()))
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_end, len(s2) + 3 + 1)
     self.assertEquals(t[0].subject_start, len(s2) + 3 + 1 + 20 - 1)
     self.assertEquals(t[0].pam, 'ngg')
Exemple #6
0
 def test_find_crispr_target_finds_target_on_forward_strand(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False, s1 + pam + s2)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_start, s1.index(guide) + 1)
     self.assertEquals(t[0].subject_end, len(s1))
     self.assertEquals(t[0].pam, 'ngg')
Exemple #7
0
 def test_find_crispr_target_finds_target_on_forward_strand(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False, s1 + pam + s2)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_start, s1.index(guide) + 1)
     self.assertEquals(t[0].subject_end, len(s1))
     self.assertEquals(t[0].pam, 'ngg')
Exemple #8
0
 def test_find_crispr_target_finds_target_across_circular_boundary(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     s = s1[10:] + pam + s2 + s1[0:10]
     g = self.build_genome(True, s)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_start, (s1.index(guide) + 1 - 10 - 1) % len(s) + 1)
     self.assertEquals(t[0].subject_end, (len(s1) - 10 - 1) % len(s) + 1)
     self.assertEquals(t[0].pam, 'ngg')
Exemple #9
0
 def test_find_crispr_target_finds_reverse_complement_with_pam_across_circular_boundary(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     s = pam[1:] + s2 + s1 + pam[:1]
     g = self.build_genome(True, str(Seq(s).reverse_complement()))
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_end, 2)
     self.assertEquals(t[0].subject_start, 2 + len(guide) - 1)
     self.assertEquals(t[0].pam, 'ngg')
Exemple #10
0
 def test_find_crispr_target_finds_target_on_reverse_strand(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     g = self.build_genome(False,
                           str(Seq(s1 + pam + s2).reverse_complement()))
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_end, len(s2) + 3 + 1)
     self.assertEquals(t[0].subject_start, len(s2) + 3 + 1 + 20 - 1)
     self.assertEquals(t[0].pam, 'ngg')
Exemple #11
0
 def test_find_crispr_target_finds_reverse_complement_with_pam_across_circular_boundary(
         self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     s = pam[1:] + s2 + s1 + pam[:1]
     g = self.build_genome(True, str(Seq(s).reverse_complement()))
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_end, 2)
     self.assertEquals(t[0].subject_start, 2 + len(guide) - 1)
     self.assertEquals(t[0].pam, 'ngg')
Exemple #12
0
 def test_find_crispr_target_finds_target_across_circular_boundary(self):
     s1 = 'agaaggtctggtagcgatgtagtcgatct'
     s2 = 'gactaggtacgtagtcgtcaggtcagtca'
     pam = 'cgg'
     s = s1[10:] + pam + s2 + s1[0:10]
     g = self.build_genome(True, s)
     guide = s1[-20:]
     t = find_crispr_target(g, guide, 'ngg')
     self.assertEquals(len(t), 1)
     self.assertEquals(t[0].fragment_id, g.fragments.all()[0].id)
     self.assertEquals(t[0].fragment_name, g.fragments.all()[0].name)
     self.assertEquals(t[0].subject_start,
                       (s1.index(guide) + 1 - 10 - 1) % len(s) + 1)
     self.assertEquals(t[0].subject_end, (len(s1) - 10 - 1) % len(s) + 1)
     self.assertEquals(t[0].pam, 'ngg')