code: def gaps(args):
      
      from jcvi.formats.sizes import agp
      from jcvi.formats.agp import mask, build
  
      p = OptionParser(gaps.__doc__)
      p.add_option("--split", default=False, action="store_true",
              help="Generate .split.fasta [default: %default]")
      p.set_mingap(default=100)
      p.set_cpus()
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      inputfasta, = args
      mingap = opts.mingap
      split = opts.split
      prefix = inputfasta.rsplit(".", 1)[0]
      bedfile = prefix + ".gaps.bed"
  
      if need_update(inputfasta, bedfile):
          write_gaps_bed(inputfasta, prefix, mingap, opts.cpus)
  
      if split:
          splitfile = prefix + ".split.fasta"
          oagpfile = prefix + ".splitobject.agp"
          cagpfile = prefix + ".splitcomponent.agp"
  
          if need_update((inputfasta, bedfile), splitfile):
  
              sizesagpfile = agp([inputfasta])
  
              maskedagpfile = mask([sizesagpfile, bedfile, "--splitobject"])
              shutil.move(maskedagpfile, oagpfile)
              logging.debug("AGP file written to `{0}`.".format(oagpfile))
  
              maskedagpfile = mask([sizesagpfile, bedfile, "--splitcomponent"])
              shutil.move(maskedagpfile, cagpfile)
              logging.debug("AGP file written to `{0}`.".format(cagpfile))
  
              build([oagpfile, inputfasta, splitfile])
              os.remove(sizesagpfile)
  
          return splitfile, oagpfile, cagpfile
docs: %prog gaps fastafile
  
      Print out a list of gaps in BED format (.gaps.bed).