Skip to content

Commit

Permalink
Merge pull request #37 from CCBR/consensus-peaks
Browse files Browse the repository at this point in the history
feat: add consensus peaks subworkflow
  • Loading branch information
kelly-sovacool authored Nov 29, 2023
2 parents f831b0c + 8917fd9 commit 0dd8b5e
Show file tree
Hide file tree
Showing 56 changed files with 2,146 additions and 1 deletion.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

### New modules

- bedops/bedmap (#37)
- bedtools/map (#37)
- bedtools/merge (#37)
- bedtools/sort (#37)
- cat/cat (#37)
- cat/fastq (#37)
- custom/combinepeakcounts (#37)
- custom/consensuspeaks (#37)
- custom/normalizepeaks (#37)

### New subworkflows

- consensus_peaks (#37)

## nf-modules 0.1.0

Our documentation website is now live: <https://ccbr.github.io/nf-modules/> (#16)
Expand All @@ -24,4 +36,4 @@ Our documentation website is now live: <https://ccbr.github.io/nf-modules/> (#16

### New subworkflows

- custom/filter_blacklist (#17,#27)
- filter_blacklist (#17,#27)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Want to **contribute** to this project? Check out the [contributing guidelines](
Many of the modules and subworkflows in this project reuse and adapt code from [nf-core/modules](https://github.com/nf-core/modules).
In those cases, credit is noted in the `meta.yml` file of the module/subworkflow and also listed here:

- [bedtools](modules/CCBR/bedtools) adapts the [nf-core bedtools module](https://github.com/nf-core/modules/tree/fff2c3fc7cdcb81a2a37c3263b8ace9b353af407/modules/nf-core/bedtools)
- [bwa](modules/CCBR/bwa) adapts the [nf-core bwa module](https://github.com/nf-core/chipseq/tree/51eba00b32885c4d0bec60db3cb0a45eb61e34c5/modules/nf-core/modules/bwa)
- [cat](modules/cat) adapts the [nf-core cat module](https://github.com/nf-core/modules/tree/9326d73af3fbe2ee90d9ce0a737461a727c5118e/modules/nf-core/cat)
- [cutadapt](modules/CCBR/cutadapt) adapts the [nf-core cutadapt module](https://github.com/nf-core/modules/tree/ef007b1ce5316506b8c27c3e7a62482409c6153c/modules/nf-core/cutadapt)
- [khmer](modules/CCBR/khmer) adapts the [nf-core khmer module](https://github.com/nf-core/modules/tree/b48a1efc8e067502e1a9bafbac788c1e0abdfc6a/modules/nf-core/khmer)
- [picard/samtofastq](modules/picard/samtofastq) adapts the [nf-core gatk4 samtofastq module](https://github.com/nf-core/modules/tree/ef007b1ce5316506b8c27c3e7a62482409c6153c/modules/nf-core/gatk4/samtofastq)
Expand Down
41 changes: 41 additions & 0 deletions modules/CCBR/bedops/bedmap/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
process BEDOPS_BEDMAP {
tag "${meta.id}.${refmeta.id}"
label 'process_single'
container 'nciccbr/ccbr_ubuntu_base_20.04:v6.1'

input:
tuple val(meta), path(mapbed), val(refmeta), path(refbed)

output:
tuple val(meta), path("*.mapped.bed"), emit: bed
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
"""
bedmap \\
--delim '\t' \\
--echo-ref-name \\
--count \\
${refbed} \\
${mapbed} \\
> ${meta.id}.${refmeta.id}.mapped.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedops: \$(echo \$(bedops --version 2>&1 | grep version | sed 's/version: //'))
END_VERSIONS
"""

stub:
"""
touch ${meta.id}.${refmeta.id}.mapped.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedops: \$(echo \$(bedops --version 2>&1 | grep version | sed 's/version: //'))
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/CCBR/bedops/bedmap/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: "bedops_bedmap"
description: The bedmap program is used to retrieve and process signal or other features over regions of interest in BED files
keywords:
- bedops
- bedmap
- bed
- intervals
tools:
- bedops:
description: |
fast, highly scalable and easily-parallelizable genome analysis toolkit
documentation: https://bedops.readthedocs.io/
tool_dev_url: https://github.com/bedops/bedops
licence: ["GPLv2"]
doi: 10.1093/bioinformatics/bts277

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- refbed:
type: file
description: BED file
pattern: "*.bed"
- mapbed:
type: file
description: BED file
pattern: "*.bed"

output:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- mapped_bed:
type: file
description: BED file
pattern: "*.bed"

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@kelly-sovacool"
maintainers:
- "@kelly-sovacool"
55 changes: 55 additions & 0 deletions modules/CCBR/bedtools/map/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
process BEDTOOLS_MAP {
tag { meta.id }
label 'process_single'

container 'nciccbr/ccbr_ubuntu_base_20.04:v6.1'

input:
tuple val(meta), path(intervals1), path(intervals2)
tuple val(meta2), path(chrom_sizes)

output:
tuple val(meta), path("*.${extension}"), emit: map
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}.mapped"
extension = intervals1.getExtension()
def sizes = chrom_sizes ? "-g ${chrom_sizes}" : ''
if ("$intervals1" == "${prefix}.${extension}" ||
"$intervals2" == "${prefix}.${extension}")
error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
bedtools \\
map \\
-a ${intervals1} \\
-b ${intervals2} \\
${args} \\
${sizes} \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}.mapped"
extension = intervals1.getExtension()
if ("${intervals1}" == "${prefix}.${extension}" ||
"${intervals2}" == "${prefix}.${extension}")
error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
touch ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/CCBR/bedtools/map/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: bedtools_map
description: Allows one to screen for overlaps between two sets of genomic features. Adapted from https://github.com/nf-core/modules/tree/fff2c3fc7cdcb81a2a37c3263b8ace9b353af407/modules/nf-core/bedtools
keywords:
- bed
- vcf
- gff
- map
- bedtools
tools:
- bedtools:
description: |
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/map.html
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- intervals1:
type: file
description: BAM/BED/GFF/VCF
pattern: "*.{bed|gff|vcf}"
- intervals2:
type: file
description: BAM/BED/GFF/VCF
pattern: "*.{bed|gff|vcf}"
- meta2:
type: map
description: |
Groovy Map containing reference chromosome sizes
e.g. [ id:'test' ]
- chrom_sizes:
type: file
description: Chromosome sizes file
pattern: "*{.sizes,.txt}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- map:
type: file
description: File containing the description of overlaps found between the features in A and the features in B, with statistics
pattern: "*.${extension}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@kelly-sovacool"
maintainers:
- "@kelly-sovacool"
44 changes: 44 additions & 0 deletions modules/CCBR/bedtools/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
process BEDTOOLS_MERGE {
tag { meta.id }
label 'process_single'

container 'nciccbr/ccbr_ubuntu_base_20.04:v6.1'

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

output:
tuple val(meta), path('*.bed'), emit: bed
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}.merged"
if ("$bed" == "${prefix}.bed") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
bedtools \\
merge \\
-i ${bed} \\
${args} \\
> ${prefix}.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}.merged"
"""
touch ${prefix}.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}
41 changes: 41 additions & 0 deletions modules/CCBR/bedtools/merge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: bedtools_merge
description: combines overlapping or “book-ended” features in an interval file into a single feature which spans all of the combined features. Adapted from https://github.com/nf-core/modules/tree/fff2c3fc7cdcb81a2a37c3263b8ace9b353af407/modules/nf-core/bedtools
keywords:
- bed
- merge
- bedtools
- overlapped bed
tools:
- bedtools:
description: |
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/merge.html
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bed:
type: file
description: Input BED file
pattern: "*.{bed}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bed:
type: file
description: Overlapped bed file with combined features
pattern: "*.{bed}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@kelly-sovacool"
maintainers:
- "@kelly-sovacool"
51 changes: 51 additions & 0 deletions modules/CCBR/bedtools/sort/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process BEDTOOLS_SORT {
tag { meta.id }
label 'process_single'

container 'nciccbr/ccbr_ubuntu_base_20.04:v6.1'

input:
tuple val(meta), path(intervals)
path genome_file

output:
tuple val(meta), path("*.${extension}"), emit: sorted
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}.sorted"
def genome_cmd = genome_file ? "-g $genome_file" : ""
extension = task.ext.suffix ?: intervals.extension
if ("$intervals" == "${prefix}.${extension}") {
error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
}
"""
bedtools \\
sort \\
-i ${intervals} \\
${genome_cmd} \\
${args} \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}.sorted"
extension = task.ext.suffix ?: intervals.extension
"""
touch ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}
Loading

0 comments on commit 0dd8b5e

Please sign in to comment.