From 78e82640a0206dcda873f543181b804a59b95a5c Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 23 Oct 2024 15:30:57 +0200 Subject: [PATCH 01/13] move test in correct directory --- tests/{ => pipelines}/test_rocrate.py | 31 ++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) rename tests/{ => pipelines}/test_rocrate.py (73%) diff --git a/tests/test_rocrate.py b/tests/pipelines/test_rocrate.py similarity index 73% rename from tests/test_rocrate.py rename to tests/pipelines/test_rocrate.py index 6defd5d5e..54561af42 100644 --- a/tests/test_rocrate.py +++ b/tests/pipelines/test_rocrate.py @@ -1,8 +1,6 @@ """Test the nf-core pipelines rocrate command""" import shutil -import tempfile -import unittest from pathlib import Path import rocrate.rocrate @@ -13,33 +11,18 @@ import nf_core.pipelines.rocrate import nf_core.utils +from ..test_pipelines import TestPipelines -class TestROCrate(unittest.TestCase): - """Class for lint tests""" - - def setUp(self): - """Function that runs at start of tests for common resources - Use nf_core.create() to make a pipeline that we can use for testing - """ - - self.tmp_dir = Path(tempfile.mkdtemp()) - self.test_pipeline_dir = Path(self.tmp_dir, "nf-core-testpipeline") - self.create_obj = nf_core.pipelines.create.create.PipelineCreate( - name="testpipeline", - description="This is a test pipeline", - author="Test McTestFace", - outdir=str(self.test_pipeline_dir), - version="1.0.0", - no_git=False, - force=True, - ) - self.create_obj.init_pipeline() +class TestROCrate(TestPipelines): + """Class for lint tests""" + def setUp(self) -> None: + super().setUp() # add fake metro map - Path(self.test_pipeline_dir, "docs", "images", "nf-core-testpipeline_metro_map.png").touch() + Path(self.pipeline_dir, "docs", "images", "nf-core-testpipeline_metro_map.png").touch() # commit the changes - repo = Repo(self.test_pipeline_dir) + repo = Repo(self.pipeline_dir) repo.git.add(A=True) repo.index.commit("Initial commit") From b74319de5c2251200b4e0a6f244f2e7f7fa453a7 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 23 Oct 2024 16:49:59 +0200 Subject: [PATCH 02/13] fix tests --- nf_core/pipelines/rocrate.py | 35 +++++++++------------------------ tests/pipelines/test_rocrate.py | 8 ++++---- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index de00189a2..04f91480c 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -7,7 +7,7 @@ import sys from datetime import datetime from pathlib import Path -from typing import Dict, List, Optional, Set, Union +from typing import Optional, Set, Union import requests import rocrate.rocrate @@ -90,7 +90,7 @@ def __init__(self, pipeline_dir: Path, version="") -> None: def create_rocrate( self, outdir: Path, json_path: Union[None, Path] = None, zip_path: Union[None, Path] = None - ) -> None: + ) -> bool: """ Create an RO Crate for a pipeline @@ -107,8 +107,6 @@ def create_rocrate( log.error(e) sys.exit(1) - # Change to the pipeline directory, because the RO Crate doesn't handle relative paths well - # Check that the checkout pipeline version is the same as the requested version if self.version != "": if self.version != self.pipeline_obj.nf_config.get("manifest.version"): @@ -132,11 +130,12 @@ def create_rocrate( # Save just the JSON metadata file if json_path is not None: - if json_path.name != "ro-crate-metadata.json": - json_path = json_path / "ro-crate-metadata.json" + if json_path.name == "ro-crate-metadata.json": + json_path = json_path.parent log.info(f"Saving metadata file to '{json_path}'") self.crate.metadata.write(json_path) + return True # Save the whole crate zip file if zip_path is not None: @@ -144,6 +143,10 @@ def create_rocrate( zip_path = zip_path / "ro-crate.crate.zip" log.info(f"Saving zip file '{zip_path}") self.crate.write_zip(zip_path) + return True + if json_path is None and zip_path is None: + log.error("Please provide a path to save the ro-crate file or the zip file.") + return False def make_workflow_rocrate(self) -> None: """ @@ -224,26 +227,6 @@ def set_main_entity(self, main_entity_filename: str): "url", f"https://nf-co.re/{self.crate.name.replace('nf-core/','')}/{url}/", compact=True ) self.crate.mainEntity.append_to("version", self.version, compact=True) - if self.pipeline_obj.schema_obj is not None: - log.debug("input value") - - schema_input = self.pipeline_obj.schema_obj.schema["definitions"]["input_output_options"]["properties"][ - "input" - ] - input_value: Dict[str, Union[str, List[str], bool]] = { - "@id": "#input", - "@type": ["FormalParameter"], - "default": schema_input.get("default", ""), - "encodingFormat": schema_input.get("mimetype", ""), - "valueRequired": "input" - in self.pipeline_obj.schema_obj.schema["definitions"]["input_output_options"]["required"], - "dct:conformsTo": "https://bioschemas.org/types/FormalParameter/1.0-RELEASE", - } - self.crate.add_jsonld(input_value) - self.crate.mainEntity.append_to( - "input", - {"@id": "#input"}, - ) # get keywords from nf-core website remote_workflows = requests.get("https://nf-co.re/pipelines.json").json()["remote_workflows"] diff --git a/tests/pipelines/test_rocrate.py b/tests/pipelines/test_rocrate.py index 54561af42..2e14878da 100644 --- a/tests/pipelines/test_rocrate.py +++ b/tests/pipelines/test_rocrate.py @@ -36,14 +36,14 @@ def test_rocrate_creation(self): """Run the nf-core rocrate command""" # Run the command - self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.test_pipeline_dir) - self.rocrate_obj.create_rocrate(self.test_pipeline_dir, metadata_path=Path(self.test_pipeline_dir)) + self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir) + assert self.rocrate_obj.create_rocrate(self.pipeline_dir, self.pipeline_dir) # Check that the crate was created - self.assertTrue(Path(self.test_pipeline_dir, "ro-crate-metadata.json").exists()) + self.assertTrue(Path(self.pipeline_dir, "ro-crate-metadata.json").exists()) # Check that the entries in the crate are correct - crate = rocrate.rocrate.ROCrate(self.test_pipeline_dir) + crate = rocrate.rocrate.ROCrate(self.pipeline_dir) entities = crate.get_entities() # Check if the correct entities are set: From 406bdf8bcba91bbd81f72fbab0c47786770193ba Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 09:08:35 +0200 Subject: [PATCH 03/13] run tests without commiting ro-crate --- .github/workflows/create-test-lint-wf-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index 5871919ca..609236096 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -112,9 +112,9 @@ jobs: run: | cd create-test-lint-wf nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml template_skip_${{ matrix.TEMPLATE }}.yml + # fake ro-crate touch my-prefix-testpipeline/ro-crate-metadata.json - git commit -am "add ro-crate" - name: run the pipeline run: | From 94bddc22745dd94ce9d7500e035942b448e83e6b Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 09:16:11 +0200 Subject: [PATCH 04/13] add ro-crate creation to pipelines create command --- .github/workflows/create-test-lint-wf-template.yml | 3 --- nf_core/pipelines/create/create.py | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index 609236096..f6ae34c90 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -113,9 +113,6 @@ jobs: cd create-test-lint-wf nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml template_skip_${{ matrix.TEMPLATE }}.yml - # fake ro-crate - touch my-prefix-testpipeline/ro-crate-metadata.json - - name: run the pipeline run: | cd create-test-lint-wf diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index 8ab547c1c..13f059c7b 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -21,6 +21,7 @@ from nf_core.pipelines.create.utils import CreateConfig, features_yml_path, load_features_yaml from nf_core.pipelines.create_logo import create_logo from nf_core.pipelines.lint_utils import run_prettier_on_file +from nf_core.rocrate import ROCrate from nf_core.utils import LintConfigType, NFCoreTemplateConfig log = logging.getLogger(__name__) @@ -255,6 +256,9 @@ def init_pipeline(self): """Creates the nf-core pipeline.""" # Make the new pipeline self.render_template() + # Create the RO-Crate metadata file + rocrate_obj = ROCrate(self.outdir) + rocrate_obj.create_rocrate(self.outdir, json_path=self.outdir / "ro-crate-metadata.json") # Init the git repository and make the first commit if not self.no_git: From 5c4a5e613b381e2896e1c3266df85683c7ee823d Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 09:20:25 +0200 Subject: [PATCH 05/13] fix command import --- nf_core/pipelines/create/create.py | 2 +- nf_core/pipelines/rocrate.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index 13f059c7b..c9be4e7be 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -21,7 +21,7 @@ from nf_core.pipelines.create.utils import CreateConfig, features_yml_path, load_features_yaml from nf_core.pipelines.create_logo import create_logo from nf_core.pipelines.lint_utils import run_prettier_on_file -from nf_core.rocrate import ROCrate +from nf_core.pipelines.rocrate import ROCrate from nf_core.utils import LintConfigType, NFCoreTemplateConfig log = logging.getLogger(__name__) diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index 04f91480c..1fe0e4cca 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -177,14 +177,14 @@ def make_workflow_rocrate(self) -> None: ) # add readme as description - readme = Path("README.md") + readme = self.pipeline_dir / "README.md" try: self.crate.description = readme.read_text() except FileNotFoundError: log.error(f"Could not find README.md in {self.pipeline_dir}") # get license from LICENSE file - license_file = Path("LICENSE") + license_file = self.pipeline_dir / "LICENSE" try: license = license_file.read_text() if license.startswith("MIT"): From a679a14c8e0eab470939d0fe0b3148057739830b Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 09:55:31 +0200 Subject: [PATCH 06/13] add rocrate to skip features --- nf_core/pipelines/create/create.py | 8 +++++--- nf_core/pipelines/create/template_features.yml | 10 ++++++++++ nf_core/pipelines/rocrate.py | 9 +++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index c9be4e7be..4f6fa1238 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -256,9 +256,6 @@ def init_pipeline(self): """Creates the nf-core pipeline.""" # Make the new pipeline self.render_template() - # Create the RO-Crate metadata file - rocrate_obj = ROCrate(self.outdir) - rocrate_obj.create_rocrate(self.outdir, json_path=self.outdir / "ro-crate-metadata.json") # Init the git repository and make the first commit if not self.no_git: @@ -360,6 +357,11 @@ def render_template(self) -> None: # Make a logo and save it, if it is a nf-core pipeline self.make_pipeline_logo() + if self.config.skip_features is None or "ro-crate" not in self.config.skip_features: + # Create the RO-Crate metadata file + rocrate_obj = ROCrate(self.outdir) + rocrate_obj.create_rocrate(self.outdir, json_path=self.outdir / "ro-crate-metadata.json") + # Update the .nf-core.yml with linting configurations self.fix_linting() diff --git a/nf_core/pipelines/create/template_features.yml b/nf_core/pipelines/create/template_features.yml index 0a3180286..cf1867bff 100644 --- a/nf_core/pipelines/create/template_features.yml +++ b/nf_core/pipelines/create/template_features.yml @@ -432,3 +432,13 @@ seqera_platform: You can extend this file adding any other desired configuration. nfcore_pipelines: False custom_pipelines: True +rocrate: + skippable_paths: + - "ro-crate-metadata.json" + short_description: "Add RO-Crate metadata" + description: "Add a RO-Crate metadata file to describe the pipeline" + help_text: | + RO-Crate is a metadata specification to describe research data and software. + This will add a `ro-crate-metadata.json` file to describe the pipeline. + nfcore_pipelines: False + custom_pipelines: True diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index 1fe0e4cca..388d681eb 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -284,7 +284,9 @@ def add_main_authors(self, wf_file: rocrate.model.entity.Entity) -> None: # look at git contributors for author names try: git_contributors: Set[str] = set() - assert self.pipeline_obj.repo is not None # mypy + if self.pipeline_obj.repo is None: + log.info("No git repository found. No git contributors will be added as authors.") + return commits_touching_path = list(self.pipeline_obj.repo.iter_commits(paths="main.nf")) for commit in commits_touching_path: @@ -324,7 +326,10 @@ def add_main_authors(self, wf_file: rocrate.model.entity.Entity) -> None: for author in named_contributors: log.debug(f"Adding author: {author}") - assert self.pipeline_obj.repo is not None # mypy + + if self.pipeline_obj.repo is None: + log.info("No git repository found. No git contributors will be added as authors.") + return # get email from git log email = self.pipeline_obj.repo.git.log(f"--author={author}", "--pretty=format:%ae", "-1") orcid = get_orcid(author) From d79ba1009b7659734481c0b6e6600056e4596f74 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 10:11:28 +0200 Subject: [PATCH 07/13] remove schema loading, because it is not needed anymore --- nf_core/pipelines/rocrate.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index 388d681eb..d4e605662 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -17,7 +17,6 @@ from rocrate.model.person import Person from rocrate.rocrate import ROCrate as BaseROCrate -from nf_core.pipelines.schema import PipelineSchema from nf_core.utils import Pipeline log = logging.getLogger(__name__) @@ -81,10 +80,6 @@ def __init__(self, pipeline_dir: Path, version="") -> None: self.crate: rocrate.rocrate.ROCrate self.pipeline_obj = Pipeline(self.pipeline_dir) self.pipeline_obj._load() - self.pipeline_obj.schema_obj = PipelineSchema() - # Assume we're in a pipeline dir root if schema path not set - self.pipeline_obj.schema_obj.get_schema_path(self.pipeline_dir) - self.pipeline_obj.schema_obj.load_schema() setup_requests_cachedir() From dfb9283c238b1e83b00c5c35d69f2896c615577d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Thu, 24 Oct 2024 09:06:26 +0000 Subject: [PATCH 08/13] update snapshots --- .../test_customisation_help.svg | 256 +++++++++--------- .../test_create_app/test_type_custom.svg | 254 ++++++++--------- 2 files changed, 255 insertions(+), 255 deletions(-) diff --git a/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg b/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg index 07ab592d2..450f1d303 100644 --- a/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg +++ b/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg @@ -19,257 +19,257 @@ font-weight: 700; } - .terminal-3477423502-matrix { + .terminal-333203530-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3477423502-title { + .terminal-333203530-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3477423502-r1 { fill: #c5c8c6 } -.terminal-3477423502-r2 { fill: #e3e3e3 } -.terminal-3477423502-r3 { fill: #989898 } -.terminal-3477423502-r4 { fill: #e1e1e1 } -.terminal-3477423502-r5 { fill: #4ebf71;font-weight: bold } -.terminal-3477423502-r6 { fill: #1e1e1e } -.terminal-3477423502-r7 { fill: #e2e2e2 } -.terminal-3477423502-r8 { fill: #507bb3 } -.terminal-3477423502-r9 { fill: #808080 } -.terminal-3477423502-r10 { fill: #dde6ed;font-weight: bold } -.terminal-3477423502-r11 { fill: #001541 } -.terminal-3477423502-r12 { fill: #0178d4 } -.terminal-3477423502-r13 { fill: #454a50 } -.terminal-3477423502-r14 { fill: #e2e3e3;font-weight: bold } -.terminal-3477423502-r15 { fill: #000000 } -.terminal-3477423502-r16 { fill: #e4e4e4 } -.terminal-3477423502-r17 { fill: #14191f } -.terminal-3477423502-r18 { fill: #7ae998 } -.terminal-3477423502-r19 { fill: #0a180e;font-weight: bold } -.terminal-3477423502-r20 { fill: #008139 } -.terminal-3477423502-r21 { fill: #fea62b;font-weight: bold } -.terminal-3477423502-r22 { fill: #a7a9ab } -.terminal-3477423502-r23 { fill: #e2e3e3 } + .terminal-333203530-r1 { fill: #c5c8c6 } +.terminal-333203530-r2 { fill: #e3e3e3 } +.terminal-333203530-r3 { fill: #989898 } +.terminal-333203530-r4 { fill: #e1e1e1 } +.terminal-333203530-r5 { fill: #4ebf71;font-weight: bold } +.terminal-333203530-r6 { fill: #1e1e1e } +.terminal-333203530-r7 { fill: #e2e2e2 } +.terminal-333203530-r8 { fill: #507bb3 } +.terminal-333203530-r9 { fill: #808080 } +.terminal-333203530-r10 { fill: #dde6ed;font-weight: bold } +.terminal-333203530-r11 { fill: #001541 } +.terminal-333203530-r12 { fill: #14191f } +.terminal-333203530-r13 { fill: #0178d4 } +.terminal-333203530-r14 { fill: #454a50 } +.terminal-333203530-r15 { fill: #e2e3e3;font-weight: bold } +.terminal-333203530-r16 { fill: #000000 } +.terminal-333203530-r17 { fill: #e4e4e4 } +.terminal-333203530-r18 { fill: #7ae998 } +.terminal-333203530-r19 { fill: #0a180e;font-weight: bold } +.terminal-333203530-r20 { fill: #008139 } +.terminal-333203530-r21 { fill: #fea62b;font-weight: bold } +.terminal-333203530-r22 { fill: #a7a9ab } +.terminal-333203530-r23 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core pipelines create + nf-core pipelines create - + - - nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… - - -Template features - - -▔▔▔▔▔▔▔▔ -        Toggle all features -▁▁▁▁▁▁▁▁ -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use a GitHub Create a GitHub  Show help  -▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -pipeline. - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github CI testsThe pipeline will  Show help  -▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -actions for Continuous -Integration (CI)  -testing - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use reference genomesThe pipeline will be  Hide help  -▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -copy of the most  -common reference  -genome files from  -iGenomes - - -Nf-core pipelines are configured to use a copy of the most common reference  -genome files. - -By selecting this option, your pipeline will include a configuration file  -specifying the paths to these files. - -The required code to use these files will also be included in the template.  -When the pipeline user provides an appropriate genome key, the pipeline will -automatically download the required reference files. -▅▅ -For more information about reference genomes in nf-core pipelines, see the  - - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github badgesThe README.md file of  Show help  -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - Back  Continue  -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - d Toggle dark mode  q Quit  a Toggle all  + + nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… + + +Template features + + +▔▔▔▔▔▔▔▔ +        Toggle all features +▁▁▁▁▁▁▁▁ +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use a GitHub Create a GitHub  Show help  +▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +pipeline. + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github CI testsThe pipeline will  Show help  +▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +actions for Continuous▃▃ +Integration (CI)  +testing + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use reference genomesThe pipeline will be  Hide help  +▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +copy of the most  +common reference  +genome files from  +iGenomes + + +Nf-core pipelines are configured to use a copy of the most common reference  +genome files. + +By selecting this option, your pipeline will include a configuration file  +specifying the paths to these files. + +The required code to use these files will also be included in the template.  +When the pipeline user provides an appropriate genome key, the pipeline will +automatically download the required reference files. +▅▅ +For more information about reference genomes in nf-core pipelines, see the  + + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github badgesThe README.md file of  Show help  +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + Back  Continue  +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + d Toggle dark mode  q Quit  a Toggle all  diff --git a/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg b/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg index cc34c9253..6e178ba84 100644 --- a/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg +++ b/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg @@ -19,256 +19,256 @@ font-weight: 700; } - .terminal-829252251-matrix { + .terminal-3425198753-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-829252251-title { + .terminal-3425198753-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-829252251-r1 { fill: #c5c8c6 } -.terminal-829252251-r2 { fill: #e3e3e3 } -.terminal-829252251-r3 { fill: #989898 } -.terminal-829252251-r4 { fill: #e1e1e1 } -.terminal-829252251-r5 { fill: #4ebf71;font-weight: bold } -.terminal-829252251-r6 { fill: #1e1e1e } -.terminal-829252251-r7 { fill: #0178d4 } -.terminal-829252251-r8 { fill: #e2e2e2 } -.terminal-829252251-r9 { fill: #507bb3 } -.terminal-829252251-r10 { fill: #808080 } -.terminal-829252251-r11 { fill: #dde6ed;font-weight: bold } -.terminal-829252251-r12 { fill: #001541 } -.terminal-829252251-r13 { fill: #14191f } -.terminal-829252251-r14 { fill: #454a50 } -.terminal-829252251-r15 { fill: #7ae998 } -.terminal-829252251-r16 { fill: #e2e3e3;font-weight: bold } -.terminal-829252251-r17 { fill: #0a180e;font-weight: bold } -.terminal-829252251-r18 { fill: #000000 } -.terminal-829252251-r19 { fill: #008139 } -.terminal-829252251-r20 { fill: #fea62b;font-weight: bold } -.terminal-829252251-r21 { fill: #a7a9ab } -.terminal-829252251-r22 { fill: #e2e3e3 } + .terminal-3425198753-r1 { fill: #c5c8c6 } +.terminal-3425198753-r2 { fill: #e3e3e3 } +.terminal-3425198753-r3 { fill: #989898 } +.terminal-3425198753-r4 { fill: #e1e1e1 } +.terminal-3425198753-r5 { fill: #4ebf71;font-weight: bold } +.terminal-3425198753-r6 { fill: #1e1e1e } +.terminal-3425198753-r7 { fill: #0178d4 } +.terminal-3425198753-r8 { fill: #e2e2e2 } +.terminal-3425198753-r9 { fill: #507bb3 } +.terminal-3425198753-r10 { fill: #808080 } +.terminal-3425198753-r11 { fill: #dde6ed;font-weight: bold } +.terminal-3425198753-r12 { fill: #001541 } +.terminal-3425198753-r13 { fill: #14191f } +.terminal-3425198753-r14 { fill: #454a50 } +.terminal-3425198753-r15 { fill: #7ae998 } +.terminal-3425198753-r16 { fill: #e2e3e3;font-weight: bold } +.terminal-3425198753-r17 { fill: #0a180e;font-weight: bold } +.terminal-3425198753-r18 { fill: #000000 } +.terminal-3425198753-r19 { fill: #008139 } +.terminal-3425198753-r20 { fill: #fea62b;font-weight: bold } +.terminal-3425198753-r21 { fill: #a7a9ab } +.terminal-3425198753-r22 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core pipelines create + nf-core pipelines create - + - - nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… - - -Template features - - -▔▔▔▔▔▔▔▔ -        Toggle all features -▁▁▁▁▁▁▁▁ -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use a GitHub Create a GitHub  Show help  -▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -pipeline. - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github CI testsThe pipeline will  Show help  -▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -actions for Continuous -Integration (CI) ▁▁ -testing - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use reference genomesThe pipeline will be  Show help  -▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -copy of the most  -common reference  -genome files from  -iGenomes - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github badgesThe README.md file of  Show help  -▁▁▁▁▁▁▁▁the pipeline will ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -include GitHub badges - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add configuration The pipeline will  Show help  -▁▁▁▁▁▁▁▁        filesinclude configuration ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -profiles containing  -custom parameters  -required to run  -nf-core pipelines at  -different institutions - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use code lintersThe pipeline will  Show help  -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - Back  Continue  -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - d Toggle dark mode  q Quit  a Toggle all  + + nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… + + +Template features + + +▔▔▔▔▔▔▔▔ +        Toggle all features +▁▁▁▁▁▁▁▁ +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use a GitHub Create a GitHub  Show help  +▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +pipeline. + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github CI testsThe pipeline will  Show help  +▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +actions for Continuous +Integration (CI) ▄▄ +testing + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use reference genomesThe pipeline will be  Show help  +▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +copy of the most  +common reference  +genome files from  +iGenomes + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github badgesThe README.md file of  Show help  +▁▁▁▁▁▁▁▁the pipeline will ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +include GitHub badges + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add configuration The pipeline will  Show help  +▁▁▁▁▁▁▁▁        filesinclude configuration ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +profiles containing  +custom parameters  +required to run  +nf-core pipelines at  +different institutions + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use code lintersThe pipeline will  Show help  +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + Back  Continue  +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + d Toggle dark mode  q Quit  a Toggle all  From 2696940ee2a86a79c6aa6d210a2a0a0e129766fd Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 12:22:48 +0200 Subject: [PATCH 09/13] try to fix coverage report generation --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a29a6970e..7d8d3ea6f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -132,7 +132,7 @@ jobs: - name: Test with pytest run: | - python3 -m pytest tests/${{matrix.test}} --color=yes --cov --durations=0 && exit_code=0|| exit_code=$? + python3 -m pytest tests/${{matrix.test}} --color=yes --cov --cov-config=.coveragerc --durations=0 && exit_code=0|| exit_code=$? # don't fail if no tests were collected, e.g. for test_licence.py if [ "${exit_code}" -eq 5 ]; then echo "No tests were collected" From af1a1be117dd04258bc184f75cefa7c4ca48dcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Wed, 27 Nov 2024 15:42:15 +0000 Subject: [PATCH 10/13] update snapshots --- .../test_customisation_help.svg | 256 +++++++++--------- .../test_create_app/test_type_custom.svg | 254 ++++++++--------- 2 files changed, 255 insertions(+), 255 deletions(-) diff --git a/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg b/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg index 450f1d303..c34bd8523 100644 --- a/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg +++ b/tests/pipelines/__snapshots__/test_create_app/test_customisation_help.svg @@ -19,257 +19,257 @@ font-weight: 700; } - .terminal-333203530-matrix { + .terminal-4061415502-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-333203530-title { + .terminal-4061415502-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-333203530-r1 { fill: #c5c8c6 } -.terminal-333203530-r2 { fill: #e3e3e3 } -.terminal-333203530-r3 { fill: #989898 } -.terminal-333203530-r4 { fill: #e1e1e1 } -.terminal-333203530-r5 { fill: #4ebf71;font-weight: bold } -.terminal-333203530-r6 { fill: #1e1e1e } -.terminal-333203530-r7 { fill: #e2e2e2 } -.terminal-333203530-r8 { fill: #507bb3 } -.terminal-333203530-r9 { fill: #808080 } -.terminal-333203530-r10 { fill: #dde6ed;font-weight: bold } -.terminal-333203530-r11 { fill: #001541 } -.terminal-333203530-r12 { fill: #14191f } -.terminal-333203530-r13 { fill: #0178d4 } -.terminal-333203530-r14 { fill: #454a50 } -.terminal-333203530-r15 { fill: #e2e3e3;font-weight: bold } -.terminal-333203530-r16 { fill: #000000 } -.terminal-333203530-r17 { fill: #e4e4e4 } -.terminal-333203530-r18 { fill: #7ae998 } -.terminal-333203530-r19 { fill: #0a180e;font-weight: bold } -.terminal-333203530-r20 { fill: #008139 } -.terminal-333203530-r21 { fill: #fea62b;font-weight: bold } -.terminal-333203530-r22 { fill: #a7a9ab } -.terminal-333203530-r23 { fill: #e2e3e3 } + .terminal-4061415502-r1 { fill: #c5c8c6 } +.terminal-4061415502-r2 { fill: #e3e3e3 } +.terminal-4061415502-r3 { fill: #989898 } +.terminal-4061415502-r4 { fill: #e1e1e1 } +.terminal-4061415502-r5 { fill: #4ebf71;font-weight: bold } +.terminal-4061415502-r6 { fill: #1e1e1e } +.terminal-4061415502-r7 { fill: #e2e2e2 } +.terminal-4061415502-r8 { fill: #507bb3 } +.terminal-4061415502-r9 { fill: #808080 } +.terminal-4061415502-r10 { fill: #dde6ed;font-weight: bold } +.terminal-4061415502-r11 { fill: #001541 } +.terminal-4061415502-r12 { fill: #14191f } +.terminal-4061415502-r13 { fill: #0178d4 } +.terminal-4061415502-r14 { fill: #454a50 } +.terminal-4061415502-r15 { fill: #e2e3e3;font-weight: bold } +.terminal-4061415502-r16 { fill: #000000 } +.terminal-4061415502-r17 { fill: #e4e4e4 } +.terminal-4061415502-r18 { fill: #7ae998 } +.terminal-4061415502-r19 { fill: #0a180e;font-weight: bold } +.terminal-4061415502-r20 { fill: #008139 } +.terminal-4061415502-r21 { fill: #fea62b;font-weight: bold } +.terminal-4061415502-r22 { fill: #a7a9ab } +.terminal-4061415502-r23 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core pipelines create + nf-core pipelines create - + - - nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… - - -Template features - - -▔▔▔▔▔▔▔▔ -        Toggle all features -▁▁▁▁▁▁▁▁ -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use a GitHub Create a GitHub  Show help  -▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -pipeline. - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github CI testsThe pipeline will  Show help  -▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -actions for Continuous▃▃ -Integration (CI)  -testing - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use reference genomesThe pipeline will be  Hide help  -▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -copy of the most  -common reference  -genome files from  -iGenomes - - -Nf-core pipelines are configured to use a copy of the most common reference  -genome files. - -By selecting this option, your pipeline will include a configuration file  -specifying the paths to these files. - -The required code to use these files will also be included in the template.  -When the pipeline user provides an appropriate genome key, the pipeline will -automatically download the required reference files. -▅▅ -For more information about reference genomes in nf-core pipelines, see the  - - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github badgesThe README.md file of  Show help  -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - Back  Continue  -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - d Toggle dark mode  q Quit  a Toggle all  + + nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… + + +Template features + + +▔▔▔▔▔▔▔▔ +        Toggle all features +▁▁▁▁▁▁▁▁ +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use a GitHub Create a GitHub  Show help  +▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +pipeline. + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github CI testsThe pipeline will  Show help  +▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +actions for Continuous▅▅ +Integration (CI)  +testing + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use reference genomesThe pipeline will be  Hide help  +▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +copy of the most  +common reference  +genome files from  +iGenomes + + +Nf-core pipelines are configured to use a copy of the most common reference  +genome files. + +By selecting this option, your pipeline will include a configuration file  +specifying the paths to these files. + +The required code to use these files will also be included in the template.  +When the pipeline user provides an appropriate genome key, the pipeline will +automatically download the required reference files. +▅▅ +For more information about reference genomes in nf-core pipelines, see the  + + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github badgesThe README.md file of  Show help  +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + Back  Continue  +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + d Toggle dark mode  q Quit  a Toggle all  diff --git a/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg b/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg index 6e178ba84..b8dea0560 100644 --- a/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg +++ b/tests/pipelines/__snapshots__/test_create_app/test_type_custom.svg @@ -19,256 +19,256 @@ font-weight: 700; } - .terminal-3425198753-matrix { + .terminal-1727160999-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3425198753-title { + .terminal-1727160999-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3425198753-r1 { fill: #c5c8c6 } -.terminal-3425198753-r2 { fill: #e3e3e3 } -.terminal-3425198753-r3 { fill: #989898 } -.terminal-3425198753-r4 { fill: #e1e1e1 } -.terminal-3425198753-r5 { fill: #4ebf71;font-weight: bold } -.terminal-3425198753-r6 { fill: #1e1e1e } -.terminal-3425198753-r7 { fill: #0178d4 } -.terminal-3425198753-r8 { fill: #e2e2e2 } -.terminal-3425198753-r9 { fill: #507bb3 } -.terminal-3425198753-r10 { fill: #808080 } -.terminal-3425198753-r11 { fill: #dde6ed;font-weight: bold } -.terminal-3425198753-r12 { fill: #001541 } -.terminal-3425198753-r13 { fill: #14191f } -.terminal-3425198753-r14 { fill: #454a50 } -.terminal-3425198753-r15 { fill: #7ae998 } -.terminal-3425198753-r16 { fill: #e2e3e3;font-weight: bold } -.terminal-3425198753-r17 { fill: #0a180e;font-weight: bold } -.terminal-3425198753-r18 { fill: #000000 } -.terminal-3425198753-r19 { fill: #008139 } -.terminal-3425198753-r20 { fill: #fea62b;font-weight: bold } -.terminal-3425198753-r21 { fill: #a7a9ab } -.terminal-3425198753-r22 { fill: #e2e3e3 } + .terminal-1727160999-r1 { fill: #c5c8c6 } +.terminal-1727160999-r2 { fill: #e3e3e3 } +.terminal-1727160999-r3 { fill: #989898 } +.terminal-1727160999-r4 { fill: #e1e1e1 } +.terminal-1727160999-r5 { fill: #4ebf71;font-weight: bold } +.terminal-1727160999-r6 { fill: #1e1e1e } +.terminal-1727160999-r7 { fill: #0178d4 } +.terminal-1727160999-r8 { fill: #e2e2e2 } +.terminal-1727160999-r9 { fill: #507bb3 } +.terminal-1727160999-r10 { fill: #808080 } +.terminal-1727160999-r11 { fill: #dde6ed;font-weight: bold } +.terminal-1727160999-r12 { fill: #001541 } +.terminal-1727160999-r13 { fill: #14191f } +.terminal-1727160999-r14 { fill: #454a50 } +.terminal-1727160999-r15 { fill: #7ae998 } +.terminal-1727160999-r16 { fill: #e2e3e3;font-weight: bold } +.terminal-1727160999-r17 { fill: #0a180e;font-weight: bold } +.terminal-1727160999-r18 { fill: #000000 } +.terminal-1727160999-r19 { fill: #008139 } +.terminal-1727160999-r20 { fill: #fea62b;font-weight: bold } +.terminal-1727160999-r21 { fill: #a7a9ab } +.terminal-1727160999-r22 { fill: #e2e3e3 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - nf-core pipelines create + nf-core pipelines create - + - - nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… - - -Template features - - -▔▔▔▔▔▔▔▔ -        Toggle all features -▁▁▁▁▁▁▁▁ -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use a GitHub Create a GitHub  Show help  -▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -pipeline. - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github CI testsThe pipeline will  Show help  -▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -actions for Continuous -Integration (CI) ▄▄ -testing - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use reference genomesThe pipeline will be  Show help  -▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -copy of the most  -common reference  -genome files from  -iGenomes - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add Github badgesThe README.md file of  Show help  -▁▁▁▁▁▁▁▁the pipeline will ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -include GitHub badges - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Add configuration The pipeline will  Show help  -▁▁▁▁▁▁▁▁        filesinclude configuration ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -profiles containing  -custom parameters  -required to run  -nf-core pipelines at  -different institutions - -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -        Use code lintersThe pipeline will  Show help  -▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - Back  Continue  -▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - - d Toggle dark mode  q Quit  a Toggle all  + + nf-core pipelines create — Create a new pipeline with the nf-core pipeline templa… + + +Template features + + +▔▔▔▔▔▔▔▔ +        Toggle all features +▁▁▁▁▁▁▁▁ +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use a GitHub Create a GitHub  Show help  +▁▁▁▁▁▁▁▁        repository.repository for the ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +pipeline. + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github CI testsThe pipeline will  Show help  +▁▁▁▁▁▁▁▁include several GitHub▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +actions for Continuous +Integration (CI) ▇▇ +testing + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use reference genomesThe pipeline will be  Show help  +▁▁▁▁▁▁▁▁configured to use a ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +copy of the most  +common reference  +genome files from  +iGenomes + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add Github badgesThe README.md file of  Show help  +▁▁▁▁▁▁▁▁the pipeline will ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +include GitHub badges + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Add configuration The pipeline will  Show help  +▁▁▁▁▁▁▁▁        filesinclude configuration ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ +profiles containing  +custom parameters  +required to run  +nf-core pipelines at  +different institutions + +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +        Use code lintersThe pipeline will  Show help  +▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + Back  Continue  +▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + + d Toggle dark mode  q Quit  a Toggle all  From d48b3004b04ba001af022d47485e1f11bc5429c7 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 27 Nov 2024 18:42:54 +0100 Subject: [PATCH 11/13] add more tests --- nf_core/commands_pipelines.py | 2 +- nf_core/pipelines/create/create.py | 2 +- nf_core/pipelines/rocrate.py | 24 +----------- tests/pipelines/test_rocrate.py | 63 +++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 26 deletions(-) diff --git a/nf_core/commands_pipelines.py b/nf_core/commands_pipelines.py index 9699dc53a..3b28f4979 100644 --- a/nf_core/commands_pipelines.py +++ b/nf_core/commands_pipelines.py @@ -299,7 +299,7 @@ def pipelines_rocrate( zip_path = Path(zip_path) try: rocrate_obj = ROCrate(pipeline_dir, pipeline_version) - rocrate_obj.create_rocrate(pipeline_dir, json_path=json_path, zip_path=zip_path) + rocrate_obj.create_rocrate(json_path=json_path, zip_path=zip_path) except (UserWarning, LookupError, FileNotFoundError) as e: log.error(e) sys.exit(1) diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index 4f6fa1238..dba0a40ca 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -360,7 +360,7 @@ def render_template(self) -> None: if self.config.skip_features is None or "ro-crate" not in self.config.skip_features: # Create the RO-Crate metadata file rocrate_obj = ROCrate(self.outdir) - rocrate_obj.create_rocrate(self.outdir, json_path=self.outdir / "ro-crate-metadata.json") + rocrate_obj.create_rocrate(json_path=self.outdir / "ro-crate-metadata.json") # Update the .nf-core.yml with linting configurations self.fix_linting() diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index d4e605662..d5a51eddf 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -83,9 +83,7 @@ def __init__(self, pipeline_dir: Path, version="") -> None: setup_requests_cachedir() - def create_rocrate( - self, outdir: Path, json_path: Union[None, Path] = None, zip_path: Union[None, Path] = None - ) -> bool: + def create_rocrate(self, json_path: Union[None, Path] = None, zip_path: Union[None, Path] = None) -> bool: """ Create an RO Crate for a pipeline @@ -95,12 +93,6 @@ def create_rocrate( zip_path (Path): Path to the zip file """ - # Set input paths - try: - self.set_crate_paths(outdir) - except OSError as e: - log.error(e) - sys.exit(1) # Check that the checkout pipeline version is the same as the requested version if self.version != "": @@ -337,20 +329,6 @@ def add_main_authors(self, wf_file: rocrate.model.entity.Entity) -> None: if author in authors: wf_file.append_to("maintainer", author_entitity) - def set_crate_paths(self, path: Path) -> None: - """Given a pipeline name, directory, or path, set wf_crate_filename""" - - if path.is_dir(): - self.pipeline_dir = path - # wf_crate_filename = path / "ro-crate-metadata.json" - elif path.is_file(): - self.pipeline_dir = path.parent - # wf_crate_filename = path - - # Check that the schema file exists - if self.pipeline_dir is None: - raise OSError(f"Could not find pipeline '{path}'") - def get_orcid(name: str) -> Optional[str]: """ diff --git a/tests/pipelines/test_rocrate.py b/tests/pipelines/test_rocrate.py index 2e14878da..01a77ecd7 100644 --- a/tests/pipelines/test_rocrate.py +++ b/tests/pipelines/test_rocrate.py @@ -1,8 +1,10 @@ """Test the nf-core pipelines rocrate command""" import shutil +import tempfile from pathlib import Path +import git import rocrate.rocrate from git import Repo @@ -25,6 +27,7 @@ def setUp(self) -> None: repo = Repo(self.pipeline_dir) repo.git.add(A=True) repo.index.commit("Initial commit") + self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir) def tearDown(self): """Clean up temporary files and folders""" @@ -36,7 +39,7 @@ def test_rocrate_creation(self): """Run the nf-core rocrate command""" # Run the command - self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir) + self.rocrate_obj assert self.rocrate_obj.create_rocrate(self.pipeline_dir, self.pipeline_dir) # Check that the crate was created @@ -64,3 +67,61 @@ def test_rocrate_creation(self): # check that it is set as author of the main entity if crate.mainEntity is not None: self.assertEqual(crate.mainEntity["author"][0].id, entity_json["@id"]) + + def test_rocrate_creation_wrong_pipeline_dir(self): + """Run the nf-core rocrate command with a wrong pipeline directory""" + # Run the command + + # Check that it raises a UserWarning + with self.assertRaises(UserWarning): + nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir / "bad_dir") + + # assert that the crate was not created + self.assertFalse(Path(self.pipeline_dir / "bad_dir", "ro-crate-metadata.json").exists()) + + def test_rocrate_creation_with_wrong_version(self): + """Run the nf-core rocrate command with a pipeline version""" + # Run the command + + self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir, version="1.0.0") + + # Check that the crate was created + with self.assertRaises(SystemExit): + assert self.rocrate_obj.create_rocrate(self.pipeline_dir, self.pipeline_dir) + + def test_rocrate_creation_without_git(self): + """Run the nf-core rocrate command with a pipeline version""" + + self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(self.pipeline_dir, version="1.0.0") + # remove git repo + shutil.rmtree(self.pipeline_dir / ".git") + # Check that the crate was created + with self.assertRaises(SystemExit): + assert self.rocrate_obj.create_rocrate(self.pipeline_dir, self.pipeline_dir) + + def test_rocrate_creation_to_zip(self): + """Run the nf-core rocrate command with a zip output""" + assert self.rocrate_obj.create_rocrate(self.pipeline_dir, zip_path=self.pipeline_dir) + # Check that the crate was created + self.assertTrue(Path(self.pipeline_dir, "ro-crate.crate.zip").exists()) + + def test_rocrate_creation_for_fetchngs(self): + """Run the nf-core rocrate command with nf-core/fetchngs""" + tmp_dir = Path(tempfile.mkdtemp()) + # git clone nf-core/fetchngs + git.Repo.clone_from("https://github.com/nf-core/fetchngs", tmp_dir / "fetchngs") + # Run the command + self.rocrate_obj = nf_core.pipelines.rocrate.ROCrate(tmp_dir / "fetchngs", version="1.12.0") + assert self.rocrate_obj.create_rocrate(tmp_dir / "fetchngs", self.pipeline_dir) + + # Check that Sateesh Peri is mentioned in creator field + + crate = rocrate.rocrate.ROCrate(self.pipeline_dir) + entities = crate.get_entities() + for entity in entities: + entity_json = entity.as_jsonld() + if entity_json["@id"] == "#main.nf": + assert "https://orcid.org/0000-0002-9879-9070" in entity_json["creator"] + + # Clean up + shutil.rmtree(tmp_dir) From 65d74d58210f6f509207967ee5e888a3c14597ab Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 27 Nov 2024 23:15:32 +0100 Subject: [PATCH 12/13] enable zip output --- nf_core/pipelines/rocrate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nf_core/pipelines/rocrate.py b/nf_core/pipelines/rocrate.py index d5a51eddf..915f203f0 100644 --- a/nf_core/pipelines/rocrate.py +++ b/nf_core/pipelines/rocrate.py @@ -122,7 +122,6 @@ def create_rocrate(self, json_path: Union[None, Path] = None, zip_path: Union[No log.info(f"Saving metadata file to '{json_path}'") self.crate.metadata.write(json_path) - return True # Save the whole crate zip file if zip_path is not None: @@ -130,11 +129,13 @@ def create_rocrate(self, json_path: Union[None, Path] = None, zip_path: Union[No zip_path = zip_path / "ro-crate.crate.zip" log.info(f"Saving zip file '{zip_path}") self.crate.write_zip(zip_path) - return True + if json_path is None and zip_path is None: log.error("Please provide a path to save the ro-crate file or the zip file.") return False + return True + def make_workflow_rocrate(self) -> None: """ Create an RO Crate for a pipeline From 43287c654f41e8e7dcae44be6f21215174ae61b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Thu, 28 Nov 2024 14:32:30 +0100 Subject: [PATCH 13/13] Update nf_core/pipelines/create/template_features.yml --- nf_core/pipelines/create/template_features.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nf_core/pipelines/create/template_features.yml b/nf_core/pipelines/create/template_features.yml index e2293567e..9841879e8 100644 --- a/nf_core/pipelines/create/template_features.yml +++ b/nf_core/pipelines/create/template_features.yml @@ -442,6 +442,9 @@ rocrate: This will add a `ro-crate-metadata.json` file to describe the pipeline. nfcore_pipelines: False custom_pipelines: True + linting: + files_warn: + - "ro-crate-metadata.json" vscode: skippable_paths: - ".vscode"