|go ahead... be a heretic|
Finding Neighbours of a Stringby monkfan (Curate)
|on Mar 01, 2006 at 09:33 UTC||Need Help??|
monkfan has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Fellow Monks,
Suppose I have a string ($str) and also the number of maximum mismatch position is given ($d).
What I intend to do is to find all the string of of length 6 that has maximum Hamming Distance (number of mismatches) is less or equal to $d. These strings are constructed with bases [ATCG].
I already have a brute-force way to do it. That is to pre-generate as many as 4^l, all the strings of length $l, and then find the neighbours from there.
But this way is way too time consuming to do it. Since there are many many strings to test. And also the length of the string is around 12-20 characters. Can anybody advice what's the best way to go about it?
The script that does brute-force way is this: