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

nf-core modules create-test-yml should make tags for other modules used in the test #2248

Closed
SPPearce opened this issue Apr 25, 2023 · 2 comments

Comments

@SPPearce
Copy link
Contributor

Description of feature

When nf-core subworkflows create-test-yml is invoked, the resulting test.yml file automatically includes a tag entry for every tool used in the tests. This means that when any of those tools are updated, the tests for the subworkflows are also ran.

However, this feature is not present in nf-core modules create-test-yml, meaning that the tags are only for the module that is being directly tested. So if toolA uses toolB to pre-process some input data (to generate a reference file for instance), then updates to toolB might break toolA. For instance, the recent updates to samtools affect several downstream tools that use samtools as a preprocessing step, for instance the bamcmp module, but the tests for these were not rerun when samtools was updated. The subworkflows on the other hand correctly update, as they have the tags.

@SPPearce
Copy link
Contributor Author

The subworkflow create-test-yml code includes this function that grabs the import statements from the tests main.nf

def parse_module_tags(self):
"""
Parse the subworkflow test main.nf file to retrieve all imported modules for adding tags.
"""
tags = []
with open(Path(self.subworkflow_dir, "main.nf"), "r") as fh:
for line in fh:
regex = re.compile(
r"include(?: *{ *)([a-zA-Z\_0-9]*)(?: *as *)?(?:[a-zA-Z\_0-9]*)?(?: *})(?: *from *)(?:'|\")(.*)(?:'|\")"
)
match = regex.match(line)
if match and len(match.groups()) == 2:
name, link = match.groups()
if link.startswith("../../../"):
name_split = name.lower().split("_")
tags.append("/".join(name_split))
if len(name_split) > 1:
tags.append(name_split[0])
elif link.startswith("../"):
tags.append("subworkflows/" + name.lower())
return list(set(tags))

Presumably the same kind of logic could be applied to the tests main.nf for modules.

@mirpedrol
Copy link
Member

This is now outdated with nf-test, tags are checked with nf-core linting and the missing ones are reported in the error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants