diff --git a/modules/nf-core/stitchr/Dockerfile b/modules/nf-core/stitchr/Dockerfile new file mode 100644 index 00000000000..4ff8b351901 --- /dev/null +++ b/modules/nf-core/stitchr/Dockerfile @@ -0,0 +1,26 @@ +# ---- Base image ---- +FROM python:3.14 + +LABEL authors="Clara Bierwirth" \ + description="Stitchr container with IMGT human and mouse data" + +# ---- Environment settings ---- +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PATH="/usr/local/bin:${PATH}" + +# ---- System dependencies ---- +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + build-essential \ + wget \ + && rm -rf /var/lib/apt/lists/* + +# ---- Install Stitchr and IMGTgeneDL ---- +RUN pip install --no-cache-dir --upgrade --force-reinstall \ + stitchr==1.3.1 \ + IMGTgeneDL==0.6.1 + +# ---- Download human and mouse IMGT data ---- +RUN stitchrdl -s human +RUN stitchrdl -s mouse diff --git a/modules/nf-core/stitchr/thimble/environment.yml b/modules/nf-core/stitchr/thimble/environment.yml new file mode 100644 index 00000000000..70ea7de4a89 --- /dev/null +++ b/modules/nf-core/stitchr/thimble/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::pip=26.0.1 + - conda-forge::python=3.14.3 + - pip: + - stitchr==1.3.1 diff --git a/modules/nf-core/stitchr/thimble/main.nf b/modules/nf-core/stitchr/thimble/main.nf new file mode 100644 index 00000000000..d80ded1b4c8 --- /dev/null +++ b/modules/nf-core/stitchr/thimble/main.nf @@ -0,0 +1,51 @@ +process STITCHR_THIMBLE { + tag "$meta.id" + label 'process_single' + + + conda "${moduleDir}/environment.yml" + container "ghcr.io/qbic-pipelines/stitchr:1.3.1" + + + input: + tuple val(meta), path(samplesheet) + tuple val(meta2), path(alt_codon_usage) + tuple val(meta3), path(allele_preferences) + val(species) + + + output: + tuple val(meta), path("${meta.id}.tsv"), emit: thimble + tuple val("${task.process}"), val('stitchr'), eval("stitchr --version"), topic: versions, emit: versions_stitchr + tuple val("${task.process}"), val('imgtgenedl'), val("0.6.1"), topic: versions, emit: versions_imgtgenedl + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + //optional files: + def codon_usage = alt_codon_usage ? "-cu ${alt_codon_usage}" : "" + def allele_preference = allele_preferences ? "-p ${allele_preferences}" : "" + + """ + thimble \ + $args \ + -in ${samplesheet} \ + -o ${prefix}.tsv \ + ${codon_usage} \ + ${allele_preference} \ + -s ${species} + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + echo $args + + touch ${prefix}.tsv + """ +} diff --git a/modules/nf-core/stitchr/thimble/meta.yml b/modules/nf-core/stitchr/thimble/meta.yml new file mode 100644 index 00000000000..a5e3d006e9e --- /dev/null +++ b/modules/nf-core/stitchr/thimble/meta.yml @@ -0,0 +1,117 @@ +name: "stitchr_thimble" +description: Automatic TCR nucleotide sequence generation from V, J and CDR3 + information +keywords: + - TCR + - sequence + - immunology +tools: + - "stitchr": + description: "Automatic TCR nucleotide sequence generation from V, J and CDR3 + information" + homepage: "https://github.com/JamieHeather/stitchr" + documentation: "https://jamieheather.github.io/stitchr/index.html" + tool_dev_url: "https://github.com/JamieHeather/stitchr" + doi: "10.1093/nar/gkac190" + licence: + - "MIT" + identifier: "" + - "imgtgenedl": + description: "provides access to TCR and IG genes stored in IMGT/GENE-DB" + homepage: "https://github.com/JamieHeather/IMGTgeneDL" + documentation: "https://github.com/JamieHeather/IMGTgeneDL/blob/main/README.md" + tool_dev_url: "https://github.com/JamieHeather/IMGTgeneDL" + doi: "10.1093/nar/gkab1136" + licence: + - "MIT" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing per sample information + e.g. `[ id:'sample1' ]` + - samplesheet: + type: file + description: tsv containing J,V and CDR3 information + pattern: "*.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + - - meta2: + type: map + description: | + Information about codon usage + - alt_codon_usage: + type: file + description: txt containing alternative codon usage in kazusa-like format + pattern: "*.txt" + ontologies: [] + - - meta3: + type: map + description: | + Information about non-standard allele preferences + - allele_preferences: + type: file + description: tsv containing alternative allele preferences + pattern: "*.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + - species: + type: string + description: Species ("mouse" or "human") +output: + thimble: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - ${meta.id}.tsv: + type: file + description: | + tsv containing full TCR sequences + ontologies: [] + versions_stitchr: + - - ${task.process}: + type: string + description: The name of the process + - stitchr: + type: string + description: The name of the tool + - stitchr --version: + type: eval + description: The expression to obtain the version of the tool + versions_imgtgenedl: + - - ${task.process}: + type: string + description: The name of the process + - imgtgenedl: + type: string + description: The name of the tool + - 0.6.1: + type: string + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - stitchr: + type: string + description: The name of the tool + - stitchr --version: + type: eval + description: The expression to obtain the version of the tool + - - ${task.process}: + type: string + description: The name of the process + - imgtgenedl: + type: string + description: The name of the tool + - 0.6.1: + type: string + description: The expression to obtain the version of the tool +authors: + - "@Clara0611" +maintainers: + - "@Clara0611" diff --git a/modules/nf-core/stitchr/thimble/tests/main.nf.test b/modules/nf-core/stitchr/thimble/tests/main.nf.test new file mode 100644 index 00000000000..8a31e353ce7 --- /dev/null +++ b/modules/nf-core/stitchr/thimble/tests/main.nf.test @@ -0,0 +1,82 @@ +nextflow_process { + + name "Test Process STITCHR_THIMBLE" + script "../main.nf" + process "STITCHR_THIMBLE" + + tag "modules" + tag "modules_nfcore" + tag "stitchr" + tag "stitchr/thimble" + + test("human - tsv") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/stitchr/stitchr_vdjdb.tsv', checkIfExists: true), + ] + input[1] = [ + [ id: 'alt_codon_usage' ], + [] + ] + input[2] = [ + [ id: 'allele_preference' ], + [] + ] + input[3] = "human" + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + process.out.findAll { key, val -> key.startsWith('versions') } + ).match() } + ) + } + + } + + test("human - tsv - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/stitchr/stitchr_vdjdb.tsv', checkIfExists: true), + ] + input[1] = [ + [ id: 'alt_codon_usage' ], + [] + ] + input[2] = [ + [ id: 'allele_preference' ], + [] + ] + input[3] = "human" + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + process.out.findAll { key, val -> key.startsWith('versions') } + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/stitchr/thimble/tests/main.nf.test.snap b/modules/nf-core/stitchr/thimble/tests/main.nf.test.snap new file mode 100644 index 00000000000..97a42c2b1c4 --- /dev/null +++ b/modules/nf-core/stitchr/thimble/tests/main.nf.test.snap @@ -0,0 +1,144 @@ +{ + "human - tsv": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.tsv:md5,1dc2864a6189891ae9e6bc4d4b377897" + ] + ], + "1": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ], + "2": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "thimble": [ + [ + { + "id": "test" + }, + "test.tsv:md5,1dc2864a6189891ae9e6bc4d4b377897" + ] + ], + "versions_imgtgenedl": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "versions_stitchr": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ] + }, + { + "versions_imgtgenedl": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "versions_stitchr": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ] + } + ], + "timestamp": "2026-03-20T14:02:23.190588215", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + }, + "human - tsv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ], + "2": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "thimble": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_imgtgenedl": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "versions_stitchr": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ] + }, + { + "versions_imgtgenedl": [ + [ + "STITCHR_THIMBLE", + "imgtgenedl", + "0.6.1" + ] + ], + "versions_stitchr": [ + [ + "STITCHR_THIMBLE", + "stitchr", + "1.3.1" + ] + ] + } + ], + "timestamp": "2026-03-20T14:02:45.410312976", + "meta": { + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } + } +} \ No newline at end of file