code: def fragment_fasta_files(infiles, outdirname, fragsize):
      
      outfnames = []
      for fname in infiles:
          outstem, outext = os.path.splitext(os.path.split(fname)[-1])
          outfname = os.path.join(outdirname, outstem) + "-fragments" + outext
          outseqs = []
          count = 0
          for seq in SeqIO.parse(fname, "fasta"):
              idx = 0
              while idx < len(seq):
                  count += 1
                  newseq = seq[idx : idx + fragsize]
                  newseq.id = "frag%05d" % count
                  outseqs.append(newseq)
                  idx += fragsize
          outfnames.append(outfname)
          SeqIO.write(outseqs, outfname, "fasta")
      return outfnames, get_fraglength_dict(outfnames)
docs: Chops sequences of the passed files into fragments, returns filenames.
  
      - infiles - paths to each input sequence file
      - outdirname - path to output directory
      - fragsize - the size of sequence fragments
  
      Takes every sequence from every file in infiles, and splits them into
      consecutive fragments of length fragsize, (with any trailing sequences
      being included, even if shorter than fragsize), and writes the resulting
      set of sequences to a file with the same name in the output directory.
      All fragments are named consecutively and uniquely (within a file) as
      fragNNNNN. Sequence description fields are retained.