From 255ac2d023ba62559ff34bf08b4df760ab47f661 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Wed, 17 Jan 2024 10:12:01 -0600 Subject: [PATCH] Error out when attempting to use multithreading on MacOS --- pvactools/tools/pvacbind/run.py | 4 ++++ pvactools/tools/pvacfuse/run.py | 3 +++ pvactools/tools/pvacseq/run.py | 4 ++++ pvactools/tools/pvacvector/run.py | 5 ++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pvactools/tools/pvacbind/run.py b/pvactools/tools/pvacbind/run.py index b8ad94f50..7ba65b9c1 100644 --- a/pvactools/tools/pvacbind/run.py +++ b/pvactools/tools/pvacbind/run.py @@ -3,6 +3,7 @@ import os import shutil import yaml +import platform from pvactools.lib.prediction_class import * from pvactools.lib.pipeline import PvacbindPipeline @@ -50,6 +51,9 @@ def main(args_input = sys.argv[1:]): if args.iedb_retries > 100: sys.exit("The number of IEDB retries must be less than or equal to 100") + if args.n_threads > 1 and platform.system() == "Darwin": + raise Exception("Multithreading is not supported on MacOS") + input_file_type = 'fasta' base_output_dir = os.path.abspath(args.output_dir) diff --git a/pvactools/tools/pvacfuse/run.py b/pvactools/tools/pvacfuse/run.py index d7d179ee2..4ce94b527 100644 --- a/pvactools/tools/pvacfuse/run.py +++ b/pvactools/tools/pvacfuse/run.py @@ -2,6 +2,7 @@ import argparse import os import shutil +import platform from pvactools.lib.prediction_class import * from pvactools.lib.pipeline import PvacbindPipeline @@ -124,6 +125,8 @@ def main(args_input = sys.argv[1:]): else: sys.exit("The downstream sequence length needs to be a positive integer or 'full'") + if args.n_threads > 1 and platform.system() == "Darwin": + raise Exception("Multithreading is not supported on MacOS") base_output_dir = os.path.abspath(args.output_dir) diff --git a/pvactools/tools/pvacseq/run.py b/pvactools/tools/pvacseq/run.py index 4500155bb..03265bd25 100644 --- a/pvactools/tools/pvacseq/run.py +++ b/pvactools/tools/pvacseq/run.py @@ -3,6 +3,7 @@ import os import shutil import yaml +import platform from pvactools.lib.prediction_class import * from pvactools.lib.pipeline import Pipeline @@ -66,6 +67,9 @@ def main(args_input = sys.argv[1:]): elif args.tumor_purity < 0: raise Exception("--tumor-purity must be a float between 0 and 1. Value too small: {}".format(args.tumor_purity)) + if args.n_threads > 1 and platform.system() == "Darwin": + raise Exception("Multithreading is not supported on MacOS") + input_file_type = 'vcf' base_output_dir = os.path.abspath(args.output_dir) diff --git a/pvactools/tools/pvacvector/run.py b/pvactools/tools/pvacvector/run.py index df3c02344..72caed9c8 100644 --- a/pvactools/tools/pvacvector/run.py +++ b/pvactools/tools/pvacvector/run.py @@ -15,6 +15,7 @@ from Bio.Alphabet import IUPAC import itertools import json +import platform from pvactools.lib.optimal_peptide import OptimalPeptide from pvactools.lib.vector_visualization import VectorVisualization @@ -411,7 +412,6 @@ def create_dna_backtranslation(results_file, dna_results_file): SeqIO.write([output_record], dna_results_file, 'fasta') def main(args_input=sys.argv[1:]): - parser = define_parser() args = parser.parse_args(args_input) @@ -433,6 +433,9 @@ def main(args_input=sys.argv[1:]): else: sys.exit("Input file type not as expected. Needs to be a .fa or a .tsv file") + if args.n_threads > 1 and platform.system() == "Darwin": + raise Exception("Multithreading is not supported on MacOS") + (class_i_prediction_algorithms, class_ii_prediction_algorithms) = pvactools.lib.run_utils.split_algorithms(args.prediction_algorithms) if len(class_i_prediction_algorithms) == 0: print("No MHC class I prediction algorithms chosen. Skipping MHC class I predictions.")