I am trying to randomly generate a string of n length from 5 characters ('ATGC '
). I am currently using itertools.product
, but it is incredibly slow. I switched to itertools.combinations_with_replacement
, but it skips some values. Is there a faster way of doing this? For my application order does matter.
for error in itertools.product('ATGC ', repeat=len(errorPos)):
print(error)
for ps in error:
for pos in errorPos:
if ps == " ":
fseqL[pos] = ""
else:
fseqL[pos] = ps