Update minimap2/align module (#1537)

This commit is contained in:
Sofia Stamouli 2022-04-26 16:32:20 +02:00 committed by GitHub
parent 6a46e7cf11
commit 1f77bc130b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 16 deletions

View file

@ -2,17 +2,21 @@ process MINIMAP2_ALIGN {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
conda (params.enable_conda ? 'bioconda::minimap2=2.21' : null) conda (params.enable_conda ? 'bioconda::minimap2=2.21 bioconda::samtools=1.12' : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/minimap2:2.21--h5bf99c6_0' : 'https://depot.galaxyproject.org/singularity/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:1679e915ddb9d6b4abda91880c4b48857d471bd8-0' :
'quay.io/biocontainers/minimap2:2.21--h5bf99c6_0' }" 'quay.io/biocontainers/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:1679e915ddb9d6b4abda91880c4b48857d471bd8-0' }"
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
path reference path reference
val bam_format
val cigar_paf_format
val cigar_bam
output: output:
tuple val(meta), path("*.paf"), emit: paf tuple val(meta), path("*.paf"), optional: true, emit: paf
tuple val(meta), path("*.bam"), optional: true, emit: bam
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
when: when:
@ -22,13 +26,19 @@ process MINIMAP2_ALIGN {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def input_reads = meta.single_end ? "$reads" : "${reads[0]} ${reads[1]}" def input_reads = meta.single_end ? "$reads" : "${reads[0]} ${reads[1]}"
def bam_output = bam_format ? "-a | samtools sort | samtools view -@ ${task.cpus} -b -h -o ${prefix}.bam" : "-o ${prefix}.paf"
def cigar_paf = cigar_paf_format && !sam_format ? "-c" : ''
def set_cigar_bam = cigar_bam && sam_format ? "-L" : ''
""" """
minimap2 \\ minimap2 \\
$args \\ $args \\
-t $task.cpus \\ -t $task.cpus \\
$reference \\ $reference \\
$input_reads \\ $input_reads \\
> ${prefix}.paf $cigar_paf \\
$set_cigar_bam \\
$bam_output
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -29,6 +29,17 @@ input:
type: file type: file
description: | description: |
Reference database in FASTA format. Reference database in FASTA format.
- bam_format:
type: boolean
description: Specify that output should be in BAM format
- cigar_paf_format:
type: boolean
description: Specify that output CIGAR should be in PAF format
- cigar_bam:
type: boolean
description: |
Write CIGAR with >65535 ops at the CG tag. This is recommended when
doing XYZ (https://github.com/lh3/minimap2#working-with-65535-cigar-operations)
output: output:
- meta: - meta:
type: map type: map
@ -39,9 +50,16 @@ output:
type: file type: file
description: Alignment in PAF format description: Alignment in PAF format
pattern: "*.paf" pattern: "*.paf"
- bam:
type: file
description: Alignment in BAM format
pattern: "*.bam"
- versions: - versions:
type: file type: file
description: File containing software versions description: File containing software versions
pattern: "versions.yml" pattern: "versions.yml"
authors: authors:
- "@heuermh" - "@heuermh"
- "@sofstam"
- "@sateeshperi"
- "@jfy133"

View file

@ -9,8 +9,11 @@ workflow test_minimap2_align_single_end {
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)] [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]
] ]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
bam_format = true
cigar_paf_format = false
cigar_bam = false
MINIMAP2_ALIGN ( input, fasta ) MINIMAP2_ALIGN ( input, fasta, bam_format, cigar_paf_format, cigar_bam)
} }
workflow test_minimap2_align_paired_end { workflow test_minimap2_align_paired_end {
@ -19,6 +22,9 @@ workflow test_minimap2_align_paired_end {
file(params.test_data['sarscov2']['illumina']['test_2_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) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
bam_format = true
cigar_paf_format = false
cigar_bam = false
MINIMAP2_ALIGN ( input, fasta ) MINIMAP2_ALIGN ( input, fasta, bam_format, cigar_paf_format, cigar_bam )
} }

View file

@ -1,17 +1,17 @@
- name: minimap2 align single-end - name: minimap2 align test_minimap2_align_single_end
command: nextflow run ./tests/modules/minimap2/align -entry test_minimap2_align_single_end -c ./tests/config/nextflow.config -c ./tests/modules/minimap2/align/nextflow.config command: nextflow run tests/modules/minimap2/align -entry test_minimap2_align_single_end -c tests/config/nextflow.config
tags: tags:
- minimap2 - minimap2
- minimap2/align - minimap2/align
files: files:
- path: ./output/minimap2/test.paf - path: output/minimap2/test.bam
md5sum: 70e8cf299ee3ecd33e629d10c1f588ce - path: output/minimap2/versions.yml
- name: minimap2 align paired-end - name: minimap2 align test_minimap2_align_paired_end
command: nextflow run ./tests/modules/minimap2/align -entry test_minimap2_align_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/minimap2/align/nextflow.config command: nextflow run tests/modules/minimap2/align -entry test_minimap2_align_paired_end -c tests/config/nextflow.config
tags: tags:
- minimap2 - minimap2
- minimap2/align - minimap2/align
files: files:
- path: ./output/minimap2/test.paf - path: output/minimap2/test.bam
md5sum: 5e7b55a26bf0ea3a2843423d3e0b9a28 - path: output/minimap2/versions.yml