for analysis I have small sets of nucleotides. They can occur multiple times. The goal is to find all configurations of 4-tuple (set) where all are either the same or sequential alphabetic neighbours for any given set. Bioperl doesn't seem to have anything suitable.
I next started out matching with regex but soon had to abandon that path because regex keep in a string what they have matched (or, same idea, different point-of-view, do not remember that a certain has already been matched earlier) and they also do not deal well with overlaps. For example, on the sorted set AAAAADDDDDEFFGMMSSTVVVVV the only solution is AAAA;ADEF;DDDD;FGMS;MSTV;VVVV, you can see the overlaps at D and MS. Also, I have to be a bit smart about deciding what to match first. Sometimes it is not advisable to form a sameness-tuple because then I destroy a solution involving multiple sequences, for example AADDDEEEEFFFFGGMMMMMMMMMMSTV: I should not pick EEEE or FFFF or else I cannot find ADEF;ADEF;DEFG;EFGM;MMMM;MMMM;MSTV.
Then I tried to bruteforce by enumerating all permutes and checking each 4-substring, but let me tell you, it takes forever even with small sets! Also, there are a lot of conceptual duplicates.
Any advice how to go on? Yes, this is homework. Yes, I will program it myself. Just help me break down the concept into smaller steps.
In reply to finding tuples by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |