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

POC: module yaml restructure #2789

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
30 changes: 21 additions & 9 deletions nf_core/components/nfcore_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,27 @@ def get_inputs_from_main_nf(self):
log.info(f"Could not find any inputs in {self.main_nf}")
return inputs
input_data = data.split("input:")[1].split("output:")[0]
regex = r"(val|path)\s*(\(([^)]+)\)|\s*([^)\s,]+))"
matches = re.finditer(regex, input_data, re.MULTILINE)
for _, match in enumerate(matches, start=1):
if match.group(3):
input_val = match.group(3).split(",")[0] # handle `files, stageAs: "inputs/*"` cases
inputs.append(input_val)
elif match.group(4):
input_val = match.group(4).split(",")[0] # handle `files, stageAs: "inputs/*"` cases
inputs.append(input_val)
for line in input_data.split("\n"):
theseinputs = []
regex = r"(val|path)\s*(\(([^)]+)\)|\s*([^)\s,]+))"
matches = re.finditer(regex, line)
for _, match in enumerate(matches, start=1):
input_type = None
input_val = None
if match.group(1):
input_type = match.group(1)
if match.group(3):
input_val = match.group(3).split(",")[0] # handle `files, stageAs: "inputs/*"` cases
elif match.group(4):
input_val = match.group(4).split(",")[0] # handle `files, stageAs: "inputs/*"` cases
if input_type and input_val:
theseinputs.append({
input_val: {
"type": input_type
}
})
if len(theseinputs) > 0:
inputs.append(theseinputs)
log.info(f"Found {len(inputs)} inputs in {self.main_nf}")
self.inputs = inputs

Expand Down
2 changes: 2 additions & 0 deletions nf_core/modules/lint/meta_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def meta_yml(module_lint_object: ComponentLint, module: NFCoreComponent) -> None
"""

module.get_inputs_from_main_nf()
print(yaml.dump({"input": module.inputs}))
exit()
module.get_outputs_from_main_nf()
# Check if we have a patch file, get original file in that case
meta_yaml = None
Expand Down
Loading