From 86085d42d13f3a6aa63db405e806402ab66ae1da Mon Sep 17 00:00:00 2001 From: widdowquinn Date: Wed, 19 Jan 2022 14:58:19 +0000 Subject: [PATCH 01/33] update Makefile and requirements.txt Unpinned SQLAlchemy so that Python 3.9 can be used. Updated makefile to use -o and --run_id arguments in new CLI. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 15d97e59..62841ab0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ Pillow PyQt5 scipy seaborn -sqlalchemy==1.3.10 +sqlalchemy tqdm From b5ef8b5d4c817fa382615e527e65936acd9b7b00 Mon Sep 17 00:00:00 2001 From: baileythegreen Date: Mon, 18 Oct 2021 20:05:19 +0100 Subject: [PATCH 02/33] Add `multiprocessing` support to `pyani plot` --- pyani/scripts/subcommands/subcmd_plot.py | 31 +++++++++++------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/pyani/scripts/subcommands/subcmd_plot.py b/pyani/scripts/subcommands/subcmd_plot.py index d3682d1d..8070ed42 100644 --- a/pyani/scripts/subcommands/subcmd_plot.py +++ b/pyani/scripts/subcommands/subcmd_plot.py @@ -117,6 +117,11 @@ def write_run_plots(run_id: int, session, outfmts: List[str], args: Namespace) - logger.debug( f"Have {len(result_label_dict)} labels and {len(result_class_dict)} classes" ) + result_label_dict = pyani_orm.get_matrix_labels_for_run(session, args.run_id) + result_class_dict = pyani_orm.get_matrix_classes_for_run(session, args.run_id) + logger.debug( + f"Have {len(result_label_dict)} labels and {len(result_class_dict)} classes" + ) # Write heatmap and distribution plot for each results matrix @@ -141,24 +146,16 @@ def write_run_plots(run_id: int, session, outfmts: List[str], args: Namespace) - [run_id, matdata, result_label_dict, result_class_dict, outfmts, args], ) ) - plotting_commands.append((write_distribution, [run_id, matdata, outfmts, args])) - - id_matrix = MatrixData("identity", pd.read_json(results.df_identity), {}) - cov_matrix = MatrixData("coverage", pd.read_json(results.df_coverage), {}) - plotting_commands.append( - ( - write_scatter, - [ - run_id, - id_matrix, - cov_matrix, - result_label_dict, - result_class_dict, - outfmts, - args, - ], + plotting_commands.append( + (write_distribution, [run_id, matdata, outfmts, args]) # type: ignore ) - ) + + # Run the plotting commands + [pool.apply_async(func, args, {}) for func, args in plotting_commands] + + # Close worker pool + pool.close() + pool.join() # Run the plotting commands logger.debug("Running plotting commands") From c5fc109d970fbd2a41d5896ee04ecf0a4af2042e Mon Sep 17 00:00:00 2001 From: Bailey Harrington Date: Fri, 19 Nov 2021 17:06:15 +0000 Subject: [PATCH 03/33] Revert "Parser choices" --- pyani/pyani_tools.py | 13 ++++--------- pyani/scripts/parsers/plot_parser.py | 4 ++-- pyani/scripts/parsers/report_parser.py | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pyani/pyani_tools.py b/pyani/pyani_tools.py index a9b93ae8..ae5ab8ad 100644 --- a/pyani/pyani_tools.py +++ b/pyani/pyani_tools.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # (c) The James Hutton Institute 2013-2019 -# (c) The University of Strathclude 2019-2020 +# (c) The University of Strathclude 2019-2022 # Author: Leighton Pritchard # # Contact: @@ -19,7 +19,7 @@ # The MIT License # # Copyright (c) 2013-2019 The James Hutton Institute -# (c) The University of Strathclude 2019-2020 +# (c) The University of Strathclude 2019-2022 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -303,13 +303,8 @@ def label_results_matrix(matrix: pd.DataFrame, labels: Dict) -> pd.DataFrame: Applies the labels from the dictionary to the dataframe in matrix, and returns the result. """ - # The dictionary uses string keys! - # Create a label function that produces