rebased and updated all bedtools testing and modules

This commit is contained in:
sruthipsuresh 2020-12-21 13:06:57 -06:00
parent 78473edb72
commit 672f94f2af
15 changed files with 439 additions and 28 deletions

40
.github/workflows/bedtools_complement vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_complement
on:
push:
paths:
- software/bedtools/complement/**
- .github/workflows/bedtools_complement.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/complement/**
- .github/workflows/bedtools_complement.yml
- tests/software/bedtools/**
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 bedtools_complement --symlink --wt 2

40
.github/workflows/bedtools_genomecov vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_genomecov
on:
push:
paths:
- software/bedtools/genomecov/**
- .github/workflows/bedtools_genomecov.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/genomecov/**
- .github/workflows/bedtools_genomecov.yml
- tests/software/bedtools/**
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 bedtools_genomecov --symlink --wt 2

40
.github/workflows/bedtools_intersect vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_intersect
on:
push:
paths:
- software/bedtools/intersect/**
- .github/workflows/bedtools_intersect.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/intersect/**
- .github/workflows/bedtools_intersect.yml
- tests/software/bedtools/**
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 bedtools_intersect --symlink --wt 2

40
.github/workflows/bedtools_merge vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_merge
on:
push:
paths:
- software/bedtools/merge/**
- .github/workflows/bedtools_merge.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/merge/**
- .github/workflows/bedtools_merge.yml
- tests/software/bedtools/**
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 bedtools_merge--symlink --wt 2

40
.github/workflows/bedtools_slop vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_slop
on:
push:
paths:
- software/bedtools/slop/**
- .github/workflows/bedtools_slop.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/slop/**
- .github/workflows/bedtools_slop.yml
- tests/software/bedtools/**
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 bedtools_slop--symlink --wt 2

40
.github/workflows/bedtools_sort vendored Normal file
View file

@ -0,0 +1,40 @@
name: bedtools_sort
on:
push:
paths:
- software/bedtools/sort/**
- .github/workflows/bedtools_sort.yml
- tests/software/bedtools/**
pull_request:
paths:
- software/bedtools/sort/**
- .github/workflows/bedtools_sort.yml
- tests/software/bedtools/**
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 bedtools_sort--symlink --wt 2

View file

@ -10,12 +10,15 @@ process BEDTOOLS_COMPLEMENT {
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(beds) tuple val(meta), path(beds), path (sizes)
path sizes
output: output:
tuple val(meta), path("*.complement.bed"), emit: complement tuple val(meta), path("*.complement.bed"), emit: complement

View file

@ -22,7 +22,6 @@ def initOptions(Map args) {
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
options.sizeA - args.sizeA ?: '-sizeA'
return options return options
} }

View file

@ -10,12 +10,15 @@ process BEDTOOLS_GENOMECOV {
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(bams) tuple val(meta), path(bams), path (sizes)
path sizes
output: output:
tuple val(meta), path("*.bed"), emit: coverage tuple val(meta), path("*.bed"), emit: coverage

View file

@ -10,12 +10,15 @@ process BEDTOOLS_INTERSECT {
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(beds) tuple val(meta), path(bedfile1), path(bedfile2)
output: output:
tuple val(meta), path("*.intersect.bed"), emit: intersect tuple val(meta), path("*.intersect.bed"), emit: intersect
path "*.version.txt", emit: version path "*.version.txt", emit: version
@ -24,7 +27,7 @@ process BEDTOOLS_INTERSECT {
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
bedtools intersect -a ${beds[0]} -b ${beds[1]} ${options.args} > ${prefix}.intersect.bed bedtools intersect -a ${bedfile1} -b ${bedfile2} ${options.args} > ${prefix}.intersect.bed
bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt
""" """
} }

View file

@ -4,27 +4,28 @@ include { initOptions; saveFiles; getSoftwareName } from './functions'
def options = initOptions(params.options) def options = initOptions(params.options)
process BEDTOOLS_MERGE { process BEDTOOLS_MERGE {
tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(beds) path(sort)
output: output:
tuple val(meta), path("*.merged.bed"), emit: merge path("*.merged.bed"), emit: merge
path "*.version.txt", emit: version path "*.version.txt", emit: version
// TODO fix output file naming
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
bedtools merge -i $beds ${options.args} > ${prefix}.merged.bed bedtools merge -i $sort ${options.args} > test.merged.bed
bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt
""" """
} }

View file

@ -10,13 +10,16 @@ process BEDTOOLS_SLOP {
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(beds) tuple val(meta), path(beds), path (sizes)
path sizes
output: output:
tuple val(meta), path("*.slop.bed"), emit: slopbed tuple val(meta), path("*.slop.bed"), emit: slopbed

View file

@ -10,21 +10,25 @@ process BEDTOOLS_SORT {
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null) conda (params.enable_conda ? "bioconda::bedtools =2.29.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bedtools:2.29.2--hc088bd4_0"
} else {
container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0" container "quay.io/biocontainers/bedtools:2.29.2--hc088bd4_0"
}
input: input:
tuple val(meta), path(beds) tuple val(meta), path(beds)
output: output:
tuple val(meta), path("*.sort.bed"), emit: sort tuple val(meta), path("*.sort"), emit: sort
path "*.version.txt", emit: version path "*.version.txt", emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
bedtools sort -i $beds ${options.args} > ${prefix}.sort.bed bedtools sort -i $beds ${options.args} > ${prefix}.sort
bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt bedtools --version | sed -e "s/Bedtools v//g" > ${software}.version.txt
""" """
} }

View file

@ -0,0 +1,88 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BEDTOOLS_COMPLEMENT } from '../../../software/bedtools/complement/main.nf' addParams( options: [:] )
include { BEDTOOLS_GENOMECOV } from '../../../software/bedtools/genomecov/main.nf' addParams( options: [:] )
include { BEDTOOLS_INTERSECT } from '../../../software/bedtools/intersect/main.nf' addParams( options: [:] )
include { BEDTOOLS_MERGE } from '../../../software/bedtools/merge/main.nf' addParams( options: [:] )
include { BEDTOOLS_SLOP as BEDTOOLS_SLOP_S} from '../../../software/bedtools/slop/main.nf' addParams( options: [:] )
include { BEDTOOLS_SLOP as BEDTOOLS_SLOP_AS} from '../../../software/bedtools/slop/main.nf' addParams( options: [:] )
include { BEDTOOLS_SORT } from '../../../software/bedtools/sort/main.nf' addParams( options: [publish_dir: 'test_bedtools_sort'] ) // needed for merge
workflow test_bedtools_complement {
def input = []
input = [ [ id:'test'],
file("${launchDir}/tests/data/bed/A.bed", checkIfExists: true),
file("${launchDir}/tests/data/bed/genome.sizes", checkIfExists: true) ] //metamap
BEDTOOLS_COMPLEMENT( input )
}
workflow test_bedtools_genomecov {
def input = []
input = [ [ id:'test'],
file("${launchDir}/tests/data/bam/test.paired_end.sorted.bam", checkIfExists: true),
file("${launchDir}/tests/data/bed/genome.sizes", checkIfExists: true) ] //metamap
BEDTOOLS_GENOMECOV( input )
}
workflow test_bedtools_intersect {
def input = []
input = [ [ id:'test'],
file("${launchDir}/tests/data/bed/A.bed", checkIfExists: true),
file("${launchDir}/tests/data/bed/B.bed", checkIfExists: true) ] //metamap
BEDTOOLS_INTERSECT( input )
}
// ensure input file is presorted (uses output of sort module)
workflow test_bedtools_merge {
test_bedtools_sort()
def input = []
input = [
test_bedtools_sort.out.sort.collect { it[1] }.ifEmpty([])
]
BEDTOOLS_MERGE(*input)
}
// TODO streamline slop module
// To run with header and pct enabled, type --pct true and --header true with nextflow run command.
/*
Test with l/r method
*/
workflow test_bedtools_slop_asymmetrical {
def input = []
input = [ [ id:'test', symmetry: false],
file("${launchDir}/tests/data/bed/A.bed", checkIfExists: true),
file("${launchDir}/tests/data/bed/genome.sizes", checkIfExists: true) ] //metamap
BEDTOOLS_SLOP_AS( input )
}
/*
Test with b method
*/
workflow test_bedtools_slop_symmetrical {
def input = []
input = [ [ id:'test', symmetry: true],
file("${launchDir}/tests/data/bed/A.bed", checkIfExists: true),
file("${launchDir}/tests/data/bed/genome.sizes", checkIfExists: true) ] //metamap
BEDTOOLS_SLOP_S( input )
}
workflow test_bedtools_sort {
def input = []
input = [ [ id:'test'],
file("${launchDir}/tests/data/bed/A.bed", checkIfExists: true) ]
BEDTOOLS_SORT( input )
emit:
sort = BEDTOOLS_SORT.out.sort
}

View file

@ -0,0 +1,67 @@
- name: Run bedtools complement test workflow
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_complement -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_complement
files:
- path: output/bedtools/test.complement.bed
md5sum: 55a43973abb1a08ac57290ff44f6c502
- name: Run bedtools genomecov test workflow
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_genomecov -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_genomecov
files:
- path: output/bedtools/test.bed
md5sum: 5be12e847b933b02bf42437e8562d06c
- name: Run bedtools intersect test workflow
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_intersect -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_intersect
files:
- path: output/bedtools/test.intersect.bed
md5sum: cc1bb317886e7df0a942b56f8a320d9c
- name: Run bedtools sort test workflow
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_sort -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_sort
files:
- path: output/bedtools/test.sort.bed
md5sum: 4279202e33fcce3d19f420f1b27fddee
# linked to sort module
- name: Run bedtools merge test workflow
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_merge -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_merge
files:
- path: output/bedtools/test.merged.bed
md5sum: 13e5a3b254fac35fe0da0c92cbaf1761
- name: Run bedtools slop test workflow (symmetrical)
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_slop_symmetrical -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_slop
files:
- path: output/bedtools/test.slop.bed
md5sum: 4279202e33fcce3d19f420f1b27fddee
- name: Run bedtools slop test workflow (asymmetrical)
command: nextflow run ./tests/software/bedtools/ -profile docker -entry test_bedtools_slop_asymmetrical -c tests/config/nextflow.config
tags:
- bedtools
- bedtools_slop
files:
- path: output/bedtools/test.slop.bed
md5sum: 4279202e33fcce3d19f420f1b27fddee