text: user1695: 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: 
  
  Reference seq: aaabbb
  Resistant strains: list1 = [aacbbc, ababbb]
  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).
  
  user581: Samtools/VCF is overkill for comparing amino acid sequences from a single protein. I would suggest making pairwise alignments between each sequence in list2 and the reference and making a list of mutations (2c and 6c in your example). Then repeat the procedure for list1, discarding sequences if they contain mutations in your stored list. This can all be done using biopython. Here's how to make the alignments to get you started:
  from Bio import pairwise2
  from Bio import SeqIO
  seq1 = SeqIO.read("alpha.faa", "fasta")
  seq2 = SeqIO.read("beta.faa", "fasta")
  alignments = pairwise2.align.globalxx(seq1.seq, seq2.seq)
  
  
original_text: 1695: <p>I have 2 lists, <code>list1</code> and <code>list2</code>, of protein sequences of the same given gene in different strains. In <code>list1</code> are reported amino-acid sequences from resistant strains, and in <code>list2</code> are reported amino-acid sequences from susceptible strains. Each item of each list is an amino-acid sequence. </p>
  
  <p>I want to filter out (in Python 3) from <code>list1</code> all of the variants that are also present in <code>list2</code>. 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).</p>
  
  <p>All the sequences are of at least 90% identity to some reference sequence  (filtered out the low matches using seq alignment).</p>
  
  <p>Any enlightenment / package / tool for this job will be appreciated!</p>
  
  <p>Toy example:</p>
  
  <p><code>a</code>, <code>b</code>, <code>c</code> : amino-acids</p>
  
  <p>For this input: </p>
  
  <ol>
  <li>Reference seq: <code>aaabbb</code></li>
  <li>Resistant strains: <code>list1</code> = [aa<strong>c</strong>bb<strong>c</strong>, a<strong>b</strong>abbb]</li>
  <li>Susceptible strains: <code>list2</code> = [aa<strong>c</strong>bbb, aaabb<strong>c</strong>]</li>
  </ol>
  
  <p>The expected output would be: [a<strong>b</strong>abbb], since the mutations in <code>list2</code> cancels out the item aa<strong>c</strong>bb<strong>c</strong>.</p>
  
  <p>Of course this is a simple example and it is possible to have more complex scenarios (e.g., longer indels and mismatches).</p>
   581: <p>Samtools/VCF is overkill for comparing amino acid sequences from a single protein. I would suggest making pairwise alignments between each sequence in list2 and the reference and making a list of mutations (2c and 6c in your example). Then repeat the procedure for list1, discarding sequences if they contain mutations in your stored list. This can all be done using biopython. <a href="http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc86" rel="nofollow noreferrer">Here's</a> how to make the alignments to get you started:</p>
  
  <pre><code>from Bio import pairwise2
  from Bio import SeqIO
  seq1 = SeqIO.read("alpha.faa", "fasta")
  seq2 = SeqIO.read("beta.faa", "fasta")
  alignments = pairwise2.align.globalxx(seq1.seq, seq2.seq)
  </code></pre>
  