Generate a DNA string of "ATGCN" of length at most 2048 bases (characters) using
your own random function and store it into a text file.
def generateDNASequence():
file = open('DNAFILE.txt', 'w')
# list of available DNA bases
l = ['C', 'A', 'G', 'T']
res = ""
for i in range(0, 2048):
# creating the DNA strand by appending
# random characters from the list
res = res + random.choice(l)
file.write(res)
Comments
Leave a comment