I would do this by making a dictionary mapping sequence to header for each data
set. Then make a set that contains the keys common to both data sets. Finally
use the dictionaries again to look up the headers.
a = '''>a1
TTAATTGGAACA
>a2
AGGACAAGGATA
>a3
TTAAGGAACAAA'''.split()
# Make a dict map
dear group,
I have two files in a text format and look this way:
File a1.txt:
>a1
TTAATTGGAACA
>a2
AGGACAAGGATA
>a3
TTAAGGAACAAA
File b1.txt:
>b1
TTAATTGGAACA
>b2
AGGTCAAGGATA
>b3
AAGGCCAATTAA
I want to check if there are common elements based on
ATGC sequences. a1 and b1 are identical se