forked from nf-core/modules
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new module: Picard/fastqtosam (nf-core#1911)
* add Picard FastqToSam * Update test.yml * update tests * possible fix? * fixed! * Update modules/picard/fastqtosam/main.nf Co-authored-by: Moritz E. Beber <[email protected]> * Update modules/picard/fastqtosam/main.nf Co-authored-by: Moritz E. Beber <[email protected]> * simplify tests * fix tests * revert version check Co-authored-by: CMGG ICT Team <[email protected]> Co-authored-by: Moritz E. Beber <[email protected]>
- Loading branch information
1 parent
6f131aa
commit d5bc3d2
Showing
6 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |