New Module: NextGenMap (#1938)

adding nextgenmap module

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
This commit is contained in:
Chase Mateusiak 2022-09-27 14:44:47 -05:00 committed by GitHub
parent a0443e2c54
commit 786279b473
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 173 additions and 0 deletions

View file

@ -0,0 +1,58 @@
process NEXTGENMAP {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::nextgenmap=0.5.5" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/nextgenmap%3A0.5.5--hc9558a2_4' :
'quay.io/biocontainers/nextgenmap:0.5.5--hc9558a2_4' }"
input:
tuple val(meta), path(reads)
path(fasta)
output:
tuple val(meta), path("*.bam"), emit: bam
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 threads = task.cpus
if(meta.single_end){
"""
ngm \\
-r $fasta \\
-q $reads \\
-t $threads \\
--bam \\
-o ${prefix}.bam \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
NextGenMap: \$(ngm 2>&1 | head -1 | grep -o -E '[[:digit:]]+.[[:digit:]]+.[[:digit:]]+')
END_VERSIONS
"""
} else{
"""
ngm \\
-r $fasta \\
-1 ${reads[0]} \\
-2 ${reads[1]} \\
-t $threads \\
--bam \\
-o ${prefix}.bam \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
NextGenMap: \$(ngm 2>&1 | head -1 | grep -o -E '[[:digit:]]+.[[:digit:]]+.[[:digit:]]+')
END_VERSIONS
"""
}
}

View file

@ -0,0 +1,55 @@
name: nextgenmap
description: Performs fastq alignment to a fasta reference using NextGenMap
keywords:
- NextGenMap
- ngm
- alignment
- map
- fastq
- bam
- sam
tools:
- bwa:
description: |
NextGenMap is a flexible highly sensitive short read mapping tool that
handles much higher mismatch rates than comparable algorithms while
still outperforming them in terms of runtime
homepage: https://github.com/Cibiv/NextGenMap
documentation: https://github.com/Cibiv/NextGenMap/wiki
doi: 10.1093/bioinformatics/btt468
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1, if meta.single_end is true, and 2
if meta.single_end is false.
- fasta:
type: file
description: |
Genomic reference fasta file
pattern: "*.{fa,fa.gz,fas,fas.gz,fna,fna.gz,fasta,fasta.gz}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information. First item of tuple with
bam, below.
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: |
Output BAM file containing read alignments. Second item of tuple with
meta, above
pattern: "*.{bam}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@cmatkhan"

View file

@ -1723,6 +1723,10 @@ nextclade/run:
- modules/nextclade/run/**
- tests/modules/nextclade/run/**
nextgenmap:
- modules/nextgenmap/**
- tests/modules/nextgenmap/**
ngmaster:
- modules/ngmaster/**
- tests/modules/ngmaster/**

View file

@ -0,0 +1,36 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { NEXTGENMAP } from '../../../modules/nextgenmap/main.nf'
//
// Test with single-end data
//
workflow test_nextgenmap_single {
input = [
[ id:'test', single_end:true ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
NEXTGENMAP ( input, fasta )
}
//
// Test with paired-end data
//
workflow test_bwamem2_mem_paired_end {
input = [
[ id:'test', single_end:false ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true)
]
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
NEXTGENMAP ( input, fasta )
}

View file

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

View file

@ -0,0 +1,15 @@
- name: nextgenmap test_nextgenmap_single
command: nextflow run ./tests/modules/nextgenmap -entry test_nextgenmap_single -c ./tests/config/nextflow.config -c ./tests/modules/nextgenmap/nextflow.config
tags:
- nextgenmap
files:
- path: output/nextgenmap/test.bam
md5sum: ada069bc5c670ffee23871f3ca525d0a
- name: nextgenmap test_bwamem2_mem_paired_end
command: nextflow run ./tests/modules/nextgenmap -entry test_bwamem2_mem_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/nextgenmap/nextflow.config
tags:
- nextgenmap
files:
- path: output/nextgenmap/test.bam
md5sum: fa76167e236cf1aabdafdbb0632253cd