-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from CCBR/picard-samtofastq
New module picard samtofastq
- Loading branch information
Showing
8 changed files
with
156 additions
and
1 deletion.
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
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,48 @@ | ||
process PICARD_SAMTOFASTQ { | ||
tag { meta.id } | ||
label 'process_medium' | ||
|
||
container 'nciccbr/ccbr_picard_2.27.5:v1' | ||
|
||
input: | ||
tuple val(meta), path(bam) | ||
|
||
output: | ||
tuple val(meta), path("*.fastq.gz"), emit: reads | ||
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 output = meta.single_end ? "--FASTQ ${prefix}.fastq" : "--FASTQ ${prefix}_1.fastq --SECOND_END_FASTQ ${prefix}_2.fastq --UNPAIRED_FASTQ ${prefix}.unpaired.fastq" | ||
|
||
if (!task.memory) { | ||
log.warn '[Picard SamToFastq] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' | ||
} | ||
def avail_mem = task.memory ? (task.memory.mega*0.8).intValue() : 3072 | ||
|
||
""" | ||
picard \\ | ||
-Xmx${avail_mem}M \\ | ||
SamToFastq \\ | ||
${args} \\ | ||
--INPUT ${bam} \\ | ||
${output} | ||
pigz -p ${task.cpus} *.fastq | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
picard: \$(picard SamToFastq --version 2>&1 | grep -o 'Version:.*' | cut -f2- -d:) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
touch ${prefix}.fastq.gz versions.yml | ||
""" | ||
} |
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,44 @@ | ||
name: "picard_samtofastq" | ||
description: Converts a BAM or SAM file to fastq. Adapted from the nf-core gatk4 samtofastq module. | ||
keywords: | ||
- fastq | ||
- bam | ||
- sam | ||
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 ] | ||
- bam: | ||
type: file | ||
description: | | ||
SAM or BAM file | ||
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" | ||
- fastq: | ||
type: file | ||
description: fastq files | ||
pattern: "*.{fastq}" | ||
authors: | ||
- "@kelly-sovacool" | ||
maintainers: | ||
- "@kelly-sovacool" |
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,19 @@ | ||
#!/usr/bin/env nextflow | ||
|
||
nextflow.enable.dsl = 2 | ||
|
||
include { PICARD_SAMTOFASTQ } from '../../../../../modules/CCBR/picard/samtofastq/main.nf' | ||
|
||
workflow test_picard_samtofastq_single { | ||
input = [ [ id:'test', single_end: true ], // meta map | ||
[ file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) ] | ||
] | ||
PICARD_SAMTOFASTQ ( input ) | ||
} | ||
|
||
workflow test_picard_samtofastq_paired { | ||
input = [ [ id:'test', single_end: false ], // meta map | ||
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) ] | ||
] | ||
PICARD_SAMTOFASTQ ( 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,4 @@ | ||
process { | ||
|
||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } | ||
} |
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,34 @@ | ||
- name: picard samtofastq test_picard_samtofastq_single | ||
command: nextflow run ./tests/modules/CCBR/picard/samtofastq -entry test_picard_samtofastq_single -c ./tests/config/nextflow.config | ||
tags: | ||
- picard/samtofastq | ||
- picard | ||
files: | ||
- path: output/picard/test.fastq.gz | ||
contains: | ||
- "@ERR5069949.2151832" | ||
- path: output/picard/versions.yml | ||
|
||
- name: picard samtofastq test_picard_samtofastq_paired | ||
command: nextflow run ./tests/modules/CCBR/picard/samtofastq -entry test_picard_samtofastq_paired -c ./tests/config/nextflow.config | ||
tags: | ||
- picard/samtofastq | ||
- picard | ||
files: | ||
- path: output/picard/test_1.fastq.gz | ||
contains: | ||
- "@ERR5069949.2151832/1" | ||
- path: output/picard/test_2.fastq.gz | ||
contains: | ||
- "@ERR5069949.2151832/2" | ||
- path: output/picard/test.unpaired.fastq.gz | ||
- path: output/picard/versions.yml | ||
|
||
- name: picard samtofastq test_picard_samtofastq_single stub | ||
command: nextflow run ./tests/modules/CCBR/picard/samtofastq -entry test_picard_samtofastq_single -c ./tests/config/nextflow.config -stub | ||
tags: | ||
- picard/samtofastq | ||
- picard | ||
files: | ||
- path: output/picard/test.fastq.gz | ||
- path: output/picard/versions.yml |