Fix Nextflow I/O wiring: channels, lib imports, script execution#1
Closed
victor-fdz wants to merge 2 commits into
Closed
Fix Nextflow I/O wiring: channels, lib imports, script execution#1victor-fdz wants to merge 2 commits into
victor-fdz wants to merge 2 commits into
Conversation
added 2 commits
May 26, 2026 13:30
- Fix channel types: use Channel.value(file(...)) for single-file inputs
(FASTA, gene list) so they pair correctly with queue channels
- Stage lib/ directory into each process and set PYTHONPATH so Python
scripts can resolve `from lib import ...` inside Nextflow work dirs
- Call bin/ scripts directly (not via `python ${projectDir}/bin/...`)
since Nextflow adds bin/ to $PATH automatically
- Make all bin/*.py scripts executable (required by Nextflow)
- Fix output glob in LABEL_GENE_PAIRS to match actual filenames
- Simplify publishDir syntax (remove closure wrappers)
- Remove redundant `nextflow.enable.dsl = 2` from workflow files
(already declared in nextflow.config)
- Add --random-seqs flag pass-through to ENCODE_AND_SPLIT_PAIRS
Remove accidentally committed .nextflow/ and .nextflow.log* files. Add Nextflow runtime artifacts (cache, work dir, logs) to .gitignore.
There was a problem hiding this comment.
Pull request overview
This PR fixes several execution-blocking issues in the Nextflow pipeline scaffold by correcting channel semantics, staging lib/ into work dirs (and wiring it through processes), and switching process scripts to Nextflow’s bin/ execution model. It also adds missing Python entrypoint scripts and updates ignores to avoid committing Nextflow runtime artifacts.
Changes:
- Reworked workflow inputs to use value channels for single-use files and added a staged
lib/directory channel passed into all processes. - Updated Nextflow modules to set
PYTHONPATHfrom the stagedlib/and to executebin/*.pyscripts directly. - Added multiple
bin/scripts (profiling/normalize/label/encode_split/model_processing/preprocess/compare_same_species_models) and updated.gitignorefor Nextflow runtime paths.
Reviewed changes
Copilot reviewed 5 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| workflows/main.nf | Fixes channel wiring and stages lib/ for downstream Python imports. |
| modules/local/label_gene_pairs.nf | Adds project_lib input, sets PYTHONPATH, loosens output glob. |
| modules/local/encode_and_split_pairs.nf | Adds project_lib input, sets PYTHONPATH, adds optional --random-seqs. |
| modules/local/train_and_evaluate_model.nf | Adds project_lib input, sets PYTHONPATH, switches to direct script exec. |
| main.nf | Removes inline DSL directive (kept in nextflow.config). |
| bin/profiling.py | Adds profiling CLI script (but currently has CRLF line endings + minor help formatting issue). |
| bin/preprocess.py | Adds a “chain existing scripts” preprocessing entrypoint. |
| bin/normalize.py | Adds normalization benchmarking CLI script. |
| bin/model_processing.py | Adds model training/evaluation CLI script used by Nextflow module. |
| bin/label.py | Adds labeling CLI script used by Nextflow module. |
| bin/encode_split.py | Adds encoding/splitting CLI script used by Nextflow module (but currently exposes unsupported split modes + misleading defaults). |
| bin/compare_same_species_models.py | Adds a large standalone analysis script for same-species model comparison. |
| .gitignore | Ignores Nextflow runtime directories/logs and work directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 6 critical issues in the Nextflow pipeline scaffold that prevented execution.
Problems Fixed
1. Script execution via
python ${projectDir}/bin/...→ direct executionNextflow adds
bin/to$PATHautomatically. Calling scripts directly (e.g.,label.py) is the correct pattern —${projectDir}breaks inside containers.2. Scripts not executable
All
bin/*.pyscripts now have+xpermission (required by Nextflow).3.
lib/imports broken in Nextflow work dirsScripts use
from lib import ...with asys.pathhack based on__file__. In Nextflow's symlinked work dirs, the parent path no longer resolves to the project root. Fix: Stagelib/as apathinput and setPYTHONPATHexplicitly.4. Channel type mismatch (queue vs value)
FASTA and gene-list channels were
Channel.fromPath(...)(queue — consumed once). Combined with the labeling output queue channel, Nextflow can't pair them. Fix:Channel.value(file(...))for single-file inputs reused across all items.5. Output glob too specific
LABEL_GENE_PAIRSoutput path was hardcoded to a pattern that didn't match actual filenames. Switched to*.tsvwildcard.6. publishDir closure syntax
Simplified to standard
publishDir "...", mode: ...form.Housekeeping
.nextflow/,.nextflow.log*, andwork/to.gitignoreHow to Run