Mercurial > repos > jay > gaiac_sensor_performance_evaluation
diff gaiac_boxplot/gaiac_boxplot.py @ 0:7c9552ed8676 draft
planemo upload for repository https://github.com/jaidevjoshi83/gaiac.git commit c29a769ed165f313a6410925be24f776652a9663-dirty
author | jay |
---|---|
date | Thu, 15 May 2025 14:46:49 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gaiac_boxplot/gaiac_boxplot.py Thu May 15 14:46:49 2025 +0000 @@ -0,0 +1,41 @@ +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +import seaborn as sns +import argparse as argparse + +def violinplot(infile,clm_list_y, custom_xtick_labels, outfile, plottitle,fig_height, fig_width, clm_lab_y, clm_lab_x): + + df=pd.read_csv(infile, sep="\t") + cl = df.columns.tolist() + clms = [cl[int(x)-1] for x in clm_list_y.split(',')] + + if custom_xtick_labels != None: + labels = custom_xtick_labels.split(',') + else: + labels = clms + plt.figure(figsize=(int(fig_height),int(fig_width))) + sns.set(font_scale=0.8,style='whitegrid') + fig=sns.boxplot(data=df[clms]) + fig.set_ylabel(clm_lab_y) + fig.set_xlabel(clm_lab_x) + fig.set_xticklabels(labels) + fig.set_title(plottitle) + plt.tight_layout + plt.savefig(outfile,dpi=300,bbox_inches="tight") + +if __name__=="__main__": + + parser = argparse.ArgumentParser() + parser.add_argument("-I", "--infile", required=True, default=None, help=".tsv") + parser.add_argument("-C", "--column_list_y", required=False, default=False, help="Path to target tsv file") + parser.add_argument("-L", "--custom_xtick_name", required=False, default=None, help="Path to target tsv file") + parser.add_argument("-O", "--output", required=False, default='Out.png', help="Path to target tsv file") + parser.add_argument("-T", "--title", required=False, default='Time Series plot', help="Path to target tsv file") + parser.add_argument("-H", "--height", required=False, default='14', help="Path to target tsv file") + parser.add_argument("-W", "--width", required=False, default='12', help="Path to target tsv file") + parser.add_argument("-Y", "--ylab", required=False, default='Y label', help="Path to target tsv file") + parser.add_argument("-X", "--xlab", required=False, default='X label(time)', help="Path to target tsv file") + args = parser.parse_args() + + violinplot(args.infile, args.column_list_y, args.custom_xtick_name, args.output, args.title, args.width, args.height, args.ylab, args.xlab)