def write(results):
    """Write ANIb/ANIm/TETRA results to output directory.

    - results - results object from analysis

    Each dataframe is written to an Excel-format file (if args.write_excel is
    True), and plain text tab-separated file in the output directory. The
    order of result output must be reflected in the order of filestems.
    """
    logger.info("Writing %s results to %s", args.method, args.outdirname)
    if args.method == "TETRA":
        out_excel = os.path.join(args.outdirname, TETRA_FILESTEMS[0]) + ".xlsx"
        out_csv = os.path.join(args.outdirname, TETRA_FILESTEMS[0]) + ".tab"
        if args.write_excel:
            results.to_excel(out_excel, index=True)
        results.to_csv(out_csv, index=True, sep="\t")

    else:
        for dfr, filestem in results.data:
            out_excel = os.path.join(args.outdirname, filestem) + ".xlsx"
            out_csv = os.path.join(args.outdirname, filestem) + ".tab"
            logger.info("\t%s", filestem)
            if args.write_excel:
                dfr.to_excel(out_excel, index=True)
            dfr.to_csv(out_csv, index=True, sep="\t")
Write ANIb/ANIm/TETRA results to output directory.

    - results - results object from analysis

    Each dataframe is written to an Excel-format file (if args.write_excel is
    True), and plain text tab-separated file in the output directory. The
    order of result output must be reflected in the order of filestems.