Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modules/nf-core/angsd/soapsnpcalibration/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::angsd=0.940
- bioconda::htslib=1.17
57 changes: 57 additions & 0 deletions modules/nf-core/angsd/soapsnpcalibration/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
process ANGSD_SOAPSNPCALIBRATION {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/angsd:0.940--h13024bc_4':
'quay.io/biocontainers/angsd:0.940--h13024bc_4' }"

input:
tuple val(meta), path(bams), path(bam_indices)
tuple path(reference_fasta), path(reference_fai)

output:
tuple val(meta), path("*_calibration_matrix"), emit: soapsnp_calibration
tuple val("${task.process}"), val('angsd'), eval("angsd 2>&1 | sed '1!d;s/.*version: //;s/ .*//'"), emit: versions_angsd, topic: versions

when:
task.ext.when == null || task.ext.when

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def args = task.ext.args ?: ''

// Touch fai index to ensure it is newer than the fasta (ANGSD requirement)
def touch_ref = reference_fai ? "sleep 1 && touch ${reference_fai}" : ''

// Note: -GL 3 and -minQ 0 hardcoded as required to perform SOAPsnp calibration
"""
${touch_ref}
printf '%s\\n' ${bams} > bamlist.txt

angsd \\
-nThreads ${task.cpus} \\
-bam bamlist.txt \\
-minQ 0 \\
-GL 3 \\
-ref ${reference_fasta} \\
-out ${prefix} \\
${args} \\
-tmpdir ${prefix}_calibration_matrix
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}_calibration_matrix
touch ${prefix}_calibration_matrix/0.counts0
touch ${prefix}_calibration_matrix/0.qual0
touch ${prefix}_calibration_matrix/1.counts1
touch ${prefix}_calibration_matrix/1.qual1
touch ${prefix}_calibration_matrix/2.counts2
touch ${prefix}_calibration_matrix/2.qual2
touch ${prefix}_calibration_matrix/3.counts3
touch ${prefix}_calibration_matrix/3.qual3
"""
}
88 changes: 88 additions & 0 deletions modules/nf-core/angsd/soapsnpcalibration/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "angsd_soapsnpcalibration"
description: Generate ANGSD SOAPsnp genotype likelihood calibration files (counts/quality matrices) from BAM alignments.
keywords:
- angsd
- genotype likelihood
- soapsnp calibration
- genomics
tools:
- "angsd":
description: "ANGSD: Analysis of next generation Sequencing Data"
homepage: "http://www.popgen.dk/angsd/"
documentation: "http://www.popgen.dk/angsd/"
tool_dev_url: "https://github.com/ANGSD/angsd"
doi: "10.1186/s12859-014-0356-4"
licence:
- "GPL v3"
- "MIT"
identifier: biotools:angsd
input:
- - meta:
type: map
description: |
Groovy Map containing population information
e.g. [ id:'test', population:'population id', samples:'sample IDs' ]
- bams:
type: file
description: A list of BAM or CRAM files.
pattern: "*.{bam,cram}"
ontologies:
- edam: "http://edamontology.org/format_2572"
- edam: "http://edamontology.org/format_3462"
- bam_indices:
type: file
description: A list of BAM or CRAM indices.
pattern: "*.{bam.bai,cram.crai}"
ontologies:
- edam: "http://edamontology.org/format_3327"
- edam: "http://edamontology.org/format_3462"
- - reference_fasta:
type: file
description: A reference genome in FASTA format.
pattern: "*.{fasta,fa,fasta.gz,fa.gz}"
ontologies:
- edam: "http://edamontology.org/format_1929"
- reference_fai:
type: file
description: Index of the reference genome FASTA file.
pattern: "*.{fasta,fa,fasta.gz,fa.gz}.fai"
ontologies:
- edam: "http://edamontology.org/format_1929"
output:
soapsnp_calibration:
- - meta:
type: map
description: |
Groovy Map containing population information
e.g. [ id:'test', population:'population id', samples:'sample IDs' ]
- "*_calibration_matrix":
type: directory
description: Directory containing per-individual ANGSD SOAPsnp calibration files (counts and quality matrices)
pattern: "*_calibration_matrix"
ontologies: []
versions_angsd:
- - "${task.process}":
type: string
description: The name of the process
- angsd:
type: string
description: The name of the tool
- "angsd 2>&1 | sed '1!d;s/.*version: //;s/ .*//'":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - "${task.process}":
type: string
description: The name of the process
- angsd:
type: string
description: The name of the tool
- "angsd 2>&1 | sed '1!d;s/.*version: //;s/ .*//'":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@ASendellPrice"
maintainers:
- "@ASendellPrice"
103 changes: 103 additions & 0 deletions modules/nf-core/angsd/soapsnpcalibration/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// nf-core modules test angsd/soapsnpcalibration
nextflow_process {

name "Test Process ANGSD_SOAPSNPCALIBRATION"
script "../main.nf"
process "ANGSD_SOAPSNPCALIBRATION"

tag "modules"
tag "modules_nfcore"
tag "angsd"
tag "angsd/soapsnpcalibration"

test("angsd - soapSNP - calibration") {
config "./nextflow.config"

when {
params {
angsd_args = '-r chr20:1400000-1500000 -checkBamHeaders 0'
}
process {
"""
input[0] = [
[
id: "FIN",
population: "FIN",
samples: ["HG00349", "HG00358", "HG00350", "HG00351"]
],
[
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00349.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00350.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00351.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00358.chr20_1400000-1500000.bam")
],
[
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00349.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00350.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00351.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00358.chr20_1400000-1500000.bam.bai")
]
]
input[1] = [
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr20/sequence/GRCh38_chr20_1_2000000.fasta.gz'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr20/sequence/GRCh38_chr20_1_2000000.fasta.gz.fai')
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}


test("angsd - soapSNP - calibration - stub") {
options "-stub"
config "./nextflow.config"

when {
params {
angsd_args = '-r chr20:1400000-1500000 -checkBamHeaders 0'
}
process {
"""
input[0] = [
[
id: "FIN",
population: "FIN",
samples: ["HG00349", "HG00358", "HG00350", "HG00351"]
],
[
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00349.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00350.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00351.chr20_1400000-1500000.bam"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00358.chr20_1400000-1500000.bam")
],
[
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00349.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00350.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00351.chr20_1400000-1500000.bam.bai"),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/HG00358.chr20_1400000-1500000.bam.bai")
]
]
input[1] = [
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr20/sequence/GRCh38_chr20_1_2000000.fasta.gz'),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr20/sequence/GRCh38_chr20_1_2000000.fasta.gz.fai')
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}

}
Loading