Hello monks,

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.