def draw(results, filestems): """Draw ANIb/ANIm/TETRA results - results - tuple of dataframes from ANIb analysis """ # Draw heatmaps for df, filestem in zip(results, filestems): fullstem = os.path.join(args.outdirname, filestem) outfilename = fullstem + '.%s' % args.gformat infilename = fullstem + '.tab' logger.info("Writing heatmap to %s" % outfilename) if args.gmethod == "mpl": pyani_graphics.heatmap_mpl(df, outfilename=outfilename, title=filestem, cmap=params_mpl(df)[filestem][0], vmin=params_mpl(df)[filestem][1], vmax=params_mpl(df)[filestem][2], labels=get_labels(args.labels), classes=get_labels(args.classes)) elif args.gmethod == "R": rstr = pyani_graphics.heatmap_r(infilename, outfilename, gformat=args.gformat.lower(), title=filestem, cmap=params_r(df)[filestem][0], vmin=params_r(df)[filestem][1], vmax=params_r(df)[filestem][2], labels=get_labels(args.labels), classes=get_labels(args.classes)) logger.info("Executed R code:\n%s" % rstr)
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)
def draw(results, filestems, gformat): """Draw ANIb/ANIm/TETRA results - results - tuple of dataframes from ANIb analysis """ # Draw heatmaps for df, filestem in zip(results, filestems): fullstem = os.path.join(args.outdirname, filestem) outfilename = fullstem + '.%s' % gformat infilename = fullstem + '.tab' logger.info("Writing heatmap to %s" % outfilename) if args.gmethod == "mpl": pyani_graphics.heatmap_mpl(df, outfilename=outfilename, title=filestem, cmap=params_mpl(df)[filestem][0], vmin=params_mpl(df)[filestem][1], vmax=params_mpl(df)[filestem][2], labels=get_labels(args.labels), classes=get_labels(args.classes)) elif args.gmethod == "R": rstr = pyani_graphics.heatmap_r(infilename, outfilename, gformat=gformat.lower(), title=filestem, cmap=params_r(df)[filestem][0], vmin=params_r(df)[filestem][1], vmax=params_r(df)[filestem][2], labels=get_labels(args.labels), classes=get_labels(args.classes)) logger.info("Executed R code:\n%s" % rstr)