Python Iterate Through Characters
I have been trying to pull of median string search for a sequence in the ACGT genome. The problem I have is going to say AAAAAAAA to AAAAAAAC and so forth until I have tried every
Solution 1:
Using itertools
itertools.product("ACGT", repeat=8)
Solution 2:
As above suggested use itertools,
itertools.product("ACGT", repeat=8) # will work in your case.
Solution 3:
Using the regex inverter from the pyparsing wiki Examples page, invert this regex: [ACGT]{8}
. You can also try the online inverter at the UtilityMill, but this server will timeout when generating 8-character strings, but I have successfully gotten up to 6 characters within the allowed time.
Post a Comment for "Python Iterate Through Characters"