-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dna_string_manipulation.py
More file actions
37 lines (33 loc) · 1.46 KB
/
test_dna_string_manipulation.py
File metadata and controls
37 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from dna_string_manipulation import *
""""
This file tests the functions defined in dna_string_manipulation.py
Each section tests a function with print based outputs
"""
print("Test Case 1- Case Conversion")
raw_sequence = "ATTCG!xxyasgmA"
uppercase_sequence= to_uppercase(raw_sequence)
lowercase_sequence= to_lowercase(raw_sequence)
print(f"Original sequence: {raw_sequence}")
print(f"Uppercase sequence: {uppercase_sequence}")
print(f"Lowercase sequence: {lowercase_sequence}")
print()
print("Test Case 2- Removing non-nucleotide characters")
cleaned_sequence = remove_non_nucleotides(raw_sequence)
print(f"Sequence before cleaning: {raw_sequence}")
print(f"Sequence after cleaning: {cleaned_sequence}")
print()
print("Test Case 3- Splitting the given sequence into codons")
codon_sequence= "AATTCGGACTTGC"
print(f"Original sequence: {codon_sequence}")
print(f"Frame 1 codons: {split_into_codons(codon_sequence,1)}")
print(f"Frame 2 codons: {split_into_codons(codon_sequence,2)}")
print(f"Frame 3 codons: {split_into_codons(codon_sequence,3)}")
print()
print("Test Case 4- Merging DNA fragments")
fragments= ["AATC", "GCCT", "AATTCC", "GGCCAA"]
merged_with_no_separator = merge_dna_fragments(fragments)
merged_with_separator= merge_dna_fragments(fragments, separator="---")
print(f"Original sequence: {fragments}")
print(f"Merged sequence (no separator) : {merged_with_no_separator}")
print(f"Merged sequence (separator) : {merged_with_separator}")
print()