first some biological background, so you understand my question. In biology, DNA-sequences can contain motifs, which are recognized by enzymes or proteins. Those motifs are strings, like "GACTGC". Analyses can reveal, whether a position in the motif is "conserved" or not.
Enzymes might recognize "GACTGC" best, but may also recognize "CACTGC" or even "TTCTGC". So, some positions may vary.
I have the following situation: I want to create a list of permutations, with motifs, that could be recognized. In order to do so, I have the info:
Best recognition: GACTGC
Bases, also possible:
GACTGC
A C G
T A
which means, at first position, there could alsoe be A or T, at 4th there could be a C etc., but at 2nd position, the A is conserved, nothing else is possible.
I can generate a list with one base varying for each position, by turning the "best-fit" motif into a list of letters and replacing one letter, joining and appending to my list (doing that for each position). So it basically is hard coded. It worked out, since I changed any position, no matter what motif was entered. But now I want to change specific positions to specific letters and store specific permutations only, depending on the motif.
So, I am looking for the shortest/fastest/maybe smartest way, to pass the information of the positions and their valid letters, and how to create the permutations for one and two variable positions.
please note: I will try to post my code in an answer or via an edit, somehow copy-paste and then ctrl+k on the marked code does not work