From 690ee60b06497f6da13799e094aa7a7fe03f410c Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 23 Mar 2021 16:05:07 +0100 Subject: [PATCH 01/19] improve test-yml builder --- nf_core/modules/test_yml_builder.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/nf_core/modules/test_yml_builder.py b/nf_core/modules/test_yml_builder.py index a0453554f5..8209fe26c6 100644 --- a/nf_core/modules/test_yml_builder.py +++ b/nf_core/modules/test_yml_builder.py @@ -134,7 +134,7 @@ def build_all_tests(self): def build_single_test(self, entry_point): """Given the supplied cli flags, prompt for any that are missing. - Returns: False if failure, None if success. + Returns: Test command """ ep_test = { "name": "", @@ -206,7 +206,7 @@ def get_md5_sums(self, entry_point, command): run_this_test = False while results_dir is None: if self.run_tests or run_this_test: - results_dir = self.run_tests_workflow(command) + results_dir, results_dir_repeat = self.run_tests_workflow(command) else: results_dir = rich.prompt.Prompt.ask( f"[violet]Test output folder with results[/] (leave blank to run test)" @@ -227,6 +227,22 @@ def get_md5_sums(self, entry_point, command): elem = elem.replace(results_dir, "output") test_files.append({"path": elem, "md5sum": elem_md5}) + # Generate md5 sums for repeat test + test_files_repeat = [] + for root, _, file in os.walk(results_dir_repeat): + for elem in file: + elem = os.path.join(root, elem) + elem_md5 = self._md5(elem) + elem = elem.replace(results_dir_repeat, "output") + test_files_repeat.append({"path": elem, "md5sum": elem_md5}) + + # Compare both test.yml files + test_files.sort() + test_files_repeat.sort() + for i in range(len(test_files)): + if not test_files[i]["md5sum"] == test_files_repeat[i]["md5sum"]: + test_files[i].pop("md5sum") + if len(test_files) == 0: raise UserWarning(f"Could not find any test result files in '{results_dir}'") @@ -258,11 +274,15 @@ def run_tests_workflow(self, command): log.info(f"Setting env var '$PROFILE' to '{profile}'") tmp_dir = tempfile.mkdtemp() + tmp_dir_repeat = tempfile.mkdtemp() command += f" --outdir {tmp_dir}" + command_repeat = command + f" --outdir {tmp_dir_repeat}" log.info(f"Running '{self.module_name}' test with command:\n[violet]{command}") try: nfconfig_raw = subprocess.check_output(shlex.split(command)) + nfconfig_raw = subprocess.check_output(shlex.split(command_repeat)) + except OSError as e: if e.errno == errno.ENOENT and command.strip().startswith("nextflow "): raise AssertionError( @@ -276,7 +296,7 @@ def run_tests_workflow(self, command): log.info("Test workflow finished!") log.debug(nfconfig_raw) - return tmp_dir + return tmp_dir, tmp_dir_repeat def print_test_yml(self): """ From 7ce70409d93660164cd7c49a12bf48213a1b41d7 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 23 Mar 2021 16:09:04 +0100 Subject: [PATCH 02/19] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d354c50ab7..53a60631f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nf-core/tools: Changelog +## 2.0.0dev + +* Running tests twice with `nf-core modules create-test-yml` to catch unreproducible md5 sums [[#890](https://github.com/nf-core/tools/issues/890)] + ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] * Added better logging message if a user doesn't specificy the directory correctly with `nf-core modules` commands [[#942](https://github.com/nf-core/tools/pull/942)] From 94b80bcefb8c192f57247a973a47e3df3353fc72 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 23 Mar 2021 19:42:56 +0100 Subject: [PATCH 03/19] fixed nf-core modules create bug --- nf_core/modules/create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index c788e01f7b..f9f44ac675 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -237,7 +237,7 @@ def render_template(self): fh.write(rendered_output) # Mirror file permissions - template_stat = os.stat(os.path.join("nf_core", "module-template", template_fn)) + template_stat = os.stat(os.path.join(os.path.dirname(nf_core.__file__), "module-template", template_fn)) os.chmod(dest_fn, template_stat.st_mode) def get_repo_type(self, directory): From 5001a0232383e5f0d2f20edf097257fd85068ce6 Mon Sep 17 00:00:00 2001 From: Phil Ewelws Date: Tue, 23 Mar 2021 21:36:18 +0100 Subject: [PATCH 04/19] Bump to v1.14dev, move NXF_VER up in scope in sync workflow --- .github/workflows/sync.yml | 5 +++-- CHANGELOG.md | 4 ++++ setup.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 957714de52..d958fbee08 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -4,11 +4,12 @@ on: types: [published] workflow_dispatch: +env: + NXF_VER: 21.03.0-edge + jobs: get-pipelines: runs-on: ubuntu-latest - env: - NXF_VER: 21.03.0-edge outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ca7392ac..2beb2f484e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nf-core/tools: Changelog +## v1.14dev + +* Fix sync error again where the Nextflow edge release needs to be used for some pipelines + ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] * Make module template pass the EC linter [[#953](https://github.com/nf-core/tools/pull/953)] diff --git a/setup.py b/setup.py index 9f27ad7dde..3d3130f46c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -version = "1.13.2" +version = "1.14dev" with open("README.md") as f: readme = f.read() From dc9b3fd7fcb8e8e3edb2593582bf50af59b61aa0 Mon Sep 17 00:00:00 2001 From: Erkison Odih Date: Wed, 24 Mar 2021 10:59:59 +0100 Subject: [PATCH 05/19] allow module names with character notations as in conda --- nf_core/modules/create.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index f9f44ac675..473806f26c 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -32,6 +32,7 @@ def __init__(self, directory=".", tool="", author=None, process_label=None, has_ self.has_meta = has_meta self.force_overwrite = force + self.tool_conda_name = None self.subtool = None self.tool_licence = None self.repo_type = None @@ -89,6 +90,12 @@ def create(self): tool_clean = re.sub(r"[^a-z\d/]", "", self.tool.lower()) if rich.prompt.Confirm.ask(f"[violet]Change '{self.tool}' to '{tool_clean}'?"): self.tool = tool_clean + # Allow characters for use in finding conda package + elif rich.prompt.Confirm.ask( + f"[violet]Does '{self.tool}' have the same capitalizations/punctuations in Bioconda?" + ): + self.tool_conda_name = self.tool + self.tool = tool_clean else: self.tool = "" @@ -118,7 +125,10 @@ def create(self): # Try to find a bioconda package for 'tool' try: - anaconda_response = nf_core.utils.anaconda_package(self.tool, ["bioconda"]) + if self.tool_conda_name: + anaconda_response = nf_core.utils.anaconda_package(self.tool_conda_name, ["bioconda"]) + else: + anaconda_response = nf_core.utils.anaconda_package(self.tool, ["bioconda"]) version = anaconda_response.get("latest_version") if not version: version = str(max([parse_version(v) for v in anaconda_response["versions"]])) @@ -126,7 +136,10 @@ def create(self): self.tool_description = anaconda_response.get("summary", "") self.tool_doc_url = anaconda_response.get("doc_url", "") self.tool_dev_url = anaconda_response.get("dev_url", "") - self.bioconda = "bioconda::" + self.tool + "=" + version + if self.tool_conda_name: + self.bioconda = "bioconda::" + self.tool_conda_name + "=" + version + else: + self.bioconda = "bioconda::" + self.tool + "=" + version log.info(f"Using Bioconda package: '{self.bioconda}'") except (ValueError, LookupError) as e: log.warning( @@ -136,7 +149,10 @@ def create(self): # Try to get the container tag (only if bioconda package was found) if self.bioconda: try: - self.container_tag = nf_core.utils.get_biocontainer_tag(self.tool, version) + if self.tool_conda_name: + self.container_tag = nf_core.utils.get_biocontainer_tag(self.tool_conda_name, version) + else: + self.container_tag = nf_core.utils.get_biocontainer_tag(self.tool, version) log.info(f"Using Docker / Singularity container with tag: '{self.container_tag}'") except (ValueError, LookupError) as e: log.info(f"Could not find a container tag ({e})") From 43b3274df38fd847290e297983f8b6ee2406ae2c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 14:03:07 +0100 Subject: [PATCH 06/19] Fix bug in lint with release mode --- CHANGELOG.md | 1 + nf_core/lint/__init__.py | 2 +- nf_core/lint/version_consistency.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2beb2f484e..76815eb37c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v1.14dev * Fix sync error again where the Nextflow edge release needs to be used for some pipelines +* Fix bug with `nf-core lint --release` (`NameError: name 'os' is not defined`) ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] diff --git a/nf_core/lint/__init__.py b/nf_core/lint/__init__.py index 4d9c5de35d..548d1e8d87 100644 --- a/nf_core/lint/__init__.py +++ b/nf_core/lint/__init__.py @@ -438,7 +438,7 @@ def _get_results_md(self): f"{comment_body_text}\n\n" f"```diff{test_passed_count}{test_ignored_count}{test_fixed_count}{test_warning_count}{test_failure_count}\n" "```\n\n" - "
\n" + "
\n\n" f"{test_failures}{test_warnings}{test_ignored}{test_fixed}{test_passes}### Run details\n\n" f"* nf-core/tools version {nf_core.__version__}\n" f"* Run at `{timestamp}`\n\n" diff --git a/nf_core/lint/version_consistency.py b/nf_core/lint/version_consistency.py index fbd90394a4..2510f3e95f 100644 --- a/nf_core/lint/version_consistency.py +++ b/nf_core/lint/version_consistency.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +import os + def version_consistency(self): """Pipeline and container version number consistency. From 5cd47b0f42c127e6f263519e388ab3966a975fbb Mon Sep 17 00:00:00 2001 From: Erkison Odih Date: Wed, 24 Mar 2021 14:20:53 +0100 Subject: [PATCH 07/19] request different module name on bioconda lookup fail --- nf_core/modules/create.py | 57 ++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 473806f26c..4d9aae79cd 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -90,12 +90,6 @@ def create(self): tool_clean = re.sub(r"[^a-z\d/]", "", self.tool.lower()) if rich.prompt.Confirm.ask(f"[violet]Change '{self.tool}' to '{tool_clean}'?"): self.tool = tool_clean - # Allow characters for use in finding conda package - elif rich.prompt.Confirm.ask( - f"[violet]Does '{self.tool}' have the same capitalizations/punctuations in Bioconda?" - ): - self.tool_conda_name = self.tool - self.tool = tool_clean else: self.tool = "" @@ -124,27 +118,36 @@ def create(self): self.file_paths = self.get_module_dirs() # Try to find a bioconda package for 'tool' - try: - if self.tool_conda_name: - anaconda_response = nf_core.utils.anaconda_package(self.tool_conda_name, ["bioconda"]) - else: - anaconda_response = nf_core.utils.anaconda_package(self.tool, ["bioconda"]) - version = anaconda_response.get("latest_version") - if not version: - version = str(max([parse_version(v) for v in anaconda_response["versions"]])) - self.tool_licence = nf_core.utils.parse_anaconda_licence(anaconda_response, version) - self.tool_description = anaconda_response.get("summary", "") - self.tool_doc_url = anaconda_response.get("doc_url", "") - self.tool_dev_url = anaconda_response.get("dev_url", "") - if self.tool_conda_name: - self.bioconda = "bioconda::" + self.tool_conda_name + "=" + version - else: - self.bioconda = "bioconda::" + self.tool + "=" + version - log.info(f"Using Bioconda package: '{self.bioconda}'") - except (ValueError, LookupError) as e: - log.warning( - f"{e}\nBuilding module without tool software and meta, you will need to enter this information manually." - ) + while True: + try: + if self.tool_conda_name: + anaconda_response = nf_core.utils.anaconda_package(self.tool_conda_name, ["bioconda"]) + else: + anaconda_response = nf_core.utils.anaconda_package(self.tool, ["bioconda"]) + version = anaconda_response.get("latest_version") + if not version: + version = str(max([parse_version(v) for v in anaconda_response["versions"]])) + self.tool_licence = nf_core.utils.parse_anaconda_licence(anaconda_response, version) + self.tool_description = anaconda_response.get("summary", "") + self.tool_doc_url = anaconda_response.get("doc_url", "") + self.tool_dev_url = anaconda_response.get("dev_url", "") + if self.tool_conda_name: + self.bioconda = "bioconda::" + self.tool_conda_name + "=" + version + else: + self.bioconda = "bioconda::" + self.tool + "=" + version + log.info(f"Using Bioconda package: '{self.bioconda}'") + break + except (ValueError, LookupError) as e: + if rich.prompt.Confirm.ask( + f"[violet]Could not find Conda dependency using the Anaconda API: '{self.tool}'. Do you want to enter a different bioconda package name?" + ): + self.tool_conda_name = rich.prompt.Prompt.ask("[violet]Name of tool/subtool").strip() + continue + else: + log.warning( + f"{e}\nBuilding module without tool software and meta, you will need to enter this information manually." + ) + break # Try to get the container tag (only if bioconda package was found) if self.bioconda: From a70a2f5dc96c33a1d7f2df7fa594ba7becf48b96 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 24 Mar 2021 14:51:46 +0100 Subject: [PATCH 08/19] adding more logging --- nf_core/modules/test_yml_builder.py | 39 +++++++++++++++-------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/nf_core/modules/test_yml_builder.py b/nf_core/modules/test_yml_builder.py index 8209fe26c6..767a6015a9 100644 --- a/nf_core/modules/test_yml_builder.py +++ b/nf_core/modules/test_yml_builder.py @@ -18,6 +18,7 @@ import subprocess import tempfile import yaml +import operator import nf_core.utils import nf_core.modules.pipeline_modules @@ -195,6 +196,21 @@ def _md5(self, fname): md5sum = hash_md5.hexdigest() return md5sum + def create_test_file_dict(self, results_dir): + """ Walk through directory and collect md5 sums """ + test_files = [] + for root, dir, file in os.walk(results_dir): + for elem in file: + elem = os.path.join(root, elem) + elem_md5 = self._md5(elem) + # Switch out the results directory path with the expected 'output' directory + elem = elem.replace(results_dir, "output") + test_files.append({"path": elem, "md5sum": elem_md5}) + + test_files = sorted(test_files, key=operator.itemgetter("path")) + + return test_files + def get_md5_sums(self, entry_point, command): """ Recursively go through directories and subdirectories @@ -218,29 +234,13 @@ def get_md5_sums(self, entry_point, command): log.error(f"Directory '{results_dir}' does not exist") results_dir = None - test_files = [] - for root, dir, file in os.walk(results_dir): - for elem in file: - elem = os.path.join(root, elem) - elem_md5 = self._md5(elem) - # Switch out the results directory path with the expected 'output' directory - elem = elem.replace(results_dir, "output") - test_files.append({"path": elem, "md5sum": elem_md5}) - - # Generate md5 sums for repeat test - test_files_repeat = [] - for root, _, file in os.walk(results_dir_repeat): - for elem in file: - elem = os.path.join(root, elem) - elem_md5 = self._md5(elem) - elem = elem.replace(results_dir_repeat, "output") - test_files_repeat.append({"path": elem, "md5sum": elem_md5}) + test_files = self.create_test_file_dict(results_dir=results_dir) + test_files_repeat = self.create_test_file_dict(results_dir=results_dir_repeat) # Compare both test.yml files - test_files.sort() - test_files_repeat.sort() for i in range(len(test_files)): if not test_files[i]["md5sum"] == test_files_repeat[i]["md5sum"]: + log.info(f"Deleting md5 sums of '{test_files[i]['path']}' as it is not reproducible") test_files[i].pop("md5sum") if len(test_files) == 0: @@ -281,6 +281,7 @@ def run_tests_workflow(self, command): log.info(f"Running '{self.module_name}' test with command:\n[violet]{command}") try: nfconfig_raw = subprocess.check_output(shlex.split(command)) + log.info(f"Repeating test ...") nfconfig_raw = subprocess.check_output(shlex.split(command_repeat)) except OSError as e: From a592497f242e6fe59be91423546a31171a443026 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 24 Mar 2021 15:24:10 +0100 Subject: [PATCH 09/19] bump version to 1.13.3 --- CHANGELOG.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a0a359c04..8edac7d26e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # nf-core/tools: Changelog -## v1.14dev +## [v1.13.3 - Copper Crocodile Resurrection :crocodile:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-24] * Running tests twice with `nf-core modules create-test-yml` to catch unreproducible md5 sums [[#890](https://github.com/nf-core/tools/issues/890)] * Fix sync error again where the Nextflow edge release needs to be used for some pipelines diff --git a/setup.py b/setup.py index 3d3130f46c..605e08406b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -version = "1.14dev" +version = "1.13.3" with open("README.md") as f: readme = f.read() From 85589c2e41d39ce59875819d89316e9a4d4cceb2 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 16:13:38 +0100 Subject: [PATCH 10/19] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8edac7d26e..3fbf1af672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ * Running tests twice with `nf-core modules create-test-yml` to catch unreproducible md5 sums [[#890](https://github.com/nf-core/tools/issues/890)] * Fix sync error again where the Nextflow edge release needs to be used for some pipelines * Fix bug with `nf-core lint --release` (`NameError: name 'os' is not defined`) +* Added linebreak to linting comment so that markdown header renders on PR comment properly +* In moule create command - if no bioconda package is found, prompt user for a different bioconda package name ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] From 640cf4da1830e8ca3c31f4dd849b3717f8e589be Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 16:14:11 +0100 Subject: [PATCH 11/19] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbf1af672..a0e181baf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Fix sync error again where the Nextflow edge release needs to be used for some pipelines * Fix bug with `nf-core lint --release` (`NameError: name 'os' is not defined`) * Added linebreak to linting comment so that markdown header renders on PR comment properly -* In moule create command - if no bioconda package is found, prompt user for a different bioconda package name +* `nf-core modules create` command - if no bioconda package is found, prompt user for a different bioconda package name ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] From 2e751506f58cbf630a9af44f94ffede011536e53 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 24 Mar 2021 16:27:50 +0100 Subject: [PATCH 12/19] replace md5sum with contains --- nf_core/modules/test_yml_builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nf_core/modules/test_yml_builder.py b/nf_core/modules/test_yml_builder.py index 767a6015a9..b5e22795c6 100644 --- a/nf_core/modules/test_yml_builder.py +++ b/nf_core/modules/test_yml_builder.py @@ -240,8 +240,10 @@ def get_md5_sums(self, entry_point, command): # Compare both test.yml files for i in range(len(test_files)): if not test_files[i]["md5sum"] == test_files_repeat[i]["md5sum"]: - log.info(f"Deleting md5 sums of '{test_files[i]['path']}' as it is not reproducible") test_files[i].pop("md5sum") + test_files[i][ + "contains" + ] = "# TODO nf-core: md5sum test not possible, please replace this comment with a string in the file" if len(test_files) == 0: raise UserWarning(f"Could not find any test result files in '{results_dir}'") From 4d2f521049ae26a6a601ceb10ddb6c26ae0bc11c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 19:42:59 +0100 Subject: [PATCH 13/19] tweak TODO string in test_yml_builder.py --- nf_core/modules/test_yml_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/test_yml_builder.py b/nf_core/modules/test_yml_builder.py index b5e22795c6..0abb5cd719 100644 --- a/nf_core/modules/test_yml_builder.py +++ b/nf_core/modules/test_yml_builder.py @@ -243,7 +243,7 @@ def get_md5_sums(self, entry_point, command): test_files[i].pop("md5sum") test_files[i][ "contains" - ] = "# TODO nf-core: md5sum test not possible, please replace this comment with a string in the file" + ] = "# TODO nf-core: file md5sum was variable, please replace this text with a string found in the file instead" if len(test_files) == 0: raise UserWarning(f"Could not find any test result files in '{results_dir}'") From 67a5994dd7ef62658633f2294bcca3ca9cc8adfd Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 19:45:36 +0100 Subject: [PATCH 14/19] tweak log output in bioconda package name prompt --- nf_core/modules/create.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 4d9aae79cd..6f1f0cbde4 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -138,10 +138,11 @@ def create(self): log.info(f"Using Bioconda package: '{self.bioconda}'") break except (ValueError, LookupError) as e: + log.warning(f"Could not find Conda dependency using the Anaconda API: '{self.tool}'") if rich.prompt.Confirm.ask( - f"[violet]Could not find Conda dependency using the Anaconda API: '{self.tool}'. Do you want to enter a different bioconda package name?" + f"[violet]Do you want to enter a different Bioconda package name?" ): - self.tool_conda_name = rich.prompt.Prompt.ask("[violet]Name of tool/subtool").strip() + self.tool_conda_name = rich.prompt.Prompt.ask("[violet]Name of Bioconda package").strip() continue else: log.warning( From f666c0500370cec02d7bb46bbf49a7d98ef10cf6 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 24 Mar 2021 20:01:54 +0100 Subject: [PATCH 15/19] Black --- nf_core/modules/create.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 6f1f0cbde4..ed7f778bfc 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -139,9 +139,7 @@ def create(self): break except (ValueError, LookupError) as e: log.warning(f"Could not find Conda dependency using the Anaconda API: '{self.tool}'") - if rich.prompt.Confirm.ask( - f"[violet]Do you want to enter a different Bioconda package name?" - ): + if rich.prompt.Confirm.ask(f"[violet]Do you want to enter a different Bioconda package name?"): self.tool_conda_name = rich.prompt.Prompt.ask("[violet]Name of Bioconda package").strip() continue else: From 11e45961e0298f2bff4865ddbdd3e20dd8719a93 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Thu, 25 Mar 2021 12:50:01 +0100 Subject: [PATCH 16/19] fix module template test data --- CHANGELOG.md | 1 + nf_core/module-template/tests/main.nf | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e181baf4..06ac98d0bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Fix bug with `nf-core lint --release` (`NameError: name 'os' is not defined`) * Added linebreak to linting comment so that markdown header renders on PR comment properly * `nf-core modules create` command - if no bioconda package is found, prompt user for a different bioconda package name +* Updated module template `main.nf` with new test data paths ## [v1.13.2 - Copper Crocodile CPR :crocodile: :face_with_head_bandage:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-23] diff --git a/nf_core/module-template/tests/main.nf b/nf_core/module-template/tests/main.nf index 8438369de8..1ea99b1742 100644 --- a/nf_core/module-template/tests/main.nf +++ b/nf_core/module-template/tests/main.nf @@ -8,9 +8,9 @@ workflow test_{{ tool_name }} { {% if has_meta %} def input = [] input = [ [ id:'test', single_end:false ], // meta map - file("${launchDir}/tests/data/genomics/sarscov2/bam/test_paired_end.bam", checkIfExists: true) ] + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) ] {%- else %} - def input = file("${launchDir}/tests/data/genomics/sarscov2/bam/test_single_end.bam", checkIfExists: true) + def input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) {%- endif %} {{ tool_name|upper }} ( input ) From 194e5ce88fb5e7248026073a3fa8c2a2f03beca7 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Thu, 25 Mar 2021 13:12:39 +0100 Subject: [PATCH 17/19] remove "def" statements --- nf_core/module-template/tests/main.nf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nf_core/module-template/tests/main.nf b/nf_core/module-template/tests/main.nf index 1ea99b1742..d062eba787 100644 --- a/nf_core/module-template/tests/main.nf +++ b/nf_core/module-template/tests/main.nf @@ -6,11 +6,10 @@ include { {{ tool_name|upper }} } from '../../../{{ "../" if subtool else "" }}s workflow test_{{ tool_name }} { {% if has_meta %} - def input = [] input = [ [ id:'test', single_end:false ], // meta map file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) ] {%- else %} - def input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) {%- endif %} {{ tool_name|upper }} ( input ) From c0941661d487db25ada72ad33fdab8feb12408a3 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 25 Mar 2021 13:57:19 +0100 Subject: [PATCH 18/19] Extra lint test with --release --- .github/workflows/create-lint-wf.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/create-lint-wf.yml b/.github/workflows/create-lint-wf.yml index 569cac6599..cd87a22c4e 100644 --- a/.github/workflows/create-lint-wf.yml +++ b/.github/workflows/create-lint-wf.yml @@ -48,6 +48,9 @@ jobs: - name: nf-core bump-version run: nf-core --log-file log.txt bump-version nf-core-testpipeline/ 1.1 + - name: nf-core lint in release mode + run: nf-core --log-file log.txt lint nf-core-testpipeline --fail-ignored --release + - name: nf-core modules install run: nf-core --log-file log.txt modules install nf-core-testpipeline/ --tool fastqc From 2ecae0c17d0aaa9b2855bef1e95dcd5f97e9d094 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 25 Mar 2021 15:06:39 +0100 Subject: [PATCH 19/19] Make tracebacks shorter --- nf_core/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 5ae1a28c65..fe4932759b 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -32,7 +32,7 @@ def run_nf_core(): # Set up the rich traceback - rich.traceback.install(width=200, word_wrap=True) + rich.traceback.install(width=200, word_wrap=True, extra_lines=1) # Print nf-core header to STDERR stderr = rich.console.Console(file=sys.stderr, force_terminal=nf_core.utils.rich_force_colors())