Skip to content

Commit

Permalink
ADD tabix index for indexcov (#6121)
Browse files Browse the repository at this point in the history
* add tabix index for indexcov

* Update snapshot

* Pin htslib

---------

Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
lindenb and SPPearce authored Aug 22, 2024
1 parent 51076a8 commit 1667117
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 260 deletions.
1 change: 1 addition & 0 deletions modules/nf-core/goleft/indexcov/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ channels:
- defaults
dependencies:
- bioconda::goleft=0.2.4
- bioconda::htslib=1.12
24 changes: 16 additions & 8 deletions modules/nf-core/goleft/indexcov/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ process GOLEFT_INDEXCOV {
tuple val(meta2), path(fai)

output:
tuple val(meta), path("${prefix}/*") , emit: output
tuple val(meta), path("${prefix}/*ped") , emit: ped , optional: true
tuple val(meta), path("${prefix}/*bed.gz"), emit: bed , optional: true
tuple val(meta), path("${prefix}/*roc") , emit: roc , optional: true
tuple val(meta), path("${prefix}/*html") , emit: html, optional: true
tuple val(meta), path("${prefix}/*png") , emit: png , optional: true
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}/*") , emit: output
tuple val(meta), path("${prefix}/*ped") , emit: ped , optional: true
tuple val(meta), path("${prefix}/*bed.gz") , emit: bed , optional: true
tuple val(meta), path("${prefix}/*bed.gz.tbi"), emit: bed_index , optional: true
tuple val(meta), path("${prefix}/*roc") , emit: roc , optional: true
tuple val(meta), path("${prefix}/*html") , emit: html, optional: true
tuple val(meta), path("${prefix}/*png") , emit: png , optional: true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -37,21 +38,28 @@ process GOLEFT_INDEXCOV {
$args \\
${input_files.join(" ")}
if [ -f "${prefix}/${prefix}-indexcov.bed.gz" ] ; then
tabix -p bed "${prefix}/${prefix}-indexcov.bed.gz"
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
goleft: \$(goleft --version 2>&1 | head -n 1 | sed 's/^.*goleft Version: //')
tabix: \$(echo \$(tabix -h 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS
"""
stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir "${prefix}"
touch "${prefix}/${prefix}-indexcov.bed.gz"
echo "" | gzip > "${prefix}/${prefix}-indexcov.bed.gz"
touch "${prefix}/${prefix}-indexcov.bed.gz.tbi"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
goleft: \$(goleft --version 2>&1 | head -n 1 | sed 's/^.*goleft Version: //')
tabix: \$(echo \$(tabix -h 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS
"""
}
27 changes: 22 additions & 5 deletions modules/nf-core/goleft/indexcov/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ nextflow_process {
[ id:'test' ], // meta map
[
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.single_end.sorted.bam", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam", checkIfExists: true)
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam", checkIfExists: true)
],
[
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai", checkIfExists: true)
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai", checkIfExists: true)
],
])
Expand All @@ -39,7 +39,15 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.ped,
process.out.bed,
file(process.out.bed_index[0][1]).name,
process.out.roc,
process.out.html,
process.out.png,
process.out.versions
).match() }
)
}

Expand Down Expand Up @@ -76,7 +84,15 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.ped,
process.out.bed,
file(process.out.bed_index[0][1]).name,
process.out.roc,
process.out.html,
process.out.png,
process.out.versions
).match() }
)
}

Expand Down Expand Up @@ -105,7 +121,8 @@ nextflow_process {

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

Expand Down
Loading

0 comments on commit 1667117

Please sign in to comment.