sample = ['AAAA','CGCG','TTTT','AT$T','ACAC','ATGC','AATA']
Position = [0, 1, 2, 3, 4, 5, 6]
我有与每个元素相关联的位置上面的示例。我做了几个过滤步骤,代码是here.
消除的步骤是:
#If each base is identical to itself eliminate those elements eg. AAAA, TTTT
#If there are more than 2 types of bases (i.e.' conversions'== 1 ) then eliminate those elements eg. ATGC
#Make pairs of all remaining combinations
#If a $ in the pair, then the corresponding base from the other pair is eliminated eg. (CGCG,AT$T) ==> (CGG, ATT) and (ATT, AAA)
#Remove all pairs where one of the elements has all identical bases eg. (ATT,AAA)
最后,我有一个输出,上面有不同的组合,如下所示
Final Output [['CGG','ATT'],['CGCG','ACAC'],['CGCG','AATA'],['ATT','ACC']]
我需要找到一种方法,这样我就可以得到这些对相对于原始样本的位置,如下所示
Position = [[1,3],[1,4],[1,6],[3,4]]
可以先将列表转换为元组列表
然后将其作为输入列表
相关问题 更多 >
编程相关推荐