diff --git a/modules/pints/caller/main.nf b/modules/pints/caller/main.nf new file mode 100644 index 00000000..a81a7354 --- /dev/null +++ b/modules/pints/caller/main.nf @@ -0,0 +1,43 @@ +process PINTS_CALLER { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::pypints=1.1.6" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pypints:1.1.6--pyh5e36f6f_1' : + 'quay.io/biocontainers/pypints:1.1.6--pyh5e36f6f_1' }" + + input: + tuple val(meta), path(bams) + + output: + tuple val(meta), path("*_divergent_peaks.bed") , emit: divergent_TREs + tuple val(meta), path("*_bidirectional_peaks.bed") , emit: bidirectional_TREs + tuple val(meta), path("*_unidirectional_peaks.bed"), emit: unidirectional_TREs + 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}" + // TODO handle bigwigs + // def input_type = ("${input[0]}".endsWith(".bam")) ? "--bam-file $input" : + // ("$input".contains(".bw")) ? "--bw-pl ${input[0]} --bw-mn ${input[1]}" : + // error "Please use bam or BigWig files" + """ + pints_caller \\ + --bam-file $bams \\ + --save-to . \\ + --file-prefix $prefix \\ + --thread $task.cpus \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(python --version | sed 's/Python //g') + pints: \$(pints_caller --version) + END_VERSIONS + """ +} diff --git a/modules/pints/caller/meta.yml b/modules/pints/caller/meta.yml new file mode 100644 index 00000000..647e5b89 --- /dev/null +++ b/modules/pints/caller/meta.yml @@ -0,0 +1,59 @@ +name: "pints_caller" +description: Main caller script for peak calling +keywords: + - peak-calling + - CoPRO + - GRO-cap + - PRO-cap + - CAGE + - NETCAGE + - RAMPAGE + - csRNA-seq + - STRIPE-seq + - PRO-seq + - GRO-seq +tools: + - "pints": + description: "Peak Identifier for Nascent Transcripts Starts (PINTS)" + homepage: "https://pints.yulab.org/" + documentation: "https://github.com/hyulab/PINTS/blob/main/README.md" + tool_dev_url: "https://github.com/hyulab/PINTS" + doi: "https://doi.org/10.1038/s41587-022-01211-7" + licence: "['GPL']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bams: + type: file + description: BAM/ file + pattern: "*.{bam}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - divergent_TREs: + type: file + description: Divergent TREs + pattern: "*_divergent_peaks.bed" + - bidirectional_TREs: + type: file + description: Divergent TREs and convergent TREs + pattern: "*_bidirectional_peaks.bed" + - unidirectional_TREs: + type: file + description: Unidirectional TREs, maybe lncRNAs transcribed from enhancers (e-lncRNAs) + pattern: "*_unidirectional_peaks.bed" + +authors: + - "@Emiller88" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b3fe0cad..6276545f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1747,6 +1747,10 @@ picard/sortvcf: - modules/picard/sortvcf/** - tests/modules/picard/sortvcf/** +pints/caller: + - modules/pints/caller/** + - tests/modules/pints/caller/** + pirate: - modules/pirate/** - tests/modules/pirate/** diff --git a/tests/modules/pints/caller/main.nf b/tests/modules/pints/caller/main.nf new file mode 100644 index 00000000..6dd7938d --- /dev/null +++ b/tests/modules/pints/caller/main.nf @@ -0,0 +1,21 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { PINTS_CALLER } from '../../../../modules/pints/caller/main.nf' + +workflow test_pints_caller { + + input = [ + [ id:'test', single_end:false ], // meta map + // FIXME Fails if it doesn't find any signals + [file("https://raw.githubusercontent.com/Kraus-Lab/groHMM/master/inst/extdata/S0mR1.bam", checkIfExists: true), + file("https://raw.githubusercontent.com/Kraus-Lab/groHMM/master/inst/extdata/S40mR1.bam", checkIfExists: true)] + ] + + PINTS_CALLER ( input ) +} + +// TODO Test single bam input +// TODO Test single bigwig input +// TODO Test multiple bigwig input diff --git a/tests/modules/pints/caller/nextflow.config b/tests/modules/pints/caller/nextflow.config new file mode 100644 index 00000000..67bd466d --- /dev/null +++ b/tests/modules/pints/caller/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: PINTS_CALLER { + ext.args = "--exp-type GROseq" + ext.singularity_pull_docker_container = true + } +} diff --git a/tests/modules/pints/caller/test.yml b/tests/modules/pints/caller/test.yml new file mode 100644 index 00000000..296fdb90 --- /dev/null +++ b/tests/modules/pints/caller/test.yml @@ -0,0 +1,16 @@ +- name: "pints caller" + command: nextflow run ./tests/modules/pints/caller -entry test_pints_caller -c ./tests/config/nextflow.config -c ./tests/modules/pints/caller/nextflow.config + tags: + - "pints" + - "pints/caller" + files: + - path: output/pints/test_1_bidirectional_peaks.bed + md5sum: 8c69305ab896bd772e450e938ddf45f0 + - path: output/pints/test_1_divergent_peaks.bed + md5sum: 2078c643951071f5836d365e5dc7ba1c + - path: output/pints/test_1_unidirectional_peaks.bed + - path: output/pints/test_2_bidirectional_peaks.bed + md5sum: c4efa0f297ba4cdb00659c5e6700ebe5 + - path: output/pints/test_2_divergent_peaks.bed + md5sum: 213a2ba5d9930768d76bf2a7d8c3f7fb + - path: output/pints/test_2_unidirectional_peaks.bed