mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Merge pull request #110 from luslab/master
Add SEACR module containing a single CALLPEAK process
This commit is contained in:
commit
2c962f34df
10 changed files with 22924 additions and 3 deletions
40
.github/workflows/seacr_callpeak.yml
vendored
Normal file
40
.github/workflows/seacr_callpeak.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: seacr_callpeak
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- software/seacr/callpeak/**
|
||||||
|
- .github/workflows/seacr_callpeak.yml
|
||||||
|
- tests/software/seacr/**
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- software/seacr/callpeak/**
|
||||||
|
- .github/workflows/seacr_callpeak.yml
|
||||||
|
- tests/software/seacr/**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci_test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
nxf_version: [20.11.0-edge]
|
||||||
|
env:
|
||||||
|
NXF_ANSI_LOG: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Nextflow
|
||||||
|
env:
|
||||||
|
NXF_VER: ${{ matrix.nxf_version }}
|
||||||
|
run: |
|
||||||
|
wget -qO- get.nextflow.io | bash
|
||||||
|
sudo mv nextflow /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: python -m pip install --upgrade pip pytest-workflow
|
||||||
|
|
||||||
|
# Test the module
|
||||||
|
- run: pytest --tag seacr_callpeak --symlink --wt 2
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,5 +2,6 @@
|
||||||
work/
|
work/
|
||||||
results/
|
results/
|
||||||
test_output/
|
test_output/
|
||||||
|
output/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
||||||
[submodule "test-datasets"]
|
|
||||||
path = test-datasets
|
|
||||||
url = https://github.com/nf-core/test-datasets.git
|
|
59
software/seacr/callpeak/functions.nf
Normal file
59
software/seacr/callpeak/functions.nf
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* -----------------------------------------------------
|
||||||
|
* Utility functions used in nf-core DSL2 module files
|
||||||
|
* -----------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extract name of software tool from process name using $task.process
|
||||||
|
*/
|
||||||
|
def getSoftwareName(task_process) {
|
||||||
|
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
|
*/
|
||||||
|
def initOptions(Map args) {
|
||||||
|
def Map options = [:]
|
||||||
|
options.args = args.args ?: ''
|
||||||
|
options.args2 = args.args2 ?: ''
|
||||||
|
options.publish_by_id = args.publish_by_id ?: false
|
||||||
|
options.publish_dir = args.publish_dir ?: ''
|
||||||
|
options.publish_files = args.publish_files
|
||||||
|
options.suffix = args.suffix ?: ''
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tidy up and join elements of a list to return a path string
|
||||||
|
*/
|
||||||
|
def getPathFromList(path_list) {
|
||||||
|
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||||
|
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||||
|
return paths.join('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function to save/publish module results
|
||||||
|
*/
|
||||||
|
def saveFiles(Map args) {
|
||||||
|
if (!args.filename.endsWith('.version.txt')) {
|
||||||
|
def ioptions = initOptions(args.options)
|
||||||
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
|
if (ioptions.publish_by_id) {
|
||||||
|
path_list.add(args.publish_id)
|
||||||
|
}
|
||||||
|
if (ioptions.publish_files instanceof Map) {
|
||||||
|
for (ext in ioptions.publish_files) {
|
||||||
|
if (args.filename.endsWith(ext.key)) {
|
||||||
|
def ext_list = path_list.collect()
|
||||||
|
ext_list.add(ext.value)
|
||||||
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (ioptions.publish_files == null) {
|
||||||
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
software/seacr/callpeak/main.nf
Normal file
42
software/seacr/callpeak/main.nf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
def options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = '1.3'
|
||||||
|
|
||||||
|
process SEACR_CALLPEAK {
|
||||||
|
tag "$meta.id"
|
||||||
|
label 'process_medium'
|
||||||
|
publishDir "${params.outdir}",
|
||||||
|
mode: params.publish_dir_mode,
|
||||||
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::seacr=1.3 conda-forge::r-base=4.0.2 bioconda::bedtools=2.29.2" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/mulled-v2-03bfeb32fe80910c231f630d4262b83677c8c0f4:5bb5ed4307a8187a7f34730b00431de93688fa59-0"
|
||||||
|
} else {
|
||||||
|
container 'quay.io/biocontainers/mulled-v2-03bfeb32fe80910c231f630d4262b83677c8c0f4:5bb5ed4307a8187a7f34730b00431de93688fa59-0'
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bedgraph), path(ctrlbedgraph)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bed"), emit: bed
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
SEACR_1.3.sh \\
|
||||||
|
$bedgraph \\
|
||||||
|
$ctrlbedgraph \\
|
||||||
|
$options.args \\
|
||||||
|
$prefix
|
||||||
|
|
||||||
|
echo $VERSION > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
69
software/seacr/callpeak/meta.yml
Normal file
69
software/seacr/callpeak/meta.yml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
name: seacr_callpeak
|
||||||
|
description: Call peaks using SEACR on sequenced reads in bedgraph format
|
||||||
|
keywords:
|
||||||
|
- peak-caller
|
||||||
|
- peaks
|
||||||
|
- bedgraph
|
||||||
|
- cut&tag
|
||||||
|
- cut&run
|
||||||
|
- chromatin
|
||||||
|
- seacr
|
||||||
|
tools:
|
||||||
|
- seacr:
|
||||||
|
description: |
|
||||||
|
SEACR is intended to call peaks and enriched regions from sparse CUT&RUN
|
||||||
|
or chromatin profiling data in which background is dominated by "zeroes"
|
||||||
|
(i.e. regions with no read coverage).
|
||||||
|
homepage: https://github.com/FredHutch/SEACR
|
||||||
|
documentation: https://github.com/FredHutch/SEACR
|
||||||
|
params:
|
||||||
|
- outdir:
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
The pipeline's output directory. By default, the module will
|
||||||
|
output files into `$params.outdir/<SOFTWARE>`
|
||||||
|
- publish_dir_mode:
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
Value for the Nextflow `publishDir` mode parameter.
|
||||||
|
Available: symlink, rellink, link, copy, copyNoFollow, move.
|
||||||
|
- enable_conda:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Run the module with Conda using the software specified
|
||||||
|
via the `conda` directive
|
||||||
|
- singularity_pull_docker_container:
|
||||||
|
type: boolean
|
||||||
|
description: |
|
||||||
|
Instead of directly downloading Singularity images for use with Singularity,
|
||||||
|
force the workflow to pull and convert Docker containers instead.
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bedgraph:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
The target bedgraph file from which the peaks will be calculated.
|
||||||
|
- ctrlbedgraph:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Control (IgG) data bedgraph file to generate an empirical threshold for peak calling.
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bed:
|
||||||
|
type: file
|
||||||
|
description: Bed file containing the calculated peaks.
|
||||||
|
pattern: "*.bed"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@chris-cheshire"
|
10234
tests/data/bedgraph/IgG_1_to_chr20.bedgraph
Normal file
10234
tests/data/bedgraph/IgG_1_to_chr20.bedgraph
Normal file
File diff suppressed because it is too large
Load diff
12451
tests/data/bedgraph/K27me3_1_to_chr20.bedgraph
Normal file
12451
tests/data/bedgraph/K27me3_1_to_chr20.bedgraph
Normal file
File diff suppressed because it is too large
Load diff
20
tests/software/seacr/main.nf
Normal file
20
tests/software/seacr/main.nf
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { SEACR_CALLPEAK } from '../../../software/seacr/callpeak/main.nf' addParams( options: [ args:'norm stringent' ] )
|
||||||
|
|
||||||
|
workflow test_seacr_callpeak {
|
||||||
|
|
||||||
|
def input = []
|
||||||
|
input = [[ id:'test_1'],
|
||||||
|
file("${launchDir}/tests/data/bedgraph/K27me3_1_to_chr20.bedgraph", checkIfExists: true),
|
||||||
|
file("${launchDir}/tests/data/bedgraph/IgG_1_to_chr20.bedgraph", checkIfExists: true) ]
|
||||||
|
|
||||||
|
SEACR_CALLPEAK ( input )
|
||||||
|
}
|
||||||
|
|
||||||
|
// For local testing
|
||||||
|
workflow {
|
||||||
|
test_seacr_callpeak()
|
||||||
|
}
|
8
tests/software/seacr/test.yml
Normal file
8
tests/software/seacr/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- name: Run seacr call peak test workflow
|
||||||
|
command: nextflow run ./tests/software/seacr/ -profile docker -entry test_seacr_callpeak -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- seacr
|
||||||
|
- seacr_callpeak
|
||||||
|
files:
|
||||||
|
- path: output/seacr/test_1.stringent.bed
|
||||||
|
md5sum: 3ac70475669eb6a7b8ca89e19a08a28e
|
Loading…
Reference in a new issue