code: def frg(args):
      
      p = OptionParser(frg.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(p.print_help())
  
      frgfile, = args
      fastafile = frgfile.rsplit(".", 1)[0] + ".fasta"
      fp = open(frgfile)
      fw = open(fastafile, "w")
  
      for rec in iter_records(fp):
          if rec.type != "FRG":
              continue
          id = rec.get_field("acc")
          seq = rec.get_field("seq")
          s = SeqRecord(Seq(seq), id=id, description="")
          SeqIO.write([s], fw, "fasta")
  
      fw.close()
docs: %prog frg frgfile
  
      Extract FASTA sequences from frg reads.