diff --git a/modules/somalier/relate/main.nf b/modules/somalier/relate/main.nf new file mode 100644 index 00000000..dfe91262 --- /dev/null +++ b/modules/somalier/relate/main.nf @@ -0,0 +1,46 @@ + +process SOMALIER_RELATE { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::somalier=0.2.15" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/somalier:0.2.15--h37c5b7d_0': + 'quay.io/biocontainers/somalier:0.2.15--h37c5b7d_0' }" + + input: + tuple val(meta), path(extract) + path(sample_groups) + path(ped) + + output: + tuple val(meta), path("*.html"), emit: html + tuple val(meta), path("*.pairs.tsv"), emit: pairs_tsv + tuple val(meta), path("*.samples.tsv"), emit: samples_tsv + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def input_list = extract.collect{"$it"}.join(' ') + def prefix = task.ext.prefix ?: "$meta.id" + def sample_groups_command = sample_groups ? "-g $sample_groups" : "" + def ped_command = ped ? "-p $ped" : "" + + """ + somalier relate \\ + -o ${prefix} \\ + ${input_list} \\ + ${args} \\ + ${sample_groups_command} \\ + ${ped_command} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + somalier: \$(echo \$(somalier 2>&1) | sed 's/^.*somalier version: //; s/Commands:.*\$//') + END_VERSIONS + """ + +} diff --git a/modules/somalier/relate/meta.yml b/modules/somalier/relate/meta.yml new file mode 100644 index 00000000..053a6b60 --- /dev/null +++ b/modules/somalier/relate/meta.yml @@ -0,0 +1,62 @@ +name: "somalier_relate" +description: Somalier can extract informative sites, evaluate relatedness, and perform quality-control on BAM/CRAM/BCF/VCF/GVCF or from jointly-called VCFs +keywords: + - relatedness + - QC + - bam + - cram + - vcf + - gvcf + - ancestry + - identity + - kinship + - informative sites + - family +tools: + - "somalier": + description: "Somalier can extract informative sites, evaluate relatedness, and perform quality-control on BAM/CRAM/BCF/VCF/GVCF or from jointly-called VCFs" + homepage: "https://github.com/brentp/somalier" + documentation: "https://github.com/brentp/somalier/blob/master/README.md" + tool_dev_url: "https://github.com/brentp/somalier" + doi: "https://doi.org/10.1186/s13073-020-00761-2" + licence: "MIT License" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - extract: + type: file + description: extract file from Somlaier extract + pattern: "*.somalier" + - sample_groups: + type: file + description: optional path to expected groups of samples such as tumor normal pairs specified as comma-separated groups per line + pattern: "*.{txt,csv}" + - ped: + type: file + description: optional path to a ped or fam file indicating the expected relationships among samples + pattern: "*.{ped,fam}" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - html: + type: file + description: html file + pattern: "*.html" + - pairs_tsv: + type: file + description: tsv file with output stats for pairs of samples + pattern: "*.pairs.tsv" + - samples_tsv: + type: file + description: tsv file with sample-level information + pattern: "*.samples.tsv" + +authors: + - "@ashotmarg" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 7c70a7af..6b4ad00c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2223,6 +2223,10 @@ somalier/extract: - modules/somalier/extract/** - tests/modules/somalier/extract/** +somalier/relate: + - modules/somalier/relate/** + - tests/modules/somalier/relate/** + sourmash/sketch: - modules/sourmash/sketch/** - tests/modules/sourmash/sketch/** diff --git a/tests/modules/somalier/relate/main.nf b/tests/modules/somalier/relate/main.nf new file mode 100644 index 00000000..030e5b2a --- /dev/null +++ b/tests/modules/somalier/relate/main.nf @@ -0,0 +1,30 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SOMALIER_RELATE } from '../../../../modules/somalier/relate/main.nf' + + +workflow test_somalier_relate { + + input = [ [ id:'cohort', single_end:false ], // meta map + [ file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/normal.somalier", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/tumour.somalier", checkIfExists: true) ] + ] + + SOMALIER_RELATE (input,[],[]) +} + + +workflow test_somalier_relate_ped_groups { + +input = [ [ id:'cohort', single_end:false ], // meta map + [ file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/normal.somalier", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/tumour.somalier", checkIfExists: true) ] +] + + groups = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/groups.txt", checkIfExists: true) + ped = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/somalier/family.ped", checkIfExists: true) + + SOMALIER_RELATE (input,groups,ped) +} diff --git a/tests/modules/somalier/relate/nextflow.config b/tests/modules/somalier/relate/nextflow.config new file mode 100644 index 00000000..bf6cd345 --- /dev/null +++ b/tests/modules/somalier/relate/nextflow.config @@ -0,0 +1,9 @@ +params.prefix = "" + +process { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName:SOMALIER_RELATE { + ext.prefix = { params.prefix ? "${params.prefix}." : ""} + } +} diff --git a/tests/modules/somalier/relate/test.yml b/tests/modules/somalier/relate/test.yml new file mode 100644 index 00000000..b2e886ef --- /dev/null +++ b/tests/modules/somalier/relate/test.yml @@ -0,0 +1,25 @@ +- name: somalier relate test_somalier_relate + command: nextflow run ./tests/modules/somalier/relate/main.nf -c ./tests/config/nextflow.config -c ./tests/modules/somalier/relate/nextflow.config -entry test_somalier_relate + tags: + - somalier/relate + - somalier + files: + - path: output/somalier/cohort.html + md5sum: 03cac9b2c67a8a06f63e07f83ee11e18 + - path: output/somalier/cohort.pairs.tsv + md5sum: 54d1e9fca1bf9d747d4254c6fa98edcf + - path: output/somalier/cohort.samples.tsv + md5sum: 97257d88886db1325c4d7d10cefa7169 + +- name: somalier relate test_somalier_relate_ped_groups + command: nextflow run ./tests/modules/somalier/relate/main.nf -c ./tests/config/nextflow.config -c ./tests/modules/somalier/relate/nextflow.config -entry test_somalier_relate_ped_groups + tags: + - somalier/relate + - somalier + files: + - path: output/somalier/cohort.html + md5sum: 0d573016c9279ccdfdcfd4eb01d73b89 + - path: output/somalier/cohort.pairs.tsv + md5sum: 8655714f1e5359329188e9f501168131 + - path: output/somalier/cohort.samples.tsv + md5sum: 38ef93340e55fbeef47640abda9e48b0