bedtools/genomecov updated to allow for providing a per-sample scale factor (#799)

* hifiasm copied from fastqc

* hifiasm tests init from fastqc

* meta.yml init; test.yml and main.nf for printing version

* Add hifiasm version printing

* Removed spaced on an empty line

* Reverted hifiasm from main

* Added genomecov scale module

* Updated tagging

* Removed extra module - began merging

* Removed extra module tests

* Updated genomecov to take a scale value

* Updated line endings

* Removed redundant test

* Update tests/modules/bedtools/genomecov/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Added checking for existing -bg arg

* Update modules/bedtools/genomecov/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update modules/bedtools/genomecov/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

Co-authored-by: Sviatoslav Sidorov <sviatoslav.sidorov@crick.ac.uk>
Co-authored-by: Svyatoslav Sidorov <svet.sidorov@gmail.com>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
Chris Cheshire 2021-10-28 17:50:25 +01:00 committed by GitHub
parent 1662201102
commit e8b33e6eb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 12 deletions

View file

@ -19,7 +19,7 @@ process BEDTOOLS_GENOMECOV {
}
input:
tuple val(meta), path(intervals)
tuple val(meta), path(intervals), val(scale)
path sizes
val extension
@ -28,13 +28,21 @@ process BEDTOOLS_GENOMECOV {
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def args_token = options.args.tokenize()
def args = options.args
args += (scale > 0 && scale != 1) ? " -scale $scale" : ""
if (!args_token.contains('-bg') && (scale > 0 && scale != 1)) {
args += " -bg"
}
if (intervals.name =~ /\.bam/) {
"""
bedtools \\
genomecov \\
-ibam $intervals \\
$options.args \\
$args \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
@ -48,7 +56,7 @@ process BEDTOOLS_GENOMECOV {
genomecov \\
-i $intervals \\
-g $sizes \\
$options.args \\
$args \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml

View file

@ -20,6 +20,9 @@ input:
type: file
description: BAM/BED/GFF/VCF
pattern: "*.{bam|bed|gff|vcf}"
- scale:
type: value
description: Number containing the scale factor for the output. Set to 1 to disable. Setting to a value other than 1 will also get the -bg bedgraph output format as this is required for this command switch
- sizes:
type: file
description: Tab-delimited table of chromosome names in the first column and chromosome sizes in the second column
@ -45,3 +48,4 @@ authors:
- "@sruthipsuresh"
- "@drpatelh"
- "@sidorov-si"
- "@chris-cheshire"

View file

@ -4,10 +4,37 @@ nextflow.enable.dsl = 2
include { BEDTOOLS_GENOMECOV } from '../../../../modules/bedtools/genomecov/main.nf' addParams( options: [suffix: '_out'] )
workflow test_bedtools_genomecov {
workflow test_bedtools_genomecov_noscale {
input = [
[ id:'test'],
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true),
1
]
sizes = []
extension = 'txt'
BEDTOOLS_GENOMECOV ( input, sizes, extension )
}
workflow test_bedtools_genomecov_nonbam_noscale {
input = [
[ id:'test'],
file(params.test_data['sarscov2']['genome']['baits_bed'], checkIfExists: true),
1
]
sizes = file(params.test_data['sarscov2']['genome']['genome_sizes'], checkIfExists: true)
extension = 'txt'
BEDTOOLS_GENOMECOV ( input, sizes, extension )
}
workflow test_bedtools_genomecov_scale {
input = [
[ id:'test'],
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true),
0.5
]
sizes = file('dummy_chromosome_sizes')
@ -16,10 +43,11 @@ workflow test_bedtools_genomecov {
BEDTOOLS_GENOMECOV ( input, sizes, extension )
}
workflow test_bedtools_genomecov_nonbam {
workflow test_bedtools_genomecov_nonbam_scale {
input = [
[ id:'test'],
file(params.test_data['sarscov2']['genome']['baits_bed'], checkIfExists: true)
file(params.test_data['sarscov2']['genome']['baits_bed'], checkIfExists: true),
0.5
]
sizes = file(params.test_data['sarscov2']['genome']['genome_sizes'], checkIfExists: true)

View file

@ -1,5 +1,5 @@
- name: bedtools genomecov test_bedtools_genomecov
command: nextflow run ./tests/modules/bedtools/genomecov -entry test_bedtools_genomecov -c tests/config/nextflow.config
- name: bedtools genomecov test_bedtools_genomecov_noscale
command: nextflow run ./tests/modules/bedtools/genomecov -entry test_bedtools_genomecov_noscale -c tests/config/nextflow.config
tags:
- bedtools
- bedtools/genomecov
@ -7,11 +7,29 @@
- path: output/bedtools/test_out.txt
md5sum: 66083198daca6c001d328ba9616e9b53
- name: bedtools genomecov test_bedtools_genomecov_nonbam
command: nextflow run tests/modules/bedtools/genomecov -entry test_bedtools_genomecov_nonbam -c tests/config/nextflow.config
- name: bedtools genomecov test_bedtools_genomecov_nonbam_noscale
command: nextflow run tests/modules/bedtools/genomecov -entry test_bedtools_genomecov_nonbam_noscale -c tests/config/nextflow.config
tags:
- bedtools
- bedtools/genomecov
files:
- path: output/bedtools/test_out.txt
md5sum: f47b58840087426e5b643d8dfd155c1f
- name: bedtools genomecov test_bedtools_genomecov_scale
command: nextflow run ./tests/modules/bedtools/genomecov -entry test_bedtools_genomecov_scale -c tests/config/nextflow.config
tags:
- bedtools
- bedtools/genomecov
files:
- path: output/bedtools/test_out.txt
md5sum: 01291b6e1beab72e046653e709eb0e10
- name: bedtools genomecov test_bedtools_genomecov_nonbam_scale
command: nextflow run tests/modules/bedtools/genomecov -entry test_bedtools_genomecov_nonbam_scale -c tests/config/nextflow.config
tags:
- bedtools
- bedtools/genomecov
files:
- path: output/bedtools/test_out.txt
md5sum: de3c59c0ea123bcdbbad27bc0a0a601e