From 11d48b6412959c19812cd9a9dc89d7fa26d47e68 Mon Sep 17 00:00:00 2001 From: WardDeb Date: Wed, 17 Jan 2024 11:09:30 +0100 Subject: [PATCH 1/3] sched_getaffinity inclusion for availProcessors --- CHANGES.txt | 1 + deeptools/parserCommon.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ea5b937c..28780ef0 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,7 @@ * initiate deprecation of tight_layout in plotheatmap, in favor of constrained_layout. Minor changes in paddings, etc can occur (but for the better). * documentation changes to improve ESS tab, table constraints have been lifted & sphinx_rtd_theme to v2.0.0 * upload artifact in gh test runner pinned to 3 +* Try to get the number of processors from sched_getaffinity, to avoid using to many in job submissions for example. #1199 3.5.4 * error handling and cases for bwAverage with >2 samples diff --git a/deeptools/parserCommon.py b/deeptools/parserCommon.py index 3022404c..a4e7604b 100755 --- a/deeptools/parserCommon.py +++ b/deeptools/parserCommon.py @@ -1,7 +1,7 @@ import argparse import os from importlib.metadata import version - +import multiprocessing def check_float_0_1(value): v = float(value) @@ -341,8 +341,12 @@ def getParentArgParse(args=None, binSize=True, blackList=True): def numberOfProcessors(string): - import multiprocessing - availProc = multiprocessing.cpu_count() + try: + # won't work on macOS or windows + # limit threads to what is available (e.g. grid submissions, issue #1199) + availProc = len(os.sched_getaffinity(0)) + except AttributeError: + availProc = multiprocessing.cpu_count() if string == "max/2": # default case # by default half of the available processors are used From ae7aed430bab53ed948bb5002a65c33c3c8b1879 Mon Sep 17 00:00:00 2001 From: WardDeb Date: Wed, 17 Jan 2024 11:16:22 +0100 Subject: [PATCH 2/3] flake parser --- deeptools/parserCommon.py | 1 + 1 file changed, 1 insertion(+) diff --git a/deeptools/parserCommon.py b/deeptools/parserCommon.py index a4e7604b..9849d9c4 100755 --- a/deeptools/parserCommon.py +++ b/deeptools/parserCommon.py @@ -3,6 +3,7 @@ from importlib.metadata import version import multiprocessing + def check_float_0_1(value): v = float(value) if v < 0.0 or v > 1.0: From 8fc7c7921ffffa59c2e5342d79f18463feb0fcc2 Mon Sep 17 00:00:00 2001 From: WardDeb Date: Wed, 17 Jan 2024 11:16:42 +0100 Subject: [PATCH 3/3] include parser fix scalefacestimation --- CHANGES.txt | 1 + deeptools/estimateScaleFactor.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 28780ef0..5f0bf0f0 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,7 @@ * documentation changes to improve ESS tab, table constraints have been lifted & sphinx_rtd_theme to v2.0.0 * upload artifact in gh test runner pinned to 3 * Try to get the number of processors from sched_getaffinity, to avoid using to many in job submissions for example. #1199 +* Fix typo in estimateScaleFactor that fixes broken argparsing. #1286 3.5.4 * error handling and cases for bwAverage with >2 samples diff --git a/deeptools/estimateScaleFactor.py b/deeptools/estimateScaleFactor.py index 549ecf78..97869a7b 100644 --- a/deeptools/estimateScaleFactor.py +++ b/deeptools/estimateScaleFactor.py @@ -98,7 +98,7 @@ def main(args=None): between to samples """ - args = parseArguments().parse_args(args) + args = parseArguments(args) if len(args.bamfiles) > 2: print("SES method to estimate scale factors only works for two samples") exit(0)