A draft of a simple module to discuss nf-core - #1
Conversation
- Added new binary files: pbmc_1k.h5, barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz to the anndatautils directory. - Updated the Nextflow test for the anndatautils/toh5ad module to validate the conversion of .h5 files to .h5ad format. - Improved assertions in the test to check for successful process execution and correct output file generation.
…and remove container specification
… add snapshot for output validation
…s for improved reliability
… work directory settings
- Added pbmc_1k.h5 file containing the PBMC 1K dataset. - Included barcodes.tsv.gz, features.tsv.gz, and matrix.mtx.gz files in the raw_feature_bc_matrix directory for the dataset.
…dd new config file for tests
…ta paths to use params for improved flexibility
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the new tool module "anndatautils/toh5ad" designed for converting AnnData-compatible files into AnnData objects saved as .h5ad files.
- New meta file defines module metadata
- Module configuration for input/output and authorship is added
Files not reviewed (7)
- modules/sanger/anndatautils/toh5ad/Dockerfile: Language not supported
- modules/sanger/anndatautils/toh5ad/main.nf: Language not supported
- modules/sanger/anndatautils/toh5ad/module.config: Language not supported
- modules/sanger/anndatautils/toh5ad/tests/main.nf.test: Language not supported
- modules/sanger/anndatautils/toh5ad/tests/main.nf.test.snap: Language not supported
- nf-test.config: Language not supported
- tests/configs/nf-test.config: Language not supported
|
I still need to add .zarr file conversion |
There was a problem hiding this comment.
Docker file for this module is already on dockage. I think it would still be good to reference Dockerfile somehow. Either by putting it in the module directory or by leaving a link to dockage in meta.yml or README.md file
| type: string | ||
| description: | | ||
| Sample ID to be used as obs_names in the AnnData object | ||
| - - input: |
There was a problem hiding this comment.
should be a single dash. Otherwise, it means sample_id, input and delimiter are the same level.
Also, maybe it's worth renaming input to be some thing more concrete? What type of data do you have in mind?
There was a problem hiding this comment.
Fix dashes, thank you! Well, input can be either file or directory, so I struggled to come up with better name
| params { | ||
| publish_dir_mode = "copy" | ||
| singularity_pull_docker_container = false | ||
| test_data_base = "${projectDir}/tests/data/" |
There was a problem hiding this comment.
we may need a collective decision on this.
There was a problem hiding this comment.
Agreed. I added this just as a draft to enable testing
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
nf-core
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 14 changed files in this pull request and generated 2 comments.
Suppressed comments (11)
modules/sanger/anndatautils/toh5ad/tests/main.nf.test:54
- Typo in comment: "basec run health" → "basic run health".
// basec run health
modules/sanger/anndatautils/toh5ad/tests/main.nf.test:90
- Typo in comment: "basec run health" → "basic run health".
// basec run health
tests/config/nf-test.config:21
- This singularity profile hard-codes site-specific bind mounts and a cache directory (
/lustre,/nfs,/nfs/cellgeni/...). That makes the test config non-portable and likely to fail in CI or on other environments.
singularity.enabled = true
singularity.autoMounts = true
singularity.runOptions = '-B /lustre,/nfs'
singularity.cacheDir = '/nfs/cellgeni/singularity/images/'
}
modules/sanger/anndatautils/toh5ad/main.nf:8
path(input, name: 'input/*')uses an option name that isn't used elsewhere in this repo for staging paths (e.g. other modules usestageAs:). This may not stage inputs intoinput/*as intended.
tuple val(sample_id), path(input, name: 'input/*')
modules/sanger/anndatautils/toh5ad/main.nf:5
- The module container is pinned to
:latest, which is non-reproducible and inconsistent with the rest of this repo (no other module uses:latest). Please pin to a specific tag or digest.
container 'docker://quay.io/cellgeni/metacells-python:latest'
modules/sanger/anndatautils/toh5ad/meta.yml:37
- The metadata says
sample_idis used asobs_names, but the implementation stores it inadata.obs["sample"](and only affectsobs.indexwhen--delimiteris set). This is misleading for module users.
description: |
Sample ID to be used as obs_names in the AnnData object
- input:
modules/sanger/anndatautils/toh5ad/meta.yml:44
- The metadata describes the delimiter behavior as
sample_id + delimiter + barcode, but the script buildsbarcode + delimiter + sample_id(and names the indexbarcode_sample). The meta.yml should match the implemented behavior.
type: string
description: |
Delimiter to be used to create obs_names in the format sample_id + delimiter + barcode
modules/sanger/anndatautils/toh5ad/meta.yml:52
- The output metadata says
sample_idwas used asobs_names, but the script uses it as anobs["sample"]value (and may incorporate it intoobs_namesonly whendelimiteris set).
type: string
description: |
Sample ID that was used as obs_names in the AnnData object
- "*.h5ad":
modules/sanger/anndatautils/toh5ad/Dockerfile:33
- This Dockerfile installs several large notebook/interactive packages (e.g.
jupyterlab,notebook,ipywidgets,papermill) that aren't needed byconvert_to_h5ad.pyand will significantly increase image size and build time.
uv pip install --no-cache-dir \
scanpy \
numpy \
pandas \
muon \
scikit-network \
jupyterlab \
notebook \
tqdm \
ipywidgets \
papermill
modules/sanger/anndatautils/toh5ad/tests/main.nf.test:9
- Trailing whitespace after
tag "anndatautils".
tag "anndatautils"
modules/sanger/anndatautils/toh5ad/tests/main.nf.test:23
- Typo in comment: "basec run health" → "basic run health".
This issue also appears in the following locations of the same file:
- line 54
- line 90
// basec run health
| config { | ||
| testsDir "." | ||
| workDir ".nf-test" | ||
| configFile "./tests/configs/nf-test.config" |
| process { | ||
| withName: "*ANNDATAUTILS_TOH5AD" { | ||
| queue = 'normal' | ||
| cpus = 4 | ||
| memory = { 16.GB + 32.GB * (task.attempt - 1) } | ||
| publishDir = [ | ||
| mode : params.publish_mode, | ||
| path : "${outputDir}/adata/raw", | ||
| overwrite: true | ||
| ] | ||
| } | ||
| } No newline at end of file |
This PR is my attempt to stick to
nf-corebest practices as much as possibleThe following changes were introduced:
anndatautilsfor any modules related toAnnDatamanipulationsanndatautils/toh5admoduletests/datafolder for test datatests/configsfolder for all test related configsnf-test.configfile.zarrfile