-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync and re-implement hamming (#170)
- Loading branch information
1 parent
bee86ed
commit 2f4189c
Showing
7 changed files
with
73 additions
and
42 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
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
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
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
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
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
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,38 @@ | ||
|
||
EXTRA_CASES = [ | ||
{ | ||
"description": "short identical strands", | ||
"input": { | ||
"strand1": "GGACTGA", | ||
"strand2": "GGACTGA" | ||
}, | ||
"expected": 0 | ||
}, | ||
{ | ||
"description": "short different strands", | ||
"input": { | ||
"strand1": "ACCAGGG", | ||
"strand2": "ACTATGG" | ||
}, | ||
"expected": 2 | ||
} | ||
] | ||
|
||
def header(): | ||
return "import Data.Vect\n" | ||
|
||
def extra_cases(): | ||
return EXTRA_CASES | ||
|
||
def generate_test(case): | ||
def to_vect(strand): | ||
if strand == "": | ||
return "(the (Vect 0 Nucleotide) [])" | ||
return str(list(strand)).replace("'", "") | ||
|
||
property = "hamming_distance" | ||
expected = case["expected"] | ||
strand1 = to_vect(case["input"]["strand1"]) | ||
strand2 = to_vect(case["input"]["strand2"]) | ||
|
||
return f'assertEq ({property} {strand1} {strand2}) {expected}' |