biological sequences random seq
1
0
Entering edit mode
3.6 years ago

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 • 686 views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

It is showing error.

ADD REPLY
0
Entering edit mode
3.6 years ago
Mensur Dlakic ★ 27k

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.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 3252 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6