I have the the following pairs stored in the following list
sample = [[CGCG,ATAT],[CGCG,CATC],[ATAT,TATA]]
Each pairwise comparison can have only two unique combinations of characters, if not then those pairwise comparisons are eliminated. eg,
Look a the corresponding elements in both sub-lists, CC, GA, CT, GC.
Here, there are more than two types of pairs (CC), (GA), (CT) and (GC). So this pairwise comparison cannot occur.
Every comparison can have only 2 combinations out of (AA, GG,CC,TT, AT,TA,AC,CA,AG,GA,GC,CG,GT,TG,CT,TC) ... basically all possible combinations of ACGT where order matters.
In the above example, more than 2 such combinations are found.
There are only 2 unique combinations: CA and GT
Thus, the only pairs, that remain are:
output = [[CGCG,ATAT],[ATAT,TATA]]
I would prefer if the code was in traditional for-loop format and not comprehensions
This is a small part of the question listed here
. This portion of the question is re-asked, as the answer provided earlier provided incorrect output.