-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for find_indels_substitutions
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from CRISPResso2 import CRISPRessoCOREResources | ||
|
||
def test_find_indels_substitutions(): | ||
# no insertion or deletion | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
[18, 19], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['deletion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
|
||
# deletion outside of quantification window | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
[21, 22], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
assert payload['deletion_n'] == 0 | ||
|
||
# deletion overlap quantification window | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
[18, 19], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
assert payload['deletion_n'] == 3 | ||
assert payload['all_deletion_positions'] == [18, 19, 20] | ||
assert payload['deletion_positions'] == [18, 19, 20] | ||
assert payload['deletion_coordinates'] == [(18, 21)] | ||
|
||
# insertion outside of quantification window | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', | ||
[21, 22], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
assert payload['deletion_n'] == 0 | ||
|
||
# insertion overlap quantification window | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
'CATGGAATCCCTTCTGCA---CCTGGATCGCTTTTCCGAG', | ||
[18, 19], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['all_insertion_positions'] == [17, 18] | ||
assert payload['all_insertion_left_positions'] == [17] | ||
assert payload['deletion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
|
||
# deletion at ends | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'---GGAATCCCTTCTGCAGCACCTGGATCGCTTTTC----', | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
[18, 19], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['deletion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
|
||
# insertion at ends | ||
payload = CRISPRessoCOREResources.find_indels_substitutions( | ||
'CATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAG', | ||
'----GAATCCCTTCTGCAGCACCTGGATCGCTTTTC----', | ||
[18, 19], | ||
) | ||
assert payload['insertion_n'] == 0 | ||
assert payload['deletion_n'] == 0 | ||
assert payload['substitution_n'] == 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
# execute only if run as a script | ||
test_find_indels_substitutions() |