Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowing new line before description field #2177

Merged
merged 7 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@

- Turn on automatic clean up of intermediate files in `work/` on successful pipeline completion in full-test config ([#2163](https://github.com/nf-core/tools/pull/2163)) [Contributed by @jfy133]
- Add documentation to `usage.md` on how to use `params.yml` files, based on nf-core/ampliseq text ([#2173](https://github.com/nf-core/tools/pull/2173/)) [Contributed by @jfy133, @d4straub]
- Make jobs automatically resubmit for a much wider range of exit codes (now `104` and `130..145`)
- Make jobs automatically resubmit for a much wider range of exit codes (now `104` and `130..145`) ([#2170](https://github.com/nf-core/tools/pull/2170))

### Linting

### Modules

- Add an `--empty-template` option to create a module without TODO statements or examples ([#2175](https://github.com/nf-core/tools/pull/2175))
- Add an `--empty-template` option to create a module without TODO statements or examples ([#2175](https://github.com/nf-core/tools/pull/2175) & [#2177](https://github.com/nf-core/tools/pull/2177))

### Subworkflows

- Fixing problem when a module included in a subworkflow had a name change from TOOL to TOOL/SUBTOOL ([#2177](https://github.com/nf-core/tools/pull/2177))

### General

## [v2.7.2 - Mercury Eagle Patch](https://github.com/nf-core/tools/releases/tag/2.7.2) - [2022-12-19]
Expand Down
6 changes: 3 additions & 3 deletions nf_core/components/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ def collect_and_verify_name(self, component, modules_repo):
if component is None:
component = questionary.autocomplete(
f"{'Tool' if self.component_type == 'modules' else 'Subworkflow'} name:",
choices=sorted(modules_repo.get_avail_components(self.component_type)),
choices=sorted(modules_repo.get_avail_components(self.component_type, commit=self.sha)),
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()

# Check that the supplied name is an available module/subworkflow
if component and component not in modules_repo.get_avail_components(self.component_type):
if component and component not in modules_repo.get_avail_components(self.component_type, commit=self.sha):
log.error(
f"{self.component_type[:-1].title()} '{component}' not found in list of available {self.component_type}."
)
log.info(f"Use the command 'nf-core {self.component_type} list' to view available software")
return False

if not modules_repo.component_exists(component, self.component_type):
if not modules_repo.component_exists(component, self.component_type, commit=self.sha):
warn_msg = f"{self.component_type[:-1].title()} '{component}' not found in remote '{modules_repo.remote_url}' ({modules_repo.branch})"
log.warning(warn_msg)
return False
Expand Down
37 changes: 23 additions & 14 deletions nf_core/components/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def get_single_component_info(self, component):
)

# Check that the supplied name is an available module/subworkflow
if component and component not in self.modules_repo.get_avail_components(self.component_type):
if component and component not in self.modules_repo.get_avail_components(self.component_type, commit=self.sha):
raise LookupError(
f"{self.component_type[:-1].title()} '{component}' not found in list of available {self.component_type}."
f"Use the command 'nf-core {self.component_type} list remote' to view available software"
Expand Down Expand Up @@ -879,25 +879,23 @@ def update_linked_components(self, modules_to_update, subworkflows_to_update, up
if m_update in updated:
continue
original_component_type, original_update_all = self._change_component_type("modules")
self.update(m_update, silent=True, updated=updated, check_diff_exist=check_diff_exist)
self._reset_component_type(original_component_type, original_update_all)
try:
self.update(m_update, silent=True, updated=updated, check_diff_exist=check_diff_exist)
except LookupError as e:
# If the module to be updated is not available, check if there has been a name change
if "not found in list of available" in str(e):
# Skip update, we check for name changes with manage_changes_in_linked_components in line #261
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
pass
else:
raise
finally:
self._reset_component_type(original_component_type, original_update_all)

def manage_changes_in_linked_components(self, component, modules_to_update, subworkflows_to_update):
"""Check for linked components added or removed in the new subworkflow version"""
if self.component_type == "subworkflows":
subworkflow_directory = Path(self.dir, self.component_type, self.modules_repo.repo_path, component)
included_modules, included_subworkflows = get_components_to_install(subworkflow_directory)
# If a new module/subworkflow is included in the subworklfow and wasn't included before
for module in included_modules:
if module not in modules_to_update:
log.info(f"Installing newly included module '{module}' for '{component}'")
install_module_object = ComponentInstall(self.dir, "modules", installed_by=component)
install_module_object.install(module, silent=True)
for subworkflow in included_subworkflows:
if subworkflow not in subworkflows_to_update:
log.info(f"Installing newly included subworkflow '{subworkflow}' for '{component}'")
install_subworkflow_object = ComponentInstall(self.dir, "subworkflows", installed_by=component)
install_subworkflow_object.install(subworkflow, silent=True)
# If a module/subworkflow has been removed from the subworkflow
for module in modules_to_update:
if module not in included_modules:
Expand All @@ -909,6 +907,17 @@ def manage_changes_in_linked_components(self, component, modules_to_update, subw
log.info(f"Removing subworkflow '{subworkflow}' which is not included in '{component}' anymore.")
remove_subworkflow_object = ComponentRemove("subworkflows", self.dir)
remove_subworkflow_object.remove(subworkflow, removed_by=component)
# If a new module/subworkflow is included in the subworklfow and wasn't included before
for module in included_modules:
if module not in modules_to_update:
log.info(f"Installing newly included module '{module}' for '{component}'")
install_module_object = ComponentInstall(self.dir, "modules", installed_by=component)
install_module_object.install(module, silent=True)
for subworkflow in included_subworkflows:
if subworkflow not in subworkflows_to_update:
log.info(f"Installing newly included subworkflow '{subworkflow}' for '{component}'")
install_subworkflow_object = ComponentInstall(self.dir, "subworkflows", installed_by=component)
install_subworkflow_object.install(subworkflow, silent=True)

def _change_component_type(self, new_component_type):
original_component_type = self.component_type
Expand Down
2 changes: 1 addition & 1 deletion nf_core/module-template/modules/meta.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "{{ component_name_underscore }}"
{% if not_empty_template -%}
## TODO nf-core: Add a description of the module and list keywords
{%- endif -%}
{% endif -%}
description: write your description here
keywords:
- sort
Expand Down
8 changes: 5 additions & 3 deletions nf_core/modules/modules_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def checkout(self, commit):
"""
self.repo.git.checkout(commit)

def component_exists(self, component_name, component_type, checkout=True):
def component_exists(self, component_name, component_type, checkout=True, commit=None):
"""
Check if a module/subworkflow exists in the branch of the repo

Expand All @@ -312,7 +312,7 @@ def component_exists(self, component_name, component_type, checkout=True):
Returns:
(bool): Whether the module/subworkflow exists in this branch of the repository
"""
return component_name in self.get_avail_components(component_type, checkout=checkout)
return component_name in self.get_avail_components(component_type, checkout=checkout, commit=commit)

def get_component_dir(self, component_name, component_type):
"""
Expand Down Expand Up @@ -449,7 +449,7 @@ def get_commit_info(self, sha):
return message, date
raise LookupError(f"Commit '{sha}' not found in the '{self.remote_url}'")

def get_avail_components(self, component_type, checkout=True):
def get_avail_components(self, component_type, checkout=True, commit=None):
"""
Gets the names of the modules/subworkflows in the repository. They are detected by
checking which directories have a 'main.nf' file
Expand All @@ -459,6 +459,8 @@ def get_avail_components(self, component_type, checkout=True):
"""
if checkout:
self.checkout_branch()
if commit is not None:
self.checkout(commit)
# Get directory
if component_type == "modules":
directory = self.modules_dir
Expand Down
5 changes: 5 additions & 0 deletions tests/subworkflows/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import nf_core.utils
from nf_core.modules.modules_json import ModulesJson
from nf_core.modules.modules_repo import NF_CORE_MODULES_NAME, NF_CORE_MODULES_REMOTE
from nf_core.modules.remove import ModuleRemove
from nf_core.modules.update import ModuleUpdate
from nf_core.subworkflows.update import SubworkflowUpdate

Expand Down Expand Up @@ -321,6 +322,10 @@ def test_update_change_of_included_modules(self):
# Check that tabix/tabix is there
assert "tabix/tabix" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"][NF_CORE_MODULES_NAME]
assert Path(self.pipeline_dir, "modules", NF_CORE_MODULES_NAME, "tabix/tabix").is_dir()
# Check that ensemblevep is not there but instead we have ensemblevep/vep (due to a file re-naming)
assert "ensemblvep" not in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"][NF_CORE_MODULES_NAME]
assert "ensemblvep/vep" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"][NF_CORE_MODULES_NAME]
assert Path(self.pipeline_dir, "modules", NF_CORE_MODULES_NAME, "ensemblvep/vep").is_dir()


def cmp_component(dir1, dir2):
Expand Down