This is a test version of Biostars. For the public version, visit https://www.biostars.org.
biological sequences random seq

I want to generate m derivatives of the parent sequence by mutating p% of the bases in the parent gene. The final m+1 derivative genes will then be stored in a fasta file.

This is my code:

mySeq="AATTCC"
random_sequence=''
for i in range(0,100):
     random_sequence+=random.choice(mySeq)
print(random_sequence)
print("l: The length of the parent sequence:",len(random_sequence))
print("frequence:", (random_sequence).count(random_sequence)/len(random_sequence))
nmute = 5
for i in range (nmute):
   print(" random_sequence after %p mute:" % nmute, random_sequence)
rna-seq

What is the problem? It is expected to explain where you get stuck and what you tried to solve the issue.

1 answer

Not sure that random mutation is the best choice. There are programs that will mutate sequence probabilistically, which will save you time on coding and likely be more appropriate. See here for an example, but there are many others.

Thanks for your reply. Here the program is written in R. but I need the help by python.

Not sure why that matters. Presumably you need the result and the tool should matter less. Still, I can do the search for you. Googling will probably yield additional results.

Log in to answer this question.