Skip to content

Commit

Permalink
add new module iCount-mini/metagene (nf-core#3612)
Browse files Browse the repository at this point in the history
* add module template

* first version

* update testing and linting

* update file naming

* update test

* fix test
  • Loading branch information
CharlotteAnne authored and snesic committed Oct 10, 2023
1 parent c32c0e6 commit c441209
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 0 deletions.
48 changes: 48 additions & 0 deletions modules/nf-core/icountmini/metagene/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process ICOUNTMINI_METAGENE {
tag "$meta.id"
label 'process_low'

conda "bioconda::icount-mini=3.0.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/icount-mini:3.0.0--pyh7cba7a3_0':
'biocontainers/icount-mini:3.0.0--pyh7cba7a3_0' }"

input:
tuple val(meta), path(bed)
path segmentation

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

"""
mv $bed ${prefix}.bed
iCount-Mini metagene \\
${prefix}.bed \\
$segmentation \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
iCount-Mini: \$(iCount-Mini -v)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch metagene_${prefix}/${prefix}_plot_data.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
iCount-Mini: \$(iCount-Mini -v)
END_VERSIONS
"""
}
44 changes: 44 additions & 0 deletions modules/nf-core/icountmini/metagene/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: icountmini_metagene
description: Plot a metagene of cross-link events/sites around various transcriptomic landmarks.
keywords:
- iCLIP
- gtf
- genomics
tools:
- icount:
description: Computational pipeline for analysis of iCLIP data
homepage: https://icount.readthedocs.io/en/latest/
documentation: https://icount.readthedocs.io/en/latest/
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bed:
type: file
description: BED file of crosslinks
- segmentation:
type: file
description: A iCount segmentation file
pattern: "*.{gtf}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- tsv:
type: file
description: Metagene table
pattern: "*.tsv"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@marc-jones"
- "@chris-cheshire"
- "@charlotteanne"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,10 @@ ichorcna/run:
- modules/nf-core/ichorcna/run/**
- tests/modules/nf-core/ichorcna/run/**

icountmini/metagene:
- modules/nf-core/icountmini/metagene/**
- tests/modules/nf-core/icountmini/metagene/**

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

nextflow.enable.dsl = 2

include { ICOUNTMINI_SEGMENT } from '../../../../../modules/nf-core/icountmini/segment/main.nf'
include { ICOUNTMINI_METAGENE} from '../../../../../modules/nf-core/icountmini/metagene/main.nf'

workflow test_icountmini_metagene {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_21_gencode_gtf'], checkIfExists: true)
]

ICOUNTMINI_SEGMENT (
input,
file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true)
)

bed = [
[ id:'test' ], // meta map
file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/crosslinks/clippy.bed", checkIfExists: true)
]

ICOUNTMINI_METAGENE (
bed,
ICOUNTMINI_SEGMENT.out.gtf.map{ it[1] }
)
}

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

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

}
9 changes: 9 additions & 0 deletions tests/modules/nf-core/icountmini/metagene/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: icountmini metagene test_icountmini_metagene
command: nextflow run ./tests/modules/nf-core/icountmini/metagene -entry test_icountmini_metagene -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/icountmini/metagene/nextflow.config
tags:
- icountmini
- icountmini/metagene
files:
- path: output/icountmini/metagene_test/test_plot_data.tsv
md5sum: 63032c9e159e81f617e30bcb1c3c8509
- path: output/icountmini/versions.yml

0 comments on commit c441209

Please sign in to comment.