title: Delete an item from a dictionary generated by SeqIO.index
body: <p>I am using Python 2.6.6 and I am trying to remove <code>fastq</code> reads in <code>file2</code> that overlap (i.e., are identical to) reads in <code>file1</code>. Here is code I am trying to implement:</p>
  
  <pre><code>ref_reads = SeqIO.index("file1.fastq", "fastq")
  spk_reads = SeqIO.index("file2.fastq", "fastq")
  
  for spk in spk_reads:
      if spk in ref_reads:
      del ref_reads[spk]
  </code></pre>
  
  <p>However, I get this error related to my use of <code>del</code>:</p>
  
  <p><strong>AttributeError: _IndexedSeqFileDict instance has no attribute '__delitem__'</strong></p>
  
  <p>Is it possible to delete an item using the present formulation? How can I delete an item from a dictionary generated using <code>SeqIO.index()</code>?</p>
  
  <p>I also tried the following:</p>
  
  <pre><code># import read data
  ref_reads = SeqIO.index("main.fastq", "fastq")
  spk_reads = SeqIO.index("over.fastq", "fastq")
  
  # note that ref_reads.keys() doesn't return a list but a 'dictionary-       keyiterator', 
  # so we turn it into a set to work with it
  ref_keys = set(ref_reads.keys())  
  spk_keys = set(spk_reads.keys())
  
  # loop to remove overlap reads
  for spk in spk_keys:
      if spk in ref_keys:
          del ref_keys[spk]
  
  # output data
  output_handle = open(fname_out, "w")
  SeqIO.write(ref_reads[ref_keys], output_handle, "fastq")
  output_handle.close()
  </code></pre>