May-09-2019, 08:03 AM
Hello!
I have to do a very simple task, but I have problems with speed. I have a list called 'chromosome', and I want to replace each N into A,G,C or T at random. I made this code, which is very slow (chromosome in this code is a list):
Thank you!
I have to do a very simple task, but I have problems with speed. I have a list called 'chromosome', and I want to replace each N into A,G,C or T at random. I made this code, which is very slow (chromosome in this code is a list):
for i in range(0,len(chromosome)): if (chromosome[i] is not ('A' or 'C' or 'G' or 'T')): r=rd.randint(1,4) if r==1: chromosome[i]='A' elif r==2: chromosome[i]='G' elif r==3: chromosome[i]='C' else: chromosome[i]='T'Can I do something to make it run faster?
Thank you!