From c9dc0a82d0a5a1fa393264ea93ed5e0618051ffc Mon Sep 17 00:00:00 2001 From: Luca Traverso Date: Fri, 22 Jul 2022 15:36:53 +0200 Subject: [PATCH] New Module: atlas/recal (#1915) * commit 08/07 * fixed formatting * atlas recal commit - corrected formatting * Fix tests * Fix meta.yml * Prettier * Delete nextflow * yaml > yml * Delete meta.yaml * Fix test * Forgot to run prettier? Co-authored-by: ltcrod Co-authored-by: James A. Fellows Yates --- modules/atlas/recal/main.nf | 46 ++++++++++++++++++ modules/atlas/recal/meta.yml | 58 +++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/atlas/recal/main.nf | 22 +++++++++ tests/modules/atlas/recal/nextflow.config | 5 ++ tests/modules/atlas/recal/test.yml | 8 ++++ 6 files changed, 143 insertions(+) create mode 100644 modules/atlas/recal/main.nf create mode 100644 modules/atlas/recal/meta.yml create mode 100644 tests/modules/atlas/recal/main.nf create mode 100644 tests/modules/atlas/recal/nextflow.config create mode 100644 tests/modules/atlas/recal/test.yml diff --git a/modules/atlas/recal/main.nf b/modules/atlas/recal/main.nf new file mode 100644 index 00000000..fa3764e8 --- /dev/null +++ b/modules/atlas/recal/main.nf @@ -0,0 +1,46 @@ +process ATLAS_RECAL { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::atlas=0.9.9" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/atlas:0.9.9--h082e891_0': + 'quay.io/biocontainers/atlas:0.9.9--h082e891_0' }" + + input: + tuple val(meta), path(bam), path(bai), path(empiric), path(readgroups) + path(alleles) + path(invariant_sites) + + output: + tuple val(meta), path("*.txt"), emit:recal_patterns + 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}" + def PMD = empiric ? "pmdFile=${empiric}" : "" + def ALLELES = alleles ? "alleleFile=${alleles}" : "" + def INVARIANTS = invariant_sites ? "window=${invariant_sites}" : "" + def READGROUPS = readgroups ? "poolReadGroups=${readgroups}" : "" + + """ + atlas \\ + task=recal \\ + bam=$bam \\ + $PMD \\ + $READGROUPS \\ + $ALLELES \\ + $INVARIANTS \\ + out=$prefix \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + atlas: \$((atlas 2>&1) | grep Atlas | head -n 1 | sed -e 's/^[ \t]*Atlas //') + END_VERSIONS + """ +} diff --git a/modules/atlas/recal/meta.yml b/modules/atlas/recal/meta.yml new file mode 100644 index 00000000..bebaf478 --- /dev/null +++ b/modules/atlas/recal/meta.yml @@ -0,0 +1,58 @@ +name: "atlas_recal" +description: gives an estimation of the sequencing bias based on known invariant sites +keywords: + - sequencing_bias + - ATLAS +tools: + - "atlas": + description: "ATLAS, a suite of methods to accurately genotype and estimate genetic diversity" + homepage: "https://bitbucket.org/wegmannlab/atlas/wiki/Home" + documentation: "https://bitbucket.org/wegmannlab/atlas/wiki/Home" + tool_dev_url: "None" + doi: "https://doi.org/10.1101/105346" + licence: "['GPL v3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: BAM file + pattern: "*.bam" + - bai: + type: file + description: BAI file + pattern: "*.bai" + - empiric: + type: file + description: Optional txt file from PMD estimations (atlas/pmd) + pattern: "*.txt" + - alleles: + type: file + descrition: Optional bed file with known alleles + pattern: "*.bed" + - invariant_sites: + type: file + descrition: Optional bed file with invariant site coordinates + pattern: "*.bed" + +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" + - recal_patterns: + type: file + description: file containing the sequencing bias for each of the Read Group pools + pattern: "*.txt" + +authors: + - "@ltcrod" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 92abd9f9..09c6cb7f 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -98,6 +98,10 @@ atlas/pmd: - modules/atlas/pmd/** - tests/modules/atlas/pmd/** +atlas/recal: + - modules/atlas/recal/** + - tests/modules/atlas/recal/** + atlas/splitmerge: - modules/atlas/splitmerge/** - tests/modules/atlas/splitmerge/** diff --git a/tests/modules/atlas/recal/main.nf b/tests/modules/atlas/recal/main.nf new file mode 100644 index 00000000..d74fa55a --- /dev/null +++ b/tests/modules/atlas/recal/main.nf @@ -0,0 +1,22 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { ATLAS_RECAL } from '../../../../modules/atlas/recal/main.nf' + +workflow test_atlas_recal { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true), + [], + [] + ] + alleles = [] + invariant_sites = [] + + ATLAS_RECAL ( input, alleles, invariant_sites ) +} + + diff --git a/tests/modules/atlas/recal/nextflow.config b/tests/modules/atlas/recal/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/atlas/recal/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/atlas/recal/test.yml b/tests/modules/atlas/recal/test.yml new file mode 100644 index 00000000..45bb8767 --- /dev/null +++ b/tests/modules/atlas/recal/test.yml @@ -0,0 +1,8 @@ +- name: atlas recal test_atlas_recal + command: nextflow run ./tests/modules/atlas/recal -entry test_atlas_recal -c ./tests/config/nextflow.config -c ./tests/modules/atlas/recal/nextflow.config + tags: + - atlas/recal + - atlas + files: + - path: output/atlas/test_recalibrationEM.txt + contains: ["readGroup"]