# Filtering out all seqs with mutations of list2 from list1

I have 2 lists, list1 and list2, of protein sequences of the same given gene in different strains. In list1 are reported amino-acid sequences from resistant strains, and in list2 are reported amino-acid sequences from susceptible strains. Each item of each list is an amino-acid sequence.

I want to filter out (in Python 3) from list1 all of the variants that are also present in list2. The final aim is to have a list of the sequences that have unique mutations that are not in the 2nd list. The mutations can be of any type (e.g., indels, mismatches).

All the sequences are of at least 90% identity to some reference sequence (filtered out the low matches using seq alignment).

Any enlightenment / package / tool for this job will be appreciated!

Toy example:

a, b, c : amino-acids

For this input:

1. Reference seq: aaabbb
2. Resistant strains: list1 = [aacbbc, ababbb]
3. Susceptible strains: list2 = [aacbbb, aaabbc]

The expected output would be: [ababbb], since the mutations in list2 cancels out the item aacbbc.

Of course this is a simple example and it is possible to have more complex scenarios (e.g., longer indels and mismatches).

• Is there only one mutation per sequence entry in the lists? Could you align the two lists to each other and look for perfect matches? – Bioathlete Nov 10 '17 at 15:23
• For the first step, I indeed filtered out the exact matches. But I also need to filter out other cases. For example if I have a sequence in list1 with 2 mutations and I have 2 sequences in list2 that each one of them has one of those mutations, then I want to filter this sequence from list 1 as well. – Kobi T Nov 10 '17 at 15:26
• In which format is each list? It seems in a Fasta format but I am unsure because usually the mutations are not stored in these format. – llrs Nov 10 '17 at 15:41
• The lists contain strings (extracted from transcriptome fasta files) of the amino acids that got score of at least 90% of the max score against some reference sequence. – Kobi T Nov 10 '17 at 15:43
• You will have to look at the alignment tool you are uses and see if it supports it directly or if it will write out a BAM file then you can use samtools to generate the VCF. – Bioathlete Nov 10 '17 at 19:00

from Bio import pairwise2