title: Fast Python Short DNA String Comparison
body: <p>I have an 8bp string <code>testStr</code></p>
  <p><code>ACTGACTG</code></p>
  <p>I want to compare it against a green list of 8bp strings <code>greenList</code>.</p>
  <p><code>GGCGCATG</code>
  <code>ACTGAAAT</code>
  <code>ATGCCCGT</code>
  <code>ACTGAGTG</code></p>
  <p>If <code>testStr</code> is within hamming distance 1 (has a difference at &lt;= 1 position) of any string in <code>greenList</code> I want a for loop to proceed. Below is an acceptable match because the sequences differ at only one position.</p>
  <p><code>ACTGACTG</code></p>
  <p><code>||||| ||</code></p>
  <p><code>ACTGAGTG</code></p>
  <p>My first attempt to do this centered around creating a green list containing all possible hamming distance 1 variations for the strings in greenList... For example the sequence <code>GGCGCATG</code> yields the following hamming distance 1 variations.</p>
  <p>AGCGCATG
  CGCGCATG
  TGCGCATG
  GACGCATG
  GCCGCATG
  GTCGCATG
  GGAGCATG
  GGTGCATG
  GGGGCATG
  GGCACATG
  GGCCCATG
  GGCTCATG
  GGCGAATG
  GGCGTATG
  GGCGGATG
  GGCGCCTG
  GGCGCTTG
  GGCGCGTG
  GGCGCCAG
  GGCGCCCG
  GGCGCCGG
  GGCGCCTA
  GGCGCCTC
  GGCGCCTT</p>
  <p>If any of the above sequences directly match &quot;testStr&quot; the loop would proceed.</p>
  <p>But there must be a better way to do this...  I also know there are a wealth of alignment algorithms available for DNA alignments.  However, most that i have found seem like overkill for this simple situation.  Any guidance much appreciated.</p>