At the code I’m writing I need to intersect two horizontal list like:
listA:
('name1','chr1', 'aatt')
('name2','chr11', 'aaga')
('name2','chr11', 'aaaa')
('name3','chr7', 'gtag')
listB
('chr8', 'tagt')
('chr1', 'tttt')
('chr7', 'gtag')
('chr11','aaaa')
('chr9', 'atat')
#This lists are compounded by one str per line, wich it has a "/t" in the middle.
#Also note that are in different order
How can I get the lines from the listA whose columns 2 and 3 intersect with the listB?
desired result:
name2 chr11 aaaa
name3 chr7 gtag
The solution is not just “set(listA)&set(listB)” because the list have different number of columns
thanks for your time!
1 Answer