From 27936729f21245558c0425b3284c8bdfd4b805aa Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 25 Mar 2022 12:13:30 -0500 Subject: [PATCH] Add samtools to homer/maketagdirectory to use bam files (#1437) * fix(homer): Update dependancies for maketagdirectory Closes #1363 * test(homer): Add tests for bam usage * style(homer): Rename meta test * fix(homer): Update args order and add missing \\ * docs(homer): Add DESeq2 and edgeR Co-authored-by: FriederikeHanssen * test(homer): Update md5sum * test(homer): bam => sam * fix(homer): Use nextflow conda recipe instead of biocontainers with commas Co-authored-by: FriederikeHanssen --- modules/homer/maketagdirectory/main.nf | 13 ++++---- modules/homer/maketagdirectory/meta.yml | 33 +++++++++++++++++-- tests/modules/homer/maketagdirectory/main.nf | 23 +++++++++---- .../homer/maketagdirectory/nextflow.config | 6 +++- tests/modules/homer/maketagdirectory/test.yml | 29 ++++++++++++---- 5 files changed, 81 insertions(+), 23 deletions(-) diff --git a/modules/homer/maketagdirectory/main.nf b/modules/homer/maketagdirectory/main.nf index 262998d5..0ab855da 100644 --- a/modules/homer/maketagdirectory/main.nf +++ b/modules/homer/maketagdirectory/main.nf @@ -4,13 +4,13 @@ process HOMER_MAKETAGDIRECTORY { tag "$meta.id" label 'process_medium' - conda (params.enable_conda ? "bioconda::homer=4.11=pl526hc9558a2_3" : null) + conda (params.enable_conda ? "bioconda::homer=4.11 bioconda::samtools=1.11 conda-forge::r-base=4.0.2 bioconda::bioconductor-deseq2=1.30.0 bioconda::bioconductor-edger=3.32.0 anaconda::perl=5.26.2" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/homer:4.11--pl526hc9558a2_3' : - 'quay.io/biocontainers/homer:4.11--pl526hc9558a2_3' }" + 'https://depot.galaxyproject.org/singularity/mulled-v2-29293b111ffe5b4c1d1e14c711264aaed6b97b4a:594338b771cacf1623bd27772b5e12825f8835f2-0' : + 'quay.io/biocontainers/mulled-v2-29293b111ffe5b4c1d1e14c711264aaed6b97b4a:594338b771cacf1623bd27772b5e12825f8835f2-0' }" input: - tuple val(meta), path(bed) + tuple val(meta), path(bam) path fasta output: @@ -26,13 +26,14 @@ process HOMER_MAKETAGDIRECTORY { """ makeTagDirectory \\ tag_dir \\ + -genome $fasta \\ $args \\ - $bed \\ - -genome $fasta + $bam cat <<-END_VERSIONS > versions.yml "${task.process}": homer: $VERSION + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') END_VERSIONS """ } diff --git a/modules/homer/maketagdirectory/meta.yml b/modules/homer/maketagdirectory/meta.yml index 2472e0f0..31d59ee7 100644 --- a/modules/homer/maketagdirectory/meta.yml +++ b/modules/homer/maketagdirectory/meta.yml @@ -3,6 +3,8 @@ description: Create a tag directory with the HOMER suite keywords: - peaks - bed + - bam + - sam tools: - homer: description: | @@ -10,16 +12,41 @@ tools: documentation: http://homer.ucsd.edu/homer/ doi: 10.1016/j.molcel.2010.05.004. licence: ["GPL-3.0-or-later"] + - samtools: + description: | + SAMtools is a set of utilities for interacting with and post-processing + short DNA sequence read alignments in the SAM, BAM and CRAM formats, written by Heng Li. + These files are generated as output by short read aligners like BWA. + homepage: http://www.htslib.org/ + documentation: hhttp://www.htslib.org/doc/samtools.html + doi: 10.1093/bioinformatics/btp352 + licence: ["MIT"] + - DESeq2: + description: | + Differential gene expression analysis based on the negative binomial distribution + homepage: "https://bioconductor.org/packages/DESeq2" + documentation: "https://bioconductor.org/packages/DESeq2" + tool_dev_url: "https://github.com/mikelove/DESeq2" + doi: 10.18129/B9.bioc.DESeq2 + licence: ["LGPL-3.0-or-later"] + - edgeR: + description: | + Empirical Analysis of Digital Gene Expression Data in R + homepage: "https://bioinf.wehi.edu.au/edgeR" + documentation: "https://bioconductor.org/packages/edgeR" + tool_dev_url: " https://git.bioconductor.org/packages/edgeR" + doi: 10.18129/B9.bioc.edgeR + licence: ["GPL >=2"] input: - meta: type: map description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - bed: + - bam: type: file - description: The peak files in bed format - pattern: "*.bed" + description: BAM/BED/SAM file + pattern: "*.{bam,bed,sam}" - fasta: type: file description: Fasta file of reference genome diff --git a/tests/modules/homer/maketagdirectory/main.nf b/tests/modules/homer/maketagdirectory/main.nf index 766aff0d..7de693e6 100644 --- a/tests/modules/homer/maketagdirectory/main.nf +++ b/tests/modules/homer/maketagdirectory/main.nf @@ -2,19 +2,22 @@ nextflow.enable.dsl = 2 -include { HOMER_MAKETAGDIRECTORY } from '../../../../modules/homer/maketagdirectory/main.nf' +include { + HOMER_MAKETAGDIRECTORY as HOMER_MAKETAGDIRECTORY_BED + HOMER_MAKETAGDIRECTORY as HOMER_MAKETAGDIRECTORY_BAM +} from '../../../../modules/homer/maketagdirectory/main.nf' -workflow test_homer_maketagdirectory { +workflow test_homer_maketagdirectory_bed { input = [[id:'test'], [file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true), file(params.test_data['sarscov2']['genome']['test2_bed'], checkIfExists: true)]] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - HOMER_MAKETAGDIRECTORY (input, fasta) + HOMER_MAKETAGDIRECTORY_BED (input, fasta) } -workflow test_homer_meta_maketagdirectory { +workflow test_homer_maketagdirectory_meta { input = [[[ id:'test1'], [file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)]], @@ -25,8 +28,14 @@ workflow test_homer_meta_maketagdirectory { meta_input = [[id: 'meta_test']] + [ input.collect{it[1]}.flatten() ] - HOMER_MAKETAGDIRECTORY (meta_input, fasta) + HOMER_MAKETAGDIRECTORY_BED (meta_input, fasta) } -// TODO Make a failing bam test -// TODO Make a pass bam test that feeds the bam through samtools first +workflow test_homer_maketagdirectory_bam { + input = [[id:'test'], + [file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)]] + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + HOMER_MAKETAGDIRECTORY_BAM (input, fasta) +} diff --git a/tests/modules/homer/maketagdirectory/nextflow.config b/tests/modules/homer/maketagdirectory/nextflow.config index 81587d69..9d7a3f9f 100644 --- a/tests/modules/homer/maketagdirectory/nextflow.config +++ b/tests/modules/homer/maketagdirectory/nextflow.config @@ -2,8 +2,12 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: HOMER_MAKETAGDIRECTORY { + withName: HOMER_MAKETAGDIRECTORY_BED { ext.args = '-format bed' } + withName: HOMER_MAKETAGDIRECTORY_BAM { + ext.args = '-format sam' + } + } diff --git a/tests/modules/homer/maketagdirectory/test.yml b/tests/modules/homer/maketagdirectory/test.yml index 746c6ef6..28e74c32 100644 --- a/tests/modules/homer/maketagdirectory/test.yml +++ b/tests/modules/homer/maketagdirectory/test.yml @@ -1,5 +1,5 @@ -- name: homer maketagdirectory - command: nextflow run ./tests/modules/homer/maketagdirectory -entry test_homer_maketagdirectory -c ./tests/config/nextflow.config -c ./tests/modules/homer/maketagdirectory/nextflow.config +- name: homer maketagdirectory bed + command: nextflow run ./tests/modules/homer/maketagdirectory -entry test_homer_maketagdirectory_bed -c ./tests/config/nextflow.config -c ./tests/modules/homer/maketagdirectory/nextflow.config tags: - homer - homer/maketagdirectory @@ -11,12 +11,12 @@ - path: output/homer/tag_dir/tagCountDistribution.txt md5sum: fd4ee7ce7c5dfd7c9d739534b8180578 - path: output/homer/tag_dir/tagInfo.txt - md5sum: 816baa642c946f8284eaa465638e9abb + md5sum: ff56f30411b221b847aa4e6e9a6098a1 - path: output/homer/tag_dir/tagLengthDistribution.txt md5sum: e5aa2b9843ca9c04ace297280aed6af4 -- name: homer meta maketagdirectory - command: nextflow run ./tests/modules/homer/maketagdirectory -entry test_homer_meta_maketagdirectory -c ./tests/config/nextflow.config -c ./tests/modules/homer/maketagdirectory/nextflow.config +- name: homer maketagdirectory meta + command: nextflow run ./tests/modules/homer/maketagdirectory -entry test_homer_maketagdirectory_meta -c ./tests/config/nextflow.config -c ./tests/modules/homer/maketagdirectory/nextflow.config tags: - homer - homer/maketagdirectory @@ -28,6 +28,23 @@ - path: output/homer/tag_dir/tagCountDistribution.txt md5sum: fd4ee7ce7c5dfd7c9d739534b8180578 - path: output/homer/tag_dir/tagInfo.txt - md5sum: 816baa642c946f8284eaa465638e9abb + md5sum: ff56f30411b221b847aa4e6e9a6098a1 - path: output/homer/tag_dir/tagLengthDistribution.txt md5sum: e5aa2b9843ca9c04ace297280aed6af4 + +- name: homer maketagdirectory bam + command: nextflow run ./tests/modules/homer/maketagdirectory -entry test_homer_maketagdirectory_bam -c ./tests/config/nextflow.config -c ./tests/modules/homer/maketagdirectory/nextflow.config + tags: + - homer + - homer/maketagdirectory + files: + - path: output/homer/tag_dir/MT192765.1.tags.tsv + md5sum: 365808c4751ef6dd7085ac52037a22bc + - path: output/homer/tag_dir/tagAutocorrelation.txt + md5sum: 8b396f2aef1cdd3af4fab57b142d3250 + - path: output/homer/tag_dir/tagCountDistribution.txt + md5sum: afc6d007096c3872bbe84c9dc8edb832 + - path: output/homer/tag_dir/tagInfo.txt + md5sum: fbaf46eeb8a0723fa8b5eabd93f9d821 + - path: output/homer/tag_dir/tagLengthDistribution.txt + md5sum: 44f231adb2a705ae81950808c55cf248