Commit b8cfd2b0 authored by Chris Cheshire's avatar Chris Cheshire
Browse files

Added peaking calling normalisation options

parent ff5bcd9b
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -440,15 +440,38 @@ if (params.run_mark_dups) {
========================================================================================
*/

if(params.run_peak_calling) {
if(params.run_peak_calling && (params.normalisation_mode == "Spikein" || params.normalisation_mode == "None")) {
    process {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:BEDTOOLS_GENOMECOV' {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:PREPARE_PEAKCALLING:BEDTOOLS_GENOMECOV' {
            ext.args = "-bg"
            publishDir = [
                enabled: false
            ]
        }
    }
}

        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:BEDTOOLS_SORT' {
if(params.run_peak_calling && (params.normalisation_mode != "Spikein" && params.normalisation_mode != "None")) {
    process {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:PREPARE_PEAKCALLING:DEEPTOOLS_BAMCOVERAGE' {
            ext.args   = [
                '--outFileFormat bedgraph',
                '--skipNAs',
                "--binSize ${params.normalisation_binsize}",
                "--normalizeUsing ${params.normalisation_mode}"
            ].join(' ').trim()
            ext.prefix = { "${meta.id}.bedgraph" }
            publishDir = [
                enabled: false
            ]
            cache = false
        }
    }
}

if(params.run_peak_calling) {
    process {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:PREPARE_PEAKCALLING:BEDTOOLS_SORT' {
            ext.prefix = { "${meta.id}.sorted" }
            publishDir = [
                path: { "${params.outdir}/03_peak_calling/01_bam_to_bedgraph" },
@@ -458,7 +481,7 @@ if(params.run_peak_calling) {
            ]
        }

        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:UCSC_BEDCLIP' {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:PREPARE_PEAKCALLING:UCSC_BEDCLIP' {
            ext.prefix = { "${meta.id}.clipped" }
            publishDir = [
                path: { "${params.outdir}/03_peak_calling/02_clip_bed" },
@@ -468,7 +491,7 @@ if(params.run_peak_calling) {
            ]
        }

        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:UCSC_BEDGRAPHTOBIGWIG' {
        withName: 'NFCORE_CUTANDRUN:CUTANDRUN:PREPARE_PEAKCALLING:UCSC_BEDGRAPHTOBIGWIG' {
            publishDir = [
                path: { "${params.outdir}/03_peak_calling/03_bed_to_bigwig" },
                mode: 'copy',
@@ -542,7 +565,6 @@ if(params.run_peak_calling) {
                saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
                enabled: true
            ]
            cache = false
        }

        withName: '.*:CONSENSUS_PEAKS:PLOT_CONSENSUS_PEAKS|.*:CONSENSUS_PEAKS_ALL:PLOT_CONSENSUS_PEAKS' {
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@
            "custom/getchromsizes": {
                "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d"
            },
            "deeptools/bamcoverage": {
                "git_sha": "fdb1664885480d9411c24ba45bb4fde4738e5907"
            },
            "deeptools/computematrix": {
                "git_sha": "e745e167c1020928ef20ea1397b6b4d230681b4d"
            },
+37 −0
Original line number Diff line number Diff line
process DEEPTOOLS_BAMCOVERAGE {
    tag "$meta.id"
    label 'process_low'

    conda (params.enable_conda ? "bioconda::deeptools=3.5.1" : null)
    container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
        'https://depot.galaxyproject.org/singularity/deeptools:3.5.1--py_0':
        'quay.io/biocontainers/deeptools:3.5.1--py_0' }"

    input:
    tuple val(meta), path(input), path(input_index)

    output:
    tuple val(meta), path("*.bigWig")   , emit: bigwig, optional: true
    tuple val(meta), path("*.bedgraph") , emit: bedgraph, optional: true
    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}.bigWig"

    """
    bamCoverage \
    --bam $input \
    $args \
    --numberOfProcessors ${task.cpus} \
    --outFileName ${prefix}

    cat <<-END_VERSIONS > versions.yml
    "${task.process}":
        deeptools: \$(bamCoverage --version | sed -e "s/bamCoverage //g")
    END_VERSIONS
    """
}
+49 −0
Original line number Diff line number Diff line
name: deeptools_bamcoverage
description: This tool takes an alignment of reads or fragments as input (BAM file) and generates a coverage track (bigWig or bedGraph) as output.
keywords:
  - sort
tools:
  - deeptools:
      description: A set of user-friendly tools for normalization and visualzation of deep-sequencing data
      homepage: https://deeptools.readthedocs.io/en/develop/content/tools/bamCoverage.html
      documentation: https://deeptools.readthedocs.io/en/develop/content/tools/bamCoverage.html
      tool_dev_url: https://github.com/deeptools/deepTools/
      doi: "https://doi.org/10.1093/nar/gkw257"
      licence: ['GPL v3']

input:
  - meta:
      type: map
      description: |
        Groovy Map containing sample information
        e.g. [ id:'test', single_end:false ]
  - input:
      type: file
      description: BAM/CRAM file
      pattern: "*.{bam,cram}"
  - input_index:
      type: file
      description: BAM/CRAM index file
      pattern: "*.{bai,crai}"

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"
  - bigWig:
      type: file
      description: BigWig file
      pattern: "*.bigWig"
  - bedgraph:
      type: file
      description: Bedgraph file
      pattern: "*.bedgraph"

authors:
  - "@FriederikeHanssen"
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ params {
    only_filtering             = false

    // Read Normalisation
    skip_scale                 = false
    normalisation_mode         = "Spikein"
    normalisation_binsize      = 1
    normalisation_c            = 10000

    // Peak Caller default param
Loading