new module: Picard/fastqtosam (#1911)

* add Picard FastqToSam

* Update test.yml

* update tests

* possible fix?

* fixed!

* Update modules/picard/fastqtosam/main.nf

Co-authored-by: Moritz E. Beber <midnighter@posteo.net>

* Update modules/picard/fastqtosam/main.nf

Co-authored-by: Moritz E. Beber <midnighter@posteo.net>

* simplify tests

* fix tests

* revert version check

Co-authored-by: CMGG ICT Team <ict@cmgg.be>
Co-authored-by: Moritz E. Beber <midnighter@posteo.net>
This commit is contained in:
Matthias De Smet 2022-08-30 14:27:00 +02:00 committed by GitHub
parent 89a84538be
commit ee46c19d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,43 @@
process PICARD_FASTQTOSAM {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::picard=2.27.4" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/picard:2.27.4--hdfd78af_0' :
'quay.io/biocontainers/picard:2.27.4--hdfd78af_0' }"
input:
tuple val(meta), path(reads)
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}"
if (!task.memory) {
log.warn '[Picard FastqToSam] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
}
def avail_mem = task.memory ? task.memory.giga : 3
def input = meta.single_end ? "--FASTQ ${reads}" : "--FASTQ ${reads[0]} --FASTQ2 ${reads[1]}"
def sample_name = args.contains("--SAMPLE_NAME") || args.contains("-SM") ? "" : "--SAMPLE_NAME ${prefix}"
"""
picard \\
-Xmx${avail_mem}g \\
FastqToSam \\
${args} \\
${input} \\
${sample_name} \\
--OUTPUT ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
picard: \$(picard FastqToSam --version 2>&1 | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""
}

View file

@ -0,0 +1,46 @@
name: "picard_fastqtosam"
description: Converts a FASTQ file to an unaligned BAM or SAM file.
keywords:
- fastq
- unaligned
- bam
tools:
- picard:
description: |
A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS)
data and formats such as SAM/BAM/CRAM and VCF.
homepage: https://broadinstitute.github.io/picard/
documentation: https://gatk.broadinstitute.org/hc/en-us/articles/360036510672-FastqToSam-Picard-
tool_dev_url: https://github.com/broadinstitute/picard
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 and 2 for single-end and paired-end data,
respectively.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
#
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: Unaligned bam file
pattern: "*.{bam}"
authors:
- "@matthdsm"

View file

@ -1715,6 +1715,10 @@ picard/crosscheckfingerprints:
- modules/picard/crosscheckfingerprints/**
- tests/modules/picard/crosscheckfingerprints/**
picard/fastqtosam:
- modules/picard/fastqtosam/**
- tests/modules/picard/fastqtosam/**
picard/filtersamreads:
- modules/picard/filtersamreads/**
- tests/modules/picard/filtersamreads/**

View file

@ -0,0 +1,43 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { PICARD_FASTQTOSAM } from '../../../../modules/picard/fastqtosam/main.nf'
workflow test_picard_fastqtosam_single {
input = [
[ id:'test', single_end:true ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
]
PICARD_FASTQTOSAM ( input )
}
workflow test_picard_fastqtosam_paired {
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)
]
]
PICARD_FASTQTOSAM ( input )
}
workflow test_picard_fastqtosam_paired_custom_samplename {
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)
]
]
PICARD_FASTQTOSAM ( input )
}

View file

@ -0,0 +1,7 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: "test_picard_fastqtosam_paired_custom_samplename:PICARD_FASTQTOSAM" {
ext.args = "--SAMPLE_NAME CustomSample"
}
}

View file

@ -0,0 +1,26 @@
- name: picard fastqtosam test_picard_fastqtosam_single
command: nextflow run ./tests/modules/picard/fastqtosam -entry test_picard_fastqtosam_single -c ./tests/config/nextflow.config -c ./tests/modules/picard/fastqtosam/nextflow.config
tags:
- picard
- picard/fastqtosam
files:
- path: output/picard/test.bam
md5sum: fe2882efe8f13a8da20fcc63469ed0aa
- name: picard fastqtosam test_picard_fastqtosam_paired
command: nextflow run ./tests/modules/picard/fastqtosam -entry test_picard_fastqtosam_paired -c ./tests/config/nextflow.config -c ./tests/modules/picard/fastqtosam/nextflow.config
tags:
- picard
- picard/fastqtosam
files:
- path: output/picard/test.bam
md5sum: 90e4f59f9d942f96c3f3c41160f3fd5d
- name: picard fastqtosam test_picard_fastqtosam_paired_custom_samplename
command: nextflow run ./tests/modules/picard/fastqtosam -entry test_picard_fastqtosam_paired_custom_samplename -c ./tests/config/nextflow.config -c ./tests/modules/picard/fastqtosam/nextflow.config
tags:
- picard
- picard/fastqtosam
files:
- path: output/picard/test.bam
md5sum: 69d35ee2b5dc263d022eaf59a9e383d3