Refactor genrich to avoid params in main (#981)

* Refactor genrich to avoid params in main

* Missed to commit test.yml file
This commit is contained in:
Jose Espinosa-Carrasco 2021-10-29 16:37:39 +02:00 committed by GitHub
parent a4943a9e57
commit 0a7368aa6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 26 deletions

View file

@ -22,6 +22,10 @@ process GENRICH {
tuple val(meta), path(treatment_bam) tuple val(meta), path(treatment_bam)
path control_bam path control_bam
path blacklist_bed path blacklist_bed
val save_pvalues
val save_pileup
val save_bed
val save_duplicates
output: output:
tuple val(meta), path("*narrowPeak") , emit: peaks tuple val(meta), path("*narrowPeak") , emit: peaks
@ -32,14 +36,14 @@ process GENRICH {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def control = params.control_bam ? "-c $control_bam" : '' def control = control_bam ? "-c $control_bam" : ''
def pvalues = params.pvalues ? "-f ${prefix}.pvalues.bedGraph" : "" def blacklist = blacklist_bed ? "-E $blacklist_bed" : ""
def pileup = params.pileup ? "-k ${prefix}.pileup.bedGraph" : "" def pvalues = save_pvalues ? "-f ${prefix}.pvalues.bedGraph" : ""
def bed = params.bed ? "-b ${prefix}.intervals.bed" : "" def pileup = save_pileup ? "-k ${prefix}.pileup.bedGraph" : ""
def blacklist = params.blacklist_bed ? "-E $blacklist_bed" : "" def bed = save_bed ? "-b ${prefix}.intervals.bed" : ""
def duplicates = "" def duplicates = ""
if (params.save_duplicates) { if (save_duplicates) {
if (options.args.contains('-r')) { if (options.args.contains('-r')) {
duplicates = "-R ${prefix}.duplicates.txt" duplicates = "-R ${prefix}.duplicates.txt"
} else { } else {
@ -58,7 +62,6 @@ process GENRICH {
$pileup \\ $pileup \\
$bed \\ $bed \\
$duplicates \\ $duplicates \\
$blacklist \\
$control $control
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml

View file

@ -15,7 +15,6 @@ tools:
tool_dev_url: https://github.com/jsh58/Genrich tool_dev_url: https://github.com/jsh58/Genrich
doi: "" doi: ""
licence: ['MIT'] licence: ['MIT']
input: input:
- meta: - meta:
type: map type: map
@ -34,7 +33,18 @@ input:
type: file type: file
description: Bed file containing genomic intervals to exclude from the analysis description: Bed file containing genomic intervals to exclude from the analysis
pattern: "*.{bed}" pattern: "*.{bed}"
- save_pvalues:
type: boolean
description: Create bedgraph-ish file for p/q-values file
- save_pileup:
type: boolean
description: Create bedgraph-ish file for pileups and p-values
- save_bed:
type: boolean
description: Create BED file for reads/fragments/intervals
- save_duplicates:
type: boolean
description: Create PCR duplicates file (only works if -r option is set)
output: output:
- meta: - meta:
type: map type: map
@ -65,7 +75,6 @@ output:
type: file type: file
description: File containing software version description: File containing software version
pattern: "*.{version.txt}" pattern: "*.{version.txt}"
authors: authors:
- "@JoseEspinosa" - "@JoseEspinosa"

View file

@ -2,10 +2,10 @@
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
include { GENRICH } from '../../../modules/genrich/main.nf' addParams( control_bam: false, pvalues: false, pileup:false, bed:false, blacklist_bed:false, save_duplicates:false, options: ["args": "-p 0.1"] ) include { GENRICH } from '../../../modules/genrich/main.nf' addParams( options: ["args": "-p 0.1"] )
include { GENRICH as GENRICH_BLACKLIST } from '../../../modules/genrich/main.nf' addParams( control_bam: false, pvalues: false, pileup:false, bed:false, blacklist_bed:true, save_duplicates:false, options: ["args": "-p 0.1"] ) include { GENRICH as GENRICH_CTRL } from '../../../modules/genrich/main.nf' addParams( options: ["args": "-p 0.9"] )
include { GENRICH as GENRICH_ALL_OUTPUTS } from '../../../modules/genrich/main.nf' addParams( control_bam: false, pvalues: true, pileup:true, bed:true, blacklist_bed:false, save_duplicates:true, options: ["args": "-r -p 0.1"] ) include { GENRICH as GENRICH_ALL } from '../../../modules/genrich/main.nf' addParams( options: ["args": "-r -p 0.1"] )
include { GENRICH as GENRICH_ATACSEQ } from '../../../modules/genrich/main.nf' addParams( control_bam: false, pvalues: false, pileup:false, bed:false, blacklist_bed:false, save_duplicates:false, options: ["args": "-j -p 0.1"] ) include { GENRICH as GENRICH_ATACSEQ } from '../../../modules/genrich/main.nf' addParams( options: ["args": "-j -p 0.1"] )
workflow test_genrich { workflow test_genrich {
input = [ [ id:'test', single_end:false ], // meta map input = [ [ id:'test', single_end:false ], // meta map
@ -13,7 +13,12 @@ workflow test_genrich {
control = [ ] control = [ ]
blacklist = [ ] blacklist = [ ]
GENRICH ( input, control, blacklist ) save_pvalues = false
save_pileup = false
save_bed = false
save_duplicates = false
GENRICH ( input, control, blacklist, save_pvalues, save_pileup, save_bed, save_duplicates )
} }
workflow test_genrich_ctrl { workflow test_genrich_ctrl {
@ -22,7 +27,12 @@ workflow test_genrich_ctrl {
control = [ file( params.test_data['homo_sapiens']['illumina']['test2_paired_end_name_sorted_bam'], checkIfExists: true) ] control = [ file( params.test_data['homo_sapiens']['illumina']['test2_paired_end_name_sorted_bam'], checkIfExists: true) ]
blacklist = [ ] blacklist = [ ]
GENRICH ( input, control, blacklist ) save_pvalues = false
save_pileup = false
save_bed = false
save_duplicates = false
GENRICH_CTRL ( input, control, blacklist, save_pvalues, save_pileup, save_bed, save_duplicates )
} }
workflow test_genrich_all_outputs { workflow test_genrich_all_outputs {
@ -31,14 +41,39 @@ workflow test_genrich_all_outputs {
control = [ file( params.test_data['homo_sapiens']['illumina']['test2_paired_end_name_sorted_bam'], checkIfExists: true) ] control = [ file( params.test_data['homo_sapiens']['illumina']['test2_paired_end_name_sorted_bam'], checkIfExists: true) ]
blacklist = [ ] blacklist = [ ]
GENRICH_ALL_OUTPUTS ( input, control, blacklist ) save_pvalues = true
save_pileup = true
save_bed = true
save_duplicates = true
GENRICH_ALL ( input, control, blacklist, save_pvalues, save_pileup, save_bed, save_duplicates )
}
workflow test_genrich_blacklist {
input = [ [ id:'test', single_end:false ], // meta map
[ file( params.test_data['homo_sapiens']['illumina']['test_paired_end_name_sorted_bam'], checkIfExists: true) ]]
control = [ ]
blacklist = [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)]
save_pvalues = false
save_pileup = false
save_bed = false
save_duplicates = false
GENRICH ( input, control, blacklist, save_pvalues, save_pileup, save_bed, save_duplicates )
} }
workflow test_genrich_atacseq { workflow test_genrich_atacseq {
input = [ [ id:'test', single_end:false ], // meta map input = [ [ id:'test', single_end:false ], // meta map
[ file( params.test_data['homo_sapiens']['illumina']['test_paired_end_name_sorted_bam'], checkIfExists: true) ]] [ file( params.test_data['homo_sapiens']['illumina']['test_paired_end_name_sorted_bam'], checkIfExists: true) ]]
control = [ file( params.test_data['homo_sapiens']['illumina']['test2_paired_end_name_sorted_bam'], checkIfExists: true) ] control = [ ]
blacklist = [ ] blacklist = [ ]
GENRICH_ATACSEQ ( input, control, blacklist ) save_pvalues = false
save_pileup = false
save_bed = false
save_duplicates = false
GENRICH_ATACSEQ ( input, control, blacklist, save_pvalues, save_pileup, save_bed, save_duplicates )
} }

View file

@ -12,7 +12,7 @@
- genrich - genrich
files: files:
- path: output/genrich/test.narrowPeak - path: output/genrich/test.narrowPeak
md5sum: 6afabdd3f691c7c84c66ff8a23984681 md5sum: 2fcc392360b317f5ebee88cdbc149e05
- name: genrich test_genrich_all_outputs - name: genrich test_genrich_all_outputs
command: nextflow run tests/modules/genrich -entry test_genrich_all_outputs -c tests/config/nextflow.config command: nextflow run tests/modules/genrich -entry test_genrich_all_outputs -c tests/config/nextflow.config
@ -20,15 +20,23 @@
- genrich - genrich
files: files:
- path: output/genrich/test.duplicates.txt - path: output/genrich/test.duplicates.txt
md5sum: a92893f905fd8b3751bc6a960fbfe7ba md5sum: 159d557af7c23bc3cfb802d87fa96c34
- path: output/genrich/test.intervals.bed - path: output/genrich/test.intervals.bed
md5sum: 52edf47e6641c0cc03f9cca7324f7eaa md5sum: 4bea65caa3f4043d703af4b57161112e
- path: output/genrich/test.narrowPeak - path: output/genrich/test.narrowPeak
md5sum: e45eb7d000387975050c2e85c164e5be md5sum: d41d8cd98f00b204e9800998ecf8427e
- path: output/genrich/test.pileup.bedGraph - path: output/genrich/test.pileup.bedGraph
md5sum: e4f7fa664cd4ed2cf3a1a3a9eb415e71 md5sum: 03e53848de695b5794f32f15b2709203
- path: output/genrich/test.pvalues.bedGraph - path: output/genrich/test.pvalues.bedGraph
md5sum: 564859953704983393d4b7d6317060cd md5sum: b14feef34b6d2379a173a734ca963cde
- name: genrich test_genrich_blacklist
command: nextflow run tests/modules/genrich -entry test_genrich_blacklist -c tests/config/nextflow.config
tags:
- genrich
files:
- path: output/genrich/test.narrowPeak
md5sum: 6afabdd3f691c7c84c66ff8a23984681
- name: genrich test_genrich_atacseq - name: genrich test_genrich_atacseq
command: nextflow run tests/modules/genrich -entry test_genrich_atacseq -c tests/config/nextflow.config command: nextflow run tests/modules/genrich -entry test_genrich_atacseq -c tests/config/nextflow.config