Skip to content

Commit

Permalink
Merge branch 'master' into boolean-parameter-to--log_skipped_fastqs
Browse files Browse the repository at this point in the history
  • Loading branch information
glichtenstein authored May 23, 2024
2 parents 7ca0df8 + 8667d59 commit 8e87edb
Show file tree
Hide file tree
Showing 168 changed files with 4,532 additions and 1,052 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
args: ["--schemafile", "subworkflows/yaml-schema.json"]
- id: check-github-workflows
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.368.10
rev: 37.371.1
hooks:
- id: renovate-config-validator
# use ruff for python files
Expand Down
9 changes: 9 additions & 0 deletions modules/nf-core/bamtofastq10x/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "bamtofastq10x"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::10x_bamtofastq=1.4.1"
45 changes: 45 additions & 0 deletions modules/nf-core/bamtofastq10x/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
process BAMTOFASTQ10X {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/10x_bamtofastq:1.4.1--hdbdd923_2':
'biocontainers/10x_bamtofastq:1.4.1--hdbdd923_2' }"

input:
tuple val(meta), path(bam)

output:
tuple val(meta), path("*.fastq.gz"), emit: fastq
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
bamtofastq \\
$args \\
$bam \\
${prefix}.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamtofastq10x: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamtofastq10x: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //')
END_VERSIONS
"""
}
48 changes: 48 additions & 0 deletions modules/nf-core/bamtofastq10x/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: bamtofastq10x

description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis

keywords:
- bam
- convert
- fastq
- 10x

tools:
- bamtofastq10x:
description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis
homepage: https://github.com/10XGenomics/bamtofastq
documentation: https://github.com/10XGenomics/bamtofastq
tool_dev_url: https://github.com/10XGenomics/bamtofastq
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- bam:
type: file
description: BAM file
pattern: "*.bam"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

- fastq:
type: file
description: fastq compressed file
pattern: "*.fastq.gz"

authors:
- "@BlueBicycleBlog"
maintainers:
- "@BlueBicycleBlog"
55 changes: 55 additions & 0 deletions modules/nf-core/bamtofastq10x/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
nextflow_process {

name "Test Process BAMTOFASTQ10X"
script "../main.nf"
process "BAMTOFASTQ10X"

tag "modules"
tag "modules_nfcore"
tag "bamtofastq10x"

test("human - bam") {
when {
process {
"""
input[0] = Channel.of([
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }

)
}
}


test("human - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.of([
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success }
)
}

}
}
47 changes: 47 additions & 0 deletions modules/nf-core/bamtofastq10x/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"human - bam": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
[
"bamtofastq_S1_L000_I1_001.fastq.gz:md5,a33682ac881de7a7453d79721b7621a0",
"bamtofastq_S1_L000_R1_001.fastq.gz:md5,5ccebf77d8636d7a7cdfc59737aea79f",
"bamtofastq_S1_L000_R2_001.fastq.gz:md5,2ee7c90e4307deba74065cfd00a65002"
]
]
]
],
"1": [
"versions.yml:md5,845cd1d09c8a3d0059da9d074a9e5436"
],
"fastq": [
[
{
"id": "test"
},
[
[
"bamtofastq_S1_L000_I1_001.fastq.gz:md5,a33682ac881de7a7453d79721b7621a0",
"bamtofastq_S1_L000_R1_001.fastq.gz:md5,5ccebf77d8636d7a7cdfc59737aea79f",
"bamtofastq_S1_L000_R2_001.fastq.gz:md5,2ee7c90e4307deba74065cfd00a65002"
]
]
]
],
"versions": [
"versions.yml:md5,845cd1d09c8a3d0059da9d074a9e5436"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.0"
},
"timestamp": "2024-05-22T16:43:24.999397"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/bamtofastq10x/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bamtofastq10x:
- "modules/nf-core/bamtofastq10x/**"
18 changes: 8 additions & 10 deletions modules/nf-core/bclconvert/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ process BCLCONVERT {
tuple val(meta), path(samplesheet), path(run_dir)

output:
tuple val(meta), path("**_S[1-9]*_R?_00?.fastq.gz") , emit: fastq
tuple val(meta), path("**_S[1-9]*_I?_00?.fastq.gz") , optional:true, emit: fastq_idx
tuple val(meta), path("**Undetermined_S0*_R?_00?.fastq.gz") , optional:true, emit: undetermined
tuple val(meta), path("**Undetermined_S0*_I?_00?.fastq.gz") , optional:true, emit: undetermined_idx
tuple val(meta), path("Reports") , emit: reports
tuple val(meta), path("Logs") , emit: logs
tuple val(meta), path("InterOp/*.bin") , emit: interop
path("versions.yml") , emit: versions
tuple val(meta), path("**_S[1-9]*_R?_00?.fastq.gz") , emit: fastq
tuple val(meta), path("**_S[1-9]*_I?_00?.fastq.gz") , optional:true, emit: fastq_idx
tuple val(meta), path("**Undetermined_S0*_R?_00?.fastq.gz") , optional:true, emit: undetermined
tuple val(meta), path("**Undetermined_S0*_I?_00?.fastq.gz") , optional:true, emit: undetermined_idx
tuple val(meta), path("Reports") , emit: reports
tuple val(meta), path("Logs") , emit: logs
tuple val(meta), path("**/InterOp/*.bin", includeInputs: true), emit: interop
path("versions.yml") , emit: versions

when:
task.ext.when == null || task.ext.when
Expand Down Expand Up @@ -62,8 +62,6 @@ process BCLCONVERT {
--bcl-input-directory ${input_dir} \\
--sample-sheet ${samplesheet}
cp -r ${input_dir}/InterOp .
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bclconvert: \$(bcl-convert -V 2>&1 | head -n 1 | sed 's/^.*Version //')
Expand Down
72 changes: 72 additions & 0 deletions modules/nf-core/biscuit/align/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
nextflow_process {

name "Test Process BISCUIT_ALIGN"
script "../main.nf"
process "BISCUIT_ALIGN"

tag "modules"
tag "modules_nfcore"
tag "biscuit"
tag "biscuit/align"
tag "biscuit/index"

setup {
run("BISCUIT_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
"""
}
}
}

test("Single-End sarscov2 test_methylated_1 [fastq_gz]") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_methylated_1_fastq_gz'], checkIfExists: true) ]
]
input[1] = BISCUIT_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert file(process.out.bam[0][1]).name == "test.bam" },
{ assert file(process.out.bai[0][1]).name == "test.bam.bai" },
{ assert snapshot(process.out.versions).match("single-end-versions") }
)
}
}

test("Paired-End sarscov2 test_methylated_1 [fastq_gz]") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_methylated_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_methylated_2_fastq_gz'], checkIfExists: true) ]
]
input[1] = BISCUIT_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert file(process.out.bam[0][1]).name == "test.bam" },
{ assert file(process.out.bai[0][1]).name == "test.bam.bai" },
{ assert snapshot(process.out.versions).match("paired-end-versions") }
)
}
}
}
26 changes: 26 additions & 0 deletions modules/nf-core/biscuit/align/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"single-end-versions": {
"content": [
[
"versions.yml:md5,0b2a8c4c438a785a890110a458399bfd"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
},
"timestamp": "2024-05-22T20:06:02.295706212"
},
"paired-end-versions": {
"content": [
[
"versions.yml:md5,0b2a8c4c438a785a890110a458399bfd"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
},
"timestamp": "2024-05-22T20:06:17.879689395"
}
}
3 changes: 3 additions & 0 deletions modules/nf-core/biscuit/align/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
biscuit/align:
- modules/nf-core/biscuit/index/**
- modules/nf-core/biscuit/align/**
38 changes: 38 additions & 0 deletions modules/nf-core/checkm/lineagewf/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow_process {

name "Test Process CHECKM_LINEAGEWF"
script "../main.nf"
process "CHECKM_LINEAGEWF"
tag "modules"
tag "modules_nfcore"
tag "checkm"
tag "checkm/lineagewf"

test("Should run without failures") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true)
]
input[1] = 'fasta'
input[2] = [] // Download CheckM database
"""
}
}

then {
assert process.success
assert file(process.out.checkm_output[0][1]).list().find { file(it).name == "checkm.log" }
assert snapshot(
path(process.out.marker_file[0][1]).readLines().any{it.contains("PF00312.17")},
process.out.checkm_tsv,
process.out.versions
).match()
}

}

}
Loading

0 comments on commit 8e87edb

Please sign in to comment.