code: def digest(args):
      
      p = OptionParser(digest.__doc__)
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      fastafile, enzymes = args
      enzymes = enzymes.split(",")
      enzymes = [x for x in AllEnzymes if str(x) in enzymes]
      f = Fasta(fastafile, lazy=True)
      fw = must_open(opts.outfile, "w")
  
      header = ["Contig", "Length"] + [str(x) for x in enzymes]
      print("\t".join(header), file=fw)
      for name, rec in f.iteritems_ordered():
          row = [name, len(rec)]
          for e in enzymes:
              pos = e.search(rec.seq)
              pos = "na" if not pos else "|".join(str(x) for x in pos)
              row.append(pos)
          print("\t".join(str(x) for x in row), file=fw)
docs: %prog digest fastafile NspI,BfuCI
  
      Digest fasta sequences to map restriction site positions.