code: def dump(args):
      
      p = OptionParser(dump.__doc__)
      p.add_option("-K", default=23, type="int",
                   help="K-mer size [default: %default]")
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      fastafile, = args
      K = opts.K
      fw = must_open(opts.outfile, "w")
      f = Fasta(fastafile, lazy=True)
      for name, rec in f.iteritems_ordered():
          kmers = list(make_kmers(rec.seq, K))
          print("\n".join(kmers), file=fw)
      fw.close()
docs: %prog dump fastafile
  
      Convert FASTA sequences to list of K-mers.