diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a993e26aa..9db67cb0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - `nextflow run --version` will now print the workflow version from the manifest and exit ([#1951](https://github.com/nf-core/tools/pull/1951)) - Add profile for running `docker` with the ARM chips (including Apple silicon) ([#1942](https://github.com/nf-core/tools/pull/1942) and [#2034](https://github.com/nf-core/tools/pull/2034)) - Flip execution order of parameter summary printing and parameter validation to prevent 'hiding' of parameter errors. +- Remove `CITATION.cff` file from pipeline template, to avoid that pipeline Zenodo entries reference the nf-core publication instead of the pipeline. ### Linting diff --git a/nf_core/components/install.py b/nf_core/components/install.py index 2d4a1b19df..f9a16f73cf 100644 --- a/nf_core/components/install.py +++ b/nf_core/components/install.py @@ -127,14 +127,14 @@ def install(self, component, silent=False): log.info(f"Use the following statement to include this {self.component_type[:-1]}:") Console().print( Syntax( - f"include {{ {component_name} }} from '.{os.path.join(install_folder, component)}/main'", + f"include {{ {component_name} }} from '../{Path(install_folder, component).relative_to(self.dir)}/main'", "groovy", theme="ansi_dark", padding=1, ) ) if self.component_type == "subworkflows": - subworkflow_config = os.path.join(install_folder, component, "nextflow.config") + subworkflow_config = Path(install_folder, component, "nextflow.config").relative_to(self.dir) if os.path.isfile(subworkflow_config): log.info("Add the following config statement to use this subworkflow:") Console().print( diff --git a/nf_core/components/remove.py b/nf_core/components/remove.py index 6fe59b6984..0916d56e85 100644 --- a/nf_core/components/remove.py +++ b/nf_core/components/remove.py @@ -19,13 +19,16 @@ class ComponentRemove(ComponentCommand): def __init__(self, component_type, pipeline_dir, remote_url=None, branch=None, no_pull=False): super().__init__(component_type, pipeline_dir, remote_url, branch, no_pull) - def remove(self, component, removed_by=None, force=False): + def remove(self, component, removed_by=None, removed_components=None, force=False): """ Remove an already installed module/subworkflow This command only works for modules/subworkflows that are installed from 'nf-core/modules' Args: component (str): Name of the component to remove + removed_by (str): Name of the component that is removing the current component + (a subworkflow name if the component is a dependency or "modules" or "subworkflows" if it is not a dependency) + removed_components (list[str]): list of components that have been removed during a recursive remove of subworkflows force (bool): Force removal of component, even if there is still an include statement in a workflow file Returns: @@ -51,6 +54,9 @@ def remove(self, component, removed_by=None, force=False): style=nf_core.utils.nfcore_question_style, ).unsafe_ask() + if removed_components is None: + removed_components = [] + # Get the module/subworkflow directory component_dir = Path(self.dir, self.component_type, repo_path, component) @@ -85,7 +91,7 @@ def remove(self, component, removed_by=None, force=False): include_stmts = self.check_if_in_include_stmts(str(removed_component_dir)) if include_stmts: # print the include statements - log.warn( + log.warning( f"The {self.component_type[:-1]} '{component}' is still included in the following workflow file{nf_core.utils.plural_s(include_stmts)}:" ) console = Console() @@ -120,14 +126,16 @@ def remove(self, component, removed_by=None, force=False): if not ComponentInstall(self.dir, self.component_type, force=True).install( component, silent=True ): - log.warn( + log.warning( f"Could not install the {self.component_type[:-1]} '{component}', please install it manually with 'nf-core {component_type} install {component}'." ) + removed_components.append(component) return removed # Remove the component files of all entries removed from modules.json removed = ( True if self.clear_component_dir(component, Path(self.dir, removed_component_dir)) or removed else False ) + removed_components.append(component) if removed: if self.component_type == "subworkflows": @@ -136,10 +144,14 @@ def remove(self, component, removed_by=None, force=False): self.component_type, component, self.modules_repo.remote_url, repo_path, {} ) for component_name, component_type in dependent_components.items(): - original_component_tyoe = self.component_type + if component_name in removed_components: + continue + original_component_type = self.component_type self.component_type = component_type - dependency_removed = self.remove(component_name, removed_by=removed_by) - self.component_type = original_component_tyoe + dependency_removed = self.remove( + component_name, removed_by=removed_by, removed_components=removed_components + ) + self.component_type = original_component_type # remember removed dependencies if dependency_removed: removed_components.append(component_name.replace("/", "_")) @@ -154,9 +166,9 @@ def remove(self, component, removed_by=None, force=False): ][component]["installed_by"] if installed_by == self.component_type: log.error( - f"Did not remove '{component}', because it was also manually installed. Only updated 'installed_by' in modules.json." + f"Did not remove '{component}', because it was also manually installed. Only updated 'installed_by' entry in modules.json." ) log.info( - f"""Did not remove {self.component_type[:-1]} '{component}', because it was also installed by {', '.join(f"'{d}'" for d in installed_by)}.""" + f"""Did not remove {self.component_type[:-1]} '{component}', because it was also installed by {', '.join(f"'{d}'" for d in installed_by)}. Only updated the 'installed_by' entry in modules.json.""" ) return removed diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py index beb6d61adc..855a1adf66 100644 --- a/nf_core/modules/modules_json.py +++ b/nf_core/modules/modules_json.py @@ -705,15 +705,6 @@ def remove_entry(self, component_type, name, repo_url, install_dir, removed_by=N # write the updated modules.json file self.dump() return True - # write the updated modules.json file - if removed_by == component_type: - log.info( - f"""Updated the 'installed_by' list for '{name}', but it is still installed, because it is required by {", ".join(f"'{d}'" for d in repo_entry[component_type][install_dir][name]['installed_by'])}.""" - ) - else: - log.info( - f"Removed {removed_by} from the 'installed_by' list of {name}, but it was also installed by other modules/subworkflows." - ) self.dump() return False else: diff --git a/nf_core/pipeline-template/CITATION.cff b/nf_core/pipeline-template/CITATION.cff deleted file mode 100644 index 017666c018..0000000000 --- a/nf_core/pipeline-template/CITATION.cff +++ /dev/null @@ -1,56 +0,0 @@ -cff-version: 1.2.0 -message: "If you use `nf-core tools` in your work, please cite the `nf-core` publication" -authors: - - family-names: Ewels - given-names: Philip - - family-names: Peltzer - given-names: Alexander - - family-names: Fillinger - given-names: Sven - - family-names: Patel - given-names: Harshil - - family-names: Alneberg - given-names: Johannes - - family-names: Wilm - given-names: Andreas - - family-names: Garcia - given-names: Maxime Ulysse - - family-names: Di Tommaso - given-names: Paolo - - family-names: Nahnsen - given-names: Sven -title: "The nf-core framework for community-curated bioinformatics pipelines." -version: 2.4.1 -doi: 10.1038/s41587-020-0439-x -date-released: 2022-05-16 -url: https://github.com/nf-core/tools -prefered-citation: - type: article - authors: - - family-names: Ewels - given-names: Philip - - family-names: Peltzer - given-names: Alexander - - family-names: Fillinger - given-names: Sven - - family-names: Patel - given-names: Harshil - - family-names: Alneberg - given-names: Johannes - - family-names: Wilm - given-names: Andreas - - family-names: Garcia - given-names: Maxime Ulysse - - family-names: Di Tommaso - given-names: Paolo - - family-names: Nahnsen - given-names: Sven - doi: 10.1038/s41587-020-0439-x - journal: nature biotechnology - start: 276 - end: 278 - title: "The nf-core framework for community-curated bioinformatics pipelines." - issue: 3 - volume: 38 - year: 2020 - url: https://dx.doi.org/10.1038/s41587-020-0439-x diff --git a/nf_core/utils.py b/nf_core/utils.py index 728ba6d9d7..b2431b3337 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -965,13 +965,13 @@ def load_tools_config(directory="."): def determine_base_dir(directory="."): - base_dir = Path(directory).absolute() + base_dir = start_dir = Path(directory).absolute() while not get_first_available_path(base_dir, CONFIG_PATHS) and base_dir != base_dir.parent: base_dir = base_dir.parent config_fn = get_first_available_path(base_dir, CONFIG_PATHS) if config_fn: break - return base_dir + return directory if base_dir == start_dir else base_dir def get_first_available_path(directory, paths):