def draw(filestems, gformat, logger=None):
    """Draw ANIb/ANIm/TETRA results

    - filestems - filestems for output files
    - gformat - the format for output graphics
    """
    # Draw heatmaps
    for filestem in filestems:
        fullstem = os.path.join(args.outdirname, filestem)
        outfilename = fullstem + '.%s' % gformat
        infilename = fullstem + '.tab'
        df = pd.read_csv(infilename, index_col=0, sep="\t")
        if logger:
            logger.info("Writing heatmap to %s", outfilename)
        params = pyani_graphics.Params(
            params_mpl(df)[filestem], pyani_tools.get_labels(args.labels),
            pyani_tools.get_labels(args.classes))
        if args.gmethod == "mpl":
            pyani_graphics.heatmap_mpl(df,
                                       outfilename=outfilename,
                                       title=filestem,
                                       params=params)
        elif args.gmethod == "seaborn":
            pyani_graphics.heatmap_seaborn(df,
                                           outfilename=outfilename,
                                           title=filestem,
                                           params=params)
Exemple #2
0
def graphics_inputs(dir_graphics_in):
    """Returns namedtuple of graphics inputs."""
    return GraphicsTestInputs(
        dir_graphics_in / "ANIm_percentage_identity.tab",
        get_labels(dir_graphics_in / "labels.tab"),
        get_labels(dir_graphics_in / "classes.tab"),
    )
def draw(args: Namespace, filestems: List[str], gformat: str) -> None:
    """Draw ANIb/ANIm/TETRA results.

    :param args:  Namespace, command-line arguments
    :param logger: logging object
    :param filestems: - filestems for output files
    :param gformat: - the format for output graphics
    """
    logger = logging.getLogger(__name__)

    # Draw heatmaps
    for filestem in filestems:
        fullstem = args.outdirname / filestem
        outfilename = fullstem.with_suffix(".%s" % gformat)
        infilename = fullstem.with_suffix(".tab")
        dfm = pd.read_csv(infilename, index_col=0, sep="\t")
        logger.info("Writing heatmap to %s", outfilename)
        print(args.labels, args.classes)
        params = pyani_graphics.Params(
            params_mpl(dfm)[filestem],
            pyani_tools.get_labels(args.labels, logger=logger),
            pyani_tools.get_labels(args.classes, logger=logger),
        )
        if args.gmethod == "mpl":
            pyani_graphics.mpl.heatmap(dfm,
                                       outfilename=outfilename,
                                       title=filestem,
                                       params=params)
        elif args.gmethod == "seaborn":
            pyani_graphics.sns.heatmap(dfm,
                                       outfilename=outfilename,
                                       title=filestem,
                                       params=params)
Exemple #4
0
def define_inputs():
    return {'infilename': os.path.join("tests", "target_ANIm_output",
                                       "ANIm_percentage_identity.tab"),
            'labels': pyani_tools.get_labels(os.path.join("tests",
                                                          "test_ani_data",
                                                          "labels.tab"),
                                             logger=None),
            'classes': pyani_tools.get_labels(os.path.join("tests",
                                                           "test_ani_data",
                                                           "classes.tab"),
                                              logger=None)}
Exemple #5
0
def define_inputs():
    """Return a dict of input files, keyed by file name option."""
    return {
        "infilename":
        TESTDIR / "target_ANIm_output" / "ANIm_percentage_identity.tab",
        "labels":
        pyani_tools.get_labels(TESTDIR / "test_ani_data" / "labels.tab",
                               logger=None),
        "classes":
        pyani_tools.get_labels(TESTDIR / "test_ani_data" / "classes.tab",
                               logger=None),
    }