code: def summary(args):
      
      from jcvi.formats.fasta import summary as fsummary
      from jcvi.utils.cbook import percentage, human_size
  
      p = OptionParser(summary.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 3:
          sys.exit(not p.print_help())
  
      chainfile, oldfasta, newfasta = args
      chain = Chain(chainfile)
      ungapped, dt, dq = chain.ungapped, chain.dt, chain.dq
      print("File `{0}` contains {1} chains.".\
                  format(chainfile, len(chain)), file=sys.stderr)
      print("ungapped={0} dt={1} dq={2}".\
                  format(human_size(ungapped), human_size(dt), human_size(dq)), file=sys.stderr)
  
      oldreal, oldnn, oldlen = fsummary([oldfasta, "--outfile=/dev/null"])
      print("Old fasta (`{0}`) mapped: {1}".\
                  format(oldfasta, percentage(ungapped, oldreal)), file=sys.stderr)
  
      newreal, newnn, newlen = fsummary([newfasta, "--outfile=/dev/null"])
      print("New fasta (`{0}`) mapped: {1}".\
                  format(newfasta, percentage(ungapped, newreal)), file=sys.stderr)
docs: %prog summary old.new.chain old.fasta new.fasta
  
      Provide stats of the chain file.