From 4e7bf2ce99659e3bab51879c2bc53cd051829875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gordon=20J=2E=20K=C3=B6hn?= Date: Fri, 13 Sep 2024 14:46:13 +0200 Subject: [PATCH] removing the other plots --- scripts/amplicon_covs_click.py | 64 ++++++++++++---------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/scripts/amplicon_covs_click.py b/scripts/amplicon_covs_click.py index e15bbcf..0f00387 100644 --- a/scripts/amplicon_covs_click.py +++ b/scripts/amplicon_covs_click.py @@ -203,14 +203,10 @@ def make_cov_heatmap(cov_df, output=None): def make_median_cov_hist(cov_df, output=None): """Make histogram of median coverage.""" - click.echo("Computing median coverage histogram") - - try: - click.echo("Computing median coverage - what the heck is this?") - median = np.nanmedian(cov_df.iloc[:, 1:].values, axis=0) - except Exception as e: - click.echo(f"Error computing median coverage: {str(e)}") - return + # FIXME (gordonkoehn): + # median computation causes performance a crash for test data + median = np.nanmedian(cov_df.iloc[:, 1:].values, axis=0) + plt.figure(figsize=(12, 6)) sns.histplot(y=median, binwidth=0.002, stat="density") plt.title("Median coverage histogram") @@ -220,7 +216,6 @@ def make_median_cov_hist(cov_df, output=None): if output is not None: plt.savefig(output) - click.echo(f"Saved histogram to {output}") def make_median_coverage_barplot(cov_df, output=None): @@ -341,38 +336,25 @@ def main( make_cov_heatmap(all_covs, os.path.join(outdir, "cov_heatmap.pdf")) - try: - make_median_cov_hist(all_covs, os.path.join(outdir, "median_cov_hist.pdf")) - except Exception as e: - click.echo(f"Error generating median_cov_hist plot: {str(e)}") - - try: - make_median_coverage_barplot( - all_covs, os.path.join(outdir, "median_coverage_barplot.pdf") - ) - except Exception as e: - click.echo(f"Error generating median_coverage_barplot plot: {str(e)}") - - try: - make_cov_heatmap( - all_covs_frac, os.path.join(outdir, "cov_heatmap_norm.pdf") - ) - except Exception as e: - click.echo(f"Error generating cov_heatmap_norm plot: {str(e)}") - - try: - make_median_cov_hist( - all_covs_frac, os.path.join(outdir, "median_cov_hist_norm.pdf") - ) - except Exception as e: - click.echo(f"Error generating median_cov_hist_norm plot: {str(e)}") - - try: - make_median_coverage_barplot( - all_covs_frac, os.path.join(outdir, "median_coverage_barplot_norm.pdf") - ) - except Exception as e: - click.echo(f"Error generating median_coverage_barplot_norm plot: {str(e)}") + # TODO (gordonkoehn): + # Clarify the purpose of these plots, and if they are still needed. + # + # make_median_cov_hist( + # all_covs, os.path.join(outdir, "median_cov_hist.pdf") + # ) + # make_median_coverage_barplot( + # all_covs, os.path.join(outdir, "median_coverage_barplot.pdf") + # ) + # make_cov_heatmap( + # all_covs_frac, os.path.join(outdir, "cov_heatmap_norm.pdf") + # ) + # make_median_cov_hist( + # all_covs_frac, os.path.join(outdir, "median_cov_hist_norm.pdf") + # ) + + # make_median_coverage_barplot( + # all_covs_frac, os.path.join(outdir, "median_coverage_barplot_norm.pdf") + # ) if __name__ == "__main__":