def calculate_anim(infiles, org_lengths):
    logger.info("Running ANIm")
    logger.info("Generating NUCmer command-lines")
    deltadir = os.path.join(args.outdirname, ALIGNDIR["ANIm"])
    logger.info("Writing nucmer output to %s", deltadir)
    if not args.skip_nucmer:
        joblist = anim.generate_nucmer_jobs(
            infiles,
            args.outdirname,
            nucmer_exe=args.nucmer_exe,
            filter_exe=args.filter_exe,
            maxmatch=args.maxmatch,
            jobprefix=args.jobprefix,
        )
        if args.scheduler == "multiprocessing":
            logger.info("Running jobs with multiprocessing")
            if args.workers is None:
                logger.info("(using maximum number of available " + "worker threads)")
            else:
                logger.info("(using %d worker threads, if available)", args.workers)
            cumval = run_mp.run_dependency_graph(
                joblist, workers=args.workers, logger=logger
            )
            logger.info("Cumulative return value: %d", cumval)
            if 0 < cumval:
                logger.warning(
                    "At least one NUCmer comparison failed. " + "ANIm may fail."
                )
            else:
                logger.info("All multiprocessing jobs complete.")
        else:
            logger.info("Running jobs with SGE")
            logger.info("Jobarray group size set to %d", args.sgegroupsize)
            run_sge.run_dependency_graph(
                joblist,
                logger=logger,
                jgprefix=args.jobprefix,
                sgegroupsize=args.sgegroupsize,
                sgeargs=args.sgeargs,
            )
    else:
        logger.warning("Skipping NUCmer run (as instructed)!")
    logger.info("Processing NUCmer .delta files.")
    results = anim.process_deltadir(deltadir, org_lengths, logger=logger)
    if results.zero_error:
        if not args.skip_nucmer and args.scheduler == "multiprocessing":
            if 0 < cumval:
                logger.error(
                    "This has possibly been a NUCmer run failure, "
                    + "please investigate"
                )
                logger.error(last_exception())
                sys.exit(1)
            else:
                logger.error(
                    "This is possibly due to a NUCmer comparison "
                    + "being too distant for use. Please consider "
                    + "using the --maxmatch option."
                )
                logger.error(
                    "This is alternatively due to NUCmer run "
                    + "failure, analysis will continue, but please "
                    + "investigate."
                )
    if not args.nocompress:
        logger.info("Compressing/deleting %s", deltadir)
        compress_delete_outdir(deltadir)
    return results