Skip to content

Commit

Permalink
htseq/count module is implemented (nf-core#4085)
Browse files Browse the repository at this point in the history
* htseq/count module is implemented

* Update meta.yml

bam.bai changed to .bai

* Added meta2

* Implemented changes from review

* update pytest runner

* Update modules/nf-core/htseq/count/main.nf

Co-authored-by: Nicolas Vannieuwkerke <[email protected]>

---------

Co-authored-by: Maxime U Garcia <[email protected]>
Co-authored-by: Nicolas Vannieuwkerke <[email protected]>
Co-authored-by: mashehu <[email protected]>
  • Loading branch information
4 people authored Oct 18, 2023
1 parent bde9f9d commit e18a2de
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 0 deletions.
49 changes: 49 additions & 0 deletions modules/nf-core/htseq/count/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process HTSEQ_COUNT {
tag "$meta.id"
label 'process_medium'

conda "bioconda::htseq=2.0.2"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/htseq:2.0.2--py310ha14a713_0':
'biocontainers/htseq:2.0.2--py310ha14a713_0' }"

input:
tuple val(meta), path(input), path(index)
tuple val(meta2), path(gtf)

output:
tuple val(meta), path("*.txt"), emit: txt
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}"

"""
htseq-count \\
${input} \\
${gtf} \\
${args} \\
> ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
htseq: \$(echo \$(htseq-count --version ) | sed 's/^.*htseq-count //; s/Using.*\$//' ))
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
: \$(echo \$(htseq-count --version ) | sed 's/^.*htseq-count //; s/Using.*\$//' ))
END_VERSIONS
"""
}
53 changes: 53 additions & 0 deletions modules/nf-core/htseq/count/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: "htseq_count"
description: count how many reads map to each feature
keywords:
- htseq
- count
- gtf
- annotation
tools:
- "htseq/count":
description: "HTSeq is a Python library to facilitate processing and analysis of data from high-throughput sequencing (HTS) experiments."
homepage: "https://htseq.readthedocs.io/en/latest/"
documentation: "https://htseq.readthedocs.io/en/latest/index.html"
doi: "10.1093/bioinformatics/btu638"
licence: "['GPL v3']"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- meta2:
type: map
description: |
.gtf file information
e.g. `[ id:'test' ]`
- input:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- index:
type: file
description: Contains indexed bam file
pattern: "*.bai"
- gtf:
type: file
description: Contains the features in the GTF format
pattern: "*.gtf"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- txt:
type: file
description: File containing feature counts output
pattern: ".txt"

authors:
- "@zehrahazalsezer"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,10 @@ hpsuissero:
- modules/nf-core/hpsuissero/**
- tests/modules/nf-core/hpsuissero/**

htseq/count:
- modules/nf-core/htseq/count/**
- tests/modules/nf-core/htseq/count/**

hypo:
- modules/nf-core/hypo/**
- tests/modules/nf-core/hypo/**
Expand Down
40 changes: 40 additions & 0 deletions tests/modules/nf-core/htseq/count/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { HTSEQ_COUNT } from '../../../../../modules/nf-core/htseq/count/main.nf'

workflow test_htseq_count_bam {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)

]
gtf = [
[ id:'test2'], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
]


HTSEQ_COUNT (input,gtf)
}

workflow test_htseq_count_cram {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true)

]
gtf = [
[ id:'test2'], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
]


HTSEQ_COUNT (input,gtf)
}

6 changes: 6 additions & 0 deletions tests/modules/nf-core/htseq/count/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
docker.registry = 'quay.io'

}
19 changes: 19 additions & 0 deletions tests/modules/nf-core/htseq/count/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- name: htseq count test_htseq_count_bam
command: nextflow run ./tests/modules/nf-core/htseq/count -entry test_htseq_count_bam -c ./tests/config/nextflow.config
tags:
- htseq
- htseq/count
files:
- path: output/htseq/test.txt
md5sum: 5e37b2292f1d21945acb532afa5eb615
- path: output/htseq/versions.yml

- name: htseq count test_htseq_count_cram
command: nextflow run ./tests/modules/nf-core/htseq/count -entry test_htseq_count_cram -c ./tests/config/nextflow.config
tags:
- htseq
- htseq/count
files:
- path: output/htseq/test.txt
md5sum: 53f9b007bd72115e8b72a40f859bc896
- path: output/htseq/versions.yml

0 comments on commit e18a2de

Please sign in to comment.