From 4a0d1331db4ca20b8c0d75b326367417f9f728fe Mon Sep 17 00:00:00 2001 From: ABignaud Date: Fri, 15 Apr 2022 14:26:49 +0200 Subject: [PATCH] Check cooler if cool format required. --- .gitignore | 4 ++-- hicstuff/pipeline.py | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 89dfe5e..fad1746 100644 --- a/.gitignore +++ b/.gitignore @@ -144,8 +144,8 @@ coverage.xml # test output test.png test_cli/ -test_data/digested_1.fq.gz -test_data/digested_2.fq.gz +test_data/digested_R1.fq.gz +test_data/digested_R2.fq.gz # Translations *.mo diff --git a/hicstuff/pipeline.py b/hicstuff/pipeline.py index 367f722..77d2c3c 100644 --- a/hicstuff/pipeline.py +++ b/hicstuff/pipeline.py @@ -562,15 +562,23 @@ def full_pipeline( """ # Check if third parties can be run if aligner in ("bowtie2", "minimap2", "bwa"): - if check_tool(aligner) is None: + if (not check_tool(aligner)) | (check_tool(aligner) is None): logger.error("%s is not installed or not on PATH", aligner) - sys.exit(1) + raise ImportError(f"{aligner} is required.") else: - logger.error("Incompatible aligner software, choose bowtie2, minimap2 or bwa") - sys.exit(1) - if check_tool("samtools") is None: - logger.error("Samtools is not installed or not on PATH") - sys.exit(1) + logger.error("Incompatible aligner software, choose bowtie2, minimap2 or bwa.") + raise ValueError("aligner should be either bowtie2, minimap2 or bwa.") + if (not check_tool("samtools")) | (check_tool("samtools") is None): + logger.error("samtools is not installed or not on PATH") + raise ImportError("samtools is required.") + if mat_fmt == 'cool': + try: + import cooler + except ImportError: + logger.error( + "The cooler package is require to return matrix in cool format, please install it first." + ) + raise ImportError("The cooler package is required.") # Pipeline can start from 3 input types start_time = datetime.now()