Created
January 14, 2024 19:31
-
-
Save canimus/ad579b15cb209fbd29e1510e4243a0ac to your computer and use it in GitHub Desktop.
Format genbank sequence
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
def format_sequence(sequence: str): | |
"""Format a DNA sequence as genbank file""" | |
counter = 1 | |
print(f"{counter}".rjust(4, " "), end=" ") | |
for a,b in zip(range(0,len(sequence)+1, 10), range(10, len(sequence)+1, 10)): | |
print(sequence[a:b], end="") | |
if ((counter % 6) == 0) and (b < (len(sequence)-1)): | |
print("") | |
print(f'{((counter*10) + 1)}'.rjust(4, " "), end=" ") | |
else: | |
print(" ", end="") | |
counter += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment