Picard addorreplacereadgroups (#1305)

* add picard-addorreplacereadgroups

* add picard_addorreplacereadgroups

* add new line to main.nf

* remove trailing whitespaces

* remove trailing whitespaces

* change to output in test yml

* add when directive

* picard 2.26.10 -> 2.26.9

* picard 2.26.10 -> 2.26.9 test yml

Co-authored-by: Peri <rrx8@cdc.gov>
Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
This commit is contained in:
Sateesh 2022-02-18 21:59:06 -05:00 committed by GitHub
parent 927dbfed04
commit a0d91e4a93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,53 @@
process PICARD_ADDORREPLACEREADGROUPS {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::picard=2.26.9" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/picard:2.26.9--hdfd78af_0' :
'quay.io/biocontainers/picard:2.26.9--hdfd78af_0' }"
input:
tuple val(meta), path(bam)
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 ID = task.ext.id ?: "id"
def LIBRARY= task.ext.library ?: "library"
def PLATFORM= task.ext.platform ?: "illumina"
def BARCODE= task.ext.barcode ?: "barcode"
def SAMPLE= task.ext.sample ?: "sample"
def INDEX= task.ext.index ?: "index"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard AddOrReplaceReadGroups] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
AddOrReplaceReadGroups \\
-Xmx${avail_mem}g \\
--INPUT ${bam} \\
--OUTPUT ${prefix}.bam \\
-ID ${ID} \\
-LB ${LIBRARY} \\
-PL ${PLATFORM} \\
-PU ${BARCODE} \\
-SM ${SAMPLE} \\
-CREATE_INDEX true
cat <<-END_VERSIONS > versions.yml
"${task.process}":
picard: \$(picard AddOrReplaceReadGroups --version 2>&1 | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""
}

View file

@ -0,0 +1,46 @@
name: picard_addorreplacereadgroups
description: Assigns all the reads in a file to a single new read-group
keywords:
- add
- replace
- read-group
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/360037226472-AddOrReplaceReadGroups-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: Input BAM file
pattern: "*.{bam}"
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: Output BAM file
pattern: "*.{bam}"
authors:
- "@sateeshperi"
- "@mjcipriano"
- "@hseabolt"

View file

@ -1157,6 +1157,10 @@ phyloflash:
- modules/phyloflash/** - modules/phyloflash/**
- tests/modules/phyloflash/** - tests/modules/phyloflash/**
picard/addorreplacereadgroups:
- modules/picard/addorreplacereadgroups/**
- tests/modules/picard/addorreplacereadgroups/**
picard/cleansam: picard/cleansam:
- modules/picard/cleansam/** - modules/picard/cleansam/**
- tests/modules/picard/cleansam/** - tests/modules/picard/cleansam/**

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { PICARD_ADDORREPLACEREADGROUPS } from '../../../../modules/picard/addorreplacereadgroups/main.nf'
workflow test_picard_addorreplacereadgroups {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
PICARD_ADDORREPLACEREADGROUPS ( input )
}

View file

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

View file

@ -0,0 +1,10 @@
- name: picard addorreplacereadgroups test_picard_addorreplacereadgroups
command: nextflow run tests/modules/picard/addorreplacereadgroups -entry test_picard_addorreplacereadgroups -c tests/config/nextflow.config
tags:
- picard
- picard/addorreplacereadgroups
files:
- path: output/picard/test.bam
md5sum: 7b82f3461c2d80fc6a10385e78c9427f
- path: output/picard/versions.yml
md5sum: 8a2d176295e1343146ea433c79bb517f