code: def close(self):
          '''Write mates for remaining chromsome. Search for matches to any
          unmatched reads'''
  
          self.write_mates()
          U.info("Searching for mates for %i unmatched alignments" %
                 len(self.read1s))
  
          found = 0
          for read in self.infile.fetch(until_eof=True, multiple_iterators=True):
  
              if read.is_unmapped:
                  continue
  
              key = read.query_name, read.reference_name, read.reference_start
              if key in self.read1s:
                  self.outfile.write(read)
                  self.read1s.remove(key)
                  found += 1
                  continue
  
          U.info("%i mates never found" % len(self.read1s))
          self.outfile.close(f close(self):
          '''Write mates for remaining chromsome. Search for matches to any
          unmatched reads'''
  
          self.write_mates()
          U.info("Searching for mates for %i unmatched alignments" %
                 len(self.read1s))
  
          found = 0
          for read in self.infile.fetch(until_eof=True, multiple_iterators=True):
  
              if read.is_unmapped:
                  continue
  
              key = read.query_name, read.reference_name, read.reference_start
              if key in self.read1s:
                  self.outfile.write(read)
                  self.read1s.remove(key)
                  found += 1
                  continue
  
          U.info("%i mates never found" % len(self.read1s))
          self.outfile.close()
docs: Write mates for remaining chromsome. Search for matches to any
          unmatched reads