I need to generate all possible combinations of tuples of tuples
( (base1 , position1) , (base2 , position2) )
bases = ["U", "C", "A", "G"]and positions = [0,1,2,3,4,5,6,7,8].
Requirements
- no repeatts
- bases may be the same, but positions must be different
- order must be saved.
For instance:
( (A,1), (B,2) ) == ( (B,2) , (A,1) )and
( (A,1), (B,1) )should be discarded.
Output Example:
[ ( (U,0) , (U,1) ), ( (U,0) , (U,2) ), ( (U,0) , (U,3) ) ...]
Must have a length of 448
Example:
For line length 2:
((U,0),(U,1))
((U,0),(C,1))
((U,0),(A,1))
((U,0),(G,1))
((C,0),(U,1))
((C,0),(C,1))
((C,0),(A,1))
((C,0),(G,1))
((A,0),(U,1))
((A,0),(C,1))
((A,0),(A,1))
((A,0),(G,1))
((G,0),(U,1))
((G,0),(C,1))
((G,0),(A,1))
((G,0),(G,1))
there would be all combinations ... I think
I still have it
all_possible = []
nucleotides = ["U","C","A","G"]
for i in range(len(nucleotides)):
for j in range(8):
all_possible.append(((nucleotides[i],j),(nucleotides[i],j)))