Skip to content

Commit

Permalink
Merge branch 'master' into pl_gatk_vcf2table
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenb authored Sep 12, 2024
2 parents 67f79e2 + 6dd363c commit 49aa1a5
Show file tree
Hide file tree
Showing 17 changed files with 564 additions and 136 deletions.
5 changes: 3 additions & 2 deletions modules/nf-core/mirtrace/qc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process MIRTRACE_QC {
'biocontainers/mirtrace:1.0.1--0' }"

input:
tuple val(meta), path(reads)
tuple val(meta), path(reads), path(mirtrace_config)
val(mirtrace_species)

output:
Expand All @@ -25,14 +25,15 @@ process MIRTRACE_QC {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def mirtrace_mode = mirtrace_config ? "--config ${mirtrace_config}": "${reads}"

"""
mirtrace qc \\
--species ${mirtrace_species} \\
--write-fasta \\
--output-dir . \\
--force \\
${reads}
${mirtrace_mode}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
3 changes: 3 additions & 0 deletions modules/nf-core/mirtrace/qc/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ input:
type: file
description: microRNA sequencing data
pattern: "*.{fastq,fastq.gz}"
- mirtrace_config:
type: file
description: (Optional) CSV with list of FASTQ files to process with one entry per row. No headers. Each row consists of the following columns "FASTQ file path, id, adapter, PHRED-ASCII-offset".
- mirtrace_species:
type: string
description: Target species in microRNA sequencing data (miRbase encoding, e.g. “hsa” for Homo sapiens)
Expand Down
53 changes: 51 additions & 2 deletions modules/nf-core/mirtrace/qc/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ nextflow_process {
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true)
]
],
[]
]
input[1] = "hsa"
"""
Expand Down Expand Up @@ -61,7 +62,8 @@ nextflow_process {
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true),
]
],
[]
]
input[1] = "hsa"
"""
Expand All @@ -77,4 +79,51 @@ nextflow_process {

}

test("human - fastq - optional config") {

when {
process {
"""
ch_reads = Channel.of([
[ id:'test' ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true)
]
])
ch_mirtrace_config = Channel.of(
"./test_rnaseq_1.fastq.gz,test_rnaseq_1,TGGAATTCTCGGGTGCCAAGG,33")
.collectFile(name: "mirtrace_config.txt", newLine: true)
input[0] = ch_reads
.combine(ch_mirtrace_config)
input[1] = "hsa"
"""
}
}

then {
assertAll(
{ assert process.success },

// Check HTML
{ assert path(process.out.html.get(0).get(1)).text.contains("This file is part of miRTrace.")} ,

// Check JSON
{ assert path(process.out.json.get(0).get(1)).json.results[0].stats.uniqueQCPassedSeqsCount == 912 },

// Check TSV
{ assert snapshot(process.out.tsv).match("tsv_config") },

// Check FASTA files
{ assert snapshot(process.out.rnatype_unknown_fa).match("rnatype_unknown_fa_config") },
{ assert snapshot(process.out.all_fa).match("all_fa_config") },

)
}

}

}
65 changes: 62 additions & 3 deletions modules/nf-core/mirtrace/qc/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
{
"all_fa_config": {
"content": [
[
[
{
"id": "test"
},
"test_rnaseq_1.fasta:md5,125963c9ee39a49b3a680903e28e7c9d"
]
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-10T18:35:10.022991825"
},
"all_fa": {
"content": [
[
Expand All @@ -15,7 +32,7 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T18:05:42.043272808"
"timestamp": "2024-09-10T18:33:02.971744888"
},
"versions": {
"content": [
Expand All @@ -29,6 +46,31 @@
},
"timestamp": "2024-09-02T14:00:50.712738593"
},
"tsv_config": {
"content": [
[
[
{
"id": "test"
},
[
"mirtrace-stats-contamination_basic.tsv:md5,ac69ca6d2a709854f1048b635d06e927",
"mirtrace-stats-contamination_detailed.tsv:md5,ef80997ac12662c64cbcf5fe9851e786",
"mirtrace-stats-length.tsv:md5,630b3a845953321ae4cf2fc4a4943ab5",
"mirtrace-stats-mirna-complexity.tsv:md5,ab2a7600a2daa5c1797eea13d0abc2f0",
"mirtrace-stats-phred.tsv:md5,44eaeae26ec629e71fb31e56bfb5a548",
"mirtrace-stats-qcstatus.tsv:md5,623cf3a0c5e363488966844feb0dd978",
"mirtrace-stats-rnatype.tsv:md5,ed8d3a76247a1432a365def87c3f4c67"
]
]
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-10T18:35:09.99291948"
},
"tsv": {
"content": [
[
Expand All @@ -53,7 +95,24 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T18:05:41.888457948"
"timestamp": "2024-09-10T18:33:02.856967195"
},
"rnatype_unknown_fa_config": {
"content": [
[
[
{
"id": "test"
},
"test_rnaseq_1.fasta:md5,125963c9ee39a49b3a680903e28e7c9d"
]
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-10T18:35:10.010723637"
},
"human - fastq - stub": {
"content": [
Expand Down Expand Up @@ -178,6 +237,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-05T18:05:41.978281344"
"timestamp": "2024-09-10T18:33:02.917439516"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/nextclade/datasetget/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::nextclade=2.12.0
- bioconda::nextclade=3.8.2
26 changes: 21 additions & 5 deletions modules/nf-core/nextclade/datasetget/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ process NEXTCLADE_DATASETGET {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/nextclade:2.12.0--h9ee0642_0' :
'biocontainers/nextclade:2.12.0--h9ee0642_0' }"
'https://depot.galaxyproject.org/singularity/nextclade:3.8.2--h9ee0642_0' :
'biocontainers/nextclade:3.8.2--h9ee0642_0' }"

input:
val dataset
val reference
val tag

output:
Expand All @@ -22,15 +21,13 @@ process NEXTCLADE_DATASETGET {
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${dataset}"
def fasta = reference ? "--reference ${reference}" : ''
def version = tag ? "--tag ${tag}" : ''
"""
nextclade \\
dataset \\
get \\
$args \\
--name $dataset \\
$fasta \\
$version \\
--output-dir $prefix
Expand All @@ -39,4 +36,23 @@ process NEXTCLADE_DATASETGET {
nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//')
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${dataset}"
"""
mkdir -p ${prefix}
touch ${prefix}/CHANGELOG.md
touch ${prefix}/README.md
touch ${prefix}/genome_annotation.gff3
touch ${prefix}/pathogen.json
touch ${prefix}/reference.fasta
touch ${prefix}/sequences.fasta
touch ${prefix}/tree.json
cat <<-END_VERSIONS > versions.yml
"${task.process}":
nextclade: \$(echo \$(nextclade --version 2>&1) | sed 's/^.*nextclade //; s/ .*\$//')
END_VERSIONS
"""

}
6 changes: 2 additions & 4 deletions modules/nf-core/nextclade/datasetget/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ input:
type: string
description: Name of dataset to retrieve. A list of available datasets can be obtained using the nextclade dataset list command.
pattern: ".+"
- reference:
type: string
description: Accession id to download dataset based on a particular reference sequence. A list of available datasets can be obtained using the nextclade dataset list command.
pattern: ".+"
- tag:
type: string
description: Version tag of the dataset to download. A list of available datasets can be obtained using the nextclade dataset list command.
Expand All @@ -39,3 +35,5 @@ authors:
maintainers:
- "@antunderwood"
- "@drpatelh"
updated on 2024.08.27:
- "@nmshahir"
31 changes: 25 additions & 6 deletions modules/nf-core/nextclade/datasetget/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,40 @@ nextflow_process {
tag "nextclade"
tag "nextclade/datasetget"

test("species-id-time") {

test("species-tag") {

when {
process {
"""
input[0] = 'nextstrain/sars-cov-2/wuhan-hu-1/orfs'
input[1] = '2024-01-16--20-31-02Z'
"""
}
}

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

}

test("species-tag-stub") {
options '-stub'

when {
process {
"""
input[0] = 'sars-cov-2'
input[1] = 'MN908947'
input[2] = '2022-01-18T12:00:00Z'
input[0] = 'nextstrain/sars-cov-2/wuhan-hu-1/orfs'
input[1] = '2024-01-16--20-31-02Z'
"""
}
}

then {
assertAll(
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() }
)
Expand Down
36 changes: 17 additions & 19 deletions modules/nf-core/nextclade/datasetget/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
{
"test-nextclade-datasetget": {
"species-tag": {
"content": [
{
"0": [
[
"genemap.gff:md5,21ebebfd0f416eeb959e55ebffd808e8",
"primers.csv:md5,5990c3483bf66ce607aeb90a44e7ef2e",
"qc.json:md5,c512f51fda0212b21ffff05779180963",
"CHANGELOG.md:md5,ebbe8be5a3c378ed903c1afb4d8c441d",
"README.md:md5,c69387d632361334f0d7c9b66065f947",
"genome_annotation.gff3:md5,4dff84d2d6ada820e0e3a8bc6798d402",
"pathogen.json:md5,db5bbec52359c1e168ffc5e6dc0ea32a",
"reference.fasta:md5,c7ce05f28e4ec0322c96f24e064ef55c",
"sequences.fasta:md5,41129d255b99e0e92bdf20e866b99a1b",
"tag.json:md5,402ac2b87e2a6a64a3fbf5ad16497af3",
"tree.json:md5,b8f32f547ff9e2131d6fc66b68fc54b1",
"virus_properties.json:md5,5f2de3949e07cb633f3d9e4a7654dc81"
"sequences.fasta:md5,c2a4d6cbb837dce22d81f9c36dd0629e",
"tree.json:md5,e180607cd34a6cb6bab101d295f6cedf"
]
],
"1": [
"versions.yml:md5,12e8751f1d841b9aee87d31206c102a7"
"versions.yml:md5,8c64a653330d1c5cb58ee1b8363b22d3"
],
"dataset": [
[
"genemap.gff:md5,21ebebfd0f416eeb959e55ebffd808e8",
"primers.csv:md5,5990c3483bf66ce607aeb90a44e7ef2e",
"qc.json:md5,c512f51fda0212b21ffff05779180963",
"CHANGELOG.md:md5,ebbe8be5a3c378ed903c1afb4d8c441d",
"README.md:md5,c69387d632361334f0d7c9b66065f947",
"genome_annotation.gff3:md5,4dff84d2d6ada820e0e3a8bc6798d402",
"pathogen.json:md5,db5bbec52359c1e168ffc5e6dc0ea32a",
"reference.fasta:md5,c7ce05f28e4ec0322c96f24e064ef55c",
"sequences.fasta:md5,41129d255b99e0e92bdf20e866b99a1b",
"tag.json:md5,402ac2b87e2a6a64a3fbf5ad16497af3",
"tree.json:md5,b8f32f547ff9e2131d6fc66b68fc54b1",
"virus_properties.json:md5,5f2de3949e07cb633f3d9e4a7654dc81"
"sequences.fasta:md5,c2a4d6cbb837dce22d81f9c36dd0629e",
"tree.json:md5,e180607cd34a6cb6bab101d295f6cedf"
]
],
"versions": [
"versions.yml:md5,12e8751f1d841b9aee87d31206c102a7"
"versions.yml:md5,8c64a653330d1c5cb58ee1b8363b22d3"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-23T11:33:31.41372"
"timestamp": "2024-08-27T19:55:42.211731791"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/nextclade/run/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::nextclade=2.12.0
- bioconda::nextclade=3.8.2
Loading

0 comments on commit 49aa1a5

Please sign in to comment.