Add atlas/call (#1809)

* Add atlas/call

* Apply suggestions from code review

* Update modules/atlas/call/main.nf

Co-authored-by: Thiseas C. Lamnidis <thisseass@gmail.com>

* Apply suggestions from code review

Co-authored-by: Thiseas C. Lamnidis <thisseass@gmail.com>
This commit is contained in:
James A. Fellows Yates 2022-07-01 15:06:07 +02:00 committed by GitHub
parent 057a889d3b
commit 7d0ddbc8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 164 additions and 0 deletions

View file

@ -0,0 +1,52 @@
process ATLAS_CALL {
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 fasta
path fai
path recal
path pmd
path known_alleles
val method
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
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 recal_file = recal ? "recal=${recal}" : ""
def pmd_file = pmd ? "pmdFile=${pmd}" : ""
def known_alleles_file = known_alleles ? "pmdFile=${known_alleles}" : ""
def valid_method = ['MLE', 'Bayesian', 'allelePresence', 'randomBase', 'majorityBase']
if ( !valid_method.contains(method) ) { error "Unrecognised calling method for ATLAS_CALL. Options: MLE, Bayesian, allelePresence, randomBase, majorityBase" }
"""
atlas \\
task=call \\
bam=${bam} \\
fasta=${fasta} \\
$recal_file \\
$pmd_file \\
method=${method} \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
atlas: \$((atlas 2>&1) | grep Atlas | head -n 1 | sed -e 's/^[ \t]*Atlas //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,72 @@
name: "atlas_call"
description: generate VCF file from a BAM file using various calling methods
keywords:
- atlas
- variant calling
- vcf
- population genetics
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: "https://bitbucket.org/wegmannlab/atlas"
doi: "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: A BAM/ file
pattern: "*.bam"
- bai:
type: file
description: The BAI file for the input BAM file
pattern: "*.bai"
- fasta:
type: file
description: The reference FASTA file used to generate the BAM file
pattern: "*.{fasta,fna,fa}"
- fai:
type: file
description: The index of the FASTA file used for to generate the BAM file
pattern: "*.fai"
- recal:
type: file
description: Optional recalibration file from atlas recal function in text format
pattern: "*.txt"
- pmd:
type: file
description: Optional PMD file from atlas pmd function in text format
pattern: "*.txt"
- known_alleles:
type: file
description: Optional tab separated text file containing 1-based list of known alleles. See atlas call documentation.
pattern: "*.{txt.tsv}"
- method:
type: character
description: Which variant calling algorithm to use. Some may require additional parameters supplied via ext.args. Check atlas documentation.
pattern: "MLE|Bayesian|allelePresence|randomBase|majorityBase"
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"
- bam:
type: file
description: VCF file with variant calls
pattern: "*.vcf.gz"
authors:
- "@jfy133"

View file

@ -86,6 +86,10 @@ ataqv/ataqv:
- modules/ataqv/ataqv/** - modules/ataqv/ataqv/**
- tests/modules/ataqv/ataqv/** - tests/modules/ataqv/ataqv/**
atlas/call:
- modules/atlas/call/**
- tests/modules/atlas/call/**
atlas/pmd: atlas/pmd:
- modules/atlas/pmd/** - modules/atlas/pmd/**
- tests/modules/atlas/pmd/** - tests/modules/atlas/pmd/**

View file

@ -0,0 +1,22 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ATLAS_CALL } from '../../../../modules/atlas/call/main.nf'
workflow test_atlas_call {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
recal = []
pmd = []
known_alleles = []
method = 'randomBase'
ATLAS_CALL ( input, fasta, fai, recal, pmd, known_alleles, method )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,9 @@
- name: atlas call test_atlas_call
command: nextflow run ./tests/modules/atlas/call -entry test_atlas_call -c ./tests/config/nextflow.config -c ./tests/modules/atlas/call/nextflow.config
tags:
- atlas
- atlas/call
files:
- path: output/atlas/test.paired_end.sorted_randomBase.vcf.gz
contains:
- "##source=atlas"