nf-core_modules/modules/ngscheckmate/ncm/main.nf
Simon Pearce 79a9d5e1ea
New module: NGSCheckMate (#1290)
NGSCheckMate ncm mode, working on bam files and vcf files to check that (human) samples match as expected 

Co-authored-by: Simon Pearce <simon.pearce@cruk.manchester.ac.uk>
Co-authored-by: Mahesh Binzer-Panchal <mahesh.binzer-panchal@nbis.se>
2022-03-11 09:02:10 +00:00

49 lines
1.4 KiB
Text

process NGSCHECKMATE_NCM {
label 'process_low'
conda (params.enable_conda ? "bioconda::ngscheckmate=1.0.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ngscheckmate:1.0.0--py27r41hdfd78af_3':
'quay.io/biocontainers/ngscheckmate:1.0.0--py27r41hdfd78af_3' }"
input:
path files
path snp_bed
path fasta
output:
path "*.pdf" , emit: pdf
path "*_corr_matrix.txt", emit: corr_matrix
path "*_matched.txt" , emit: matched
path "*_all.txt" , emit: all
path "*.vcf" , emit: vcfs, optional: true
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "output"
def unzip = files.any { it.toString().endsWith(".vcf.gz") }
"""
if $unzip
then
for VCFGZ in *.vcf.gz; do
gunzip -cdf \$VCFGZ > \$( basename \$VCFGZ .gz );
done
fi
NCM_REF="./"${fasta} ncm.py -d . -bed ${snp_bed} -O . -N ${prefix} $args
if $unzip
then
rm -f *.vcf # clean up decompressed vcfs
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ngscheckmate: \$(ncm.py --help | sed "7!d;s/ *Ensuring Sample Identity v//g")
END_VERSIONS
"""
}