Skip to content

Commit

Permalink
Add sentieon readwriter (#3721)
Browse files Browse the repository at this point in the history
* readwriter

* update meta

* Update meta.yml

* Apply suggestions from code review

Co-authored-by: Anders Sune Pedersen <37172585+asp8200@users.noreply.github.com>

---------

Co-authored-by: Anders Sune Pedersen <37172585+asp8200@users.noreply.github.com>
  • Loading branch information
ramprasadn and asp8200 authored Aug 10, 2023
1 parent 55e6e92 commit b28e4dd
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ jobs:
tags: sentieon/gvcftyper
- profile: "conda"
tags: sentieon/haplotyper
- profile: "conda"
tags: sentieon/readwriter
- profile: "conda"
tags: sentieon/varcal
- profile: "conda"
Expand Down
84 changes: 84 additions & 0 deletions modules/nf-core/sentieon/readwriter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
process SENTIEON_READWRITER {
tag "$meta.id"
label 'process_medium'
label 'sentieon'

secret 'SENTIEON_LICENSE_BASE64'

container 'nf-core/sentieon:202112.06'

input:
tuple val(meta), path(input), path(index)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)

output:
tuple val(meta), path("*.${format}"), emit: output
tuple val(meta), path("*.${index}") , emit: index
tuple val(meta), path("*.${format}"), path("*.${index}"), emit: output_index
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "Sentieon modules do not support Conda. Please use Docker / Singularity / Podman instead."
}
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def input_str = input.sort().collect{"-i $it"}.join(' ')
def reference = fasta ? "-r $fasta" : ''
def prefix = task.ext.prefix ?: "${meta.id}"
format = input.extension == "bam" ? "bam" : "cram"
index = format == "bam" ? "bam.bai" : "cram.crai"
def sentieon_auth_mech_base64 = task.ext.sentieon_auth_mech_base64 ?: ''
def sentieon_auth_data_base64 = task.ext.sentieon_auth_data_base64 ?: ''
"""
if [ "\${#SENTIEON_LICENSE_BASE64}" -lt "1500" ]; then # If the string SENTIEON_LICENSE_BASE64 is short, then it is an encrypted url.
export SENTIEON_LICENSE=\$(echo -e "\$SENTIEON_LICENSE_BASE64" | base64 -d)
else # Localhost license file
# The license file is stored as a nextflow variable like, for instance, this:
# nextflow secrets set SENTIEON_LICENSE_BASE64 \$(cat <sentieon_license_file.lic> | base64 -w 0)
export SENTIEON_LICENSE=\$(mktemp)
echo -e "\$SENTIEON_LICENSE_BASE64" | base64 -d > \$SENTIEON_LICENSE
fi
if [ ${sentieon_auth_mech_base64} ] && [ ${sentieon_auth_data_base64} ]; then
# If sentieon_auth_mech_base64 and sentieon_auth_data_base64 are non-empty strings, then Sentieon is mostly likely being run with some test-license.
export SENTIEON_AUTH_MECH=\$(echo -n "${sentieon_auth_mech_base64}" | base64 -d)
export SENTIEON_AUTH_DATA=\$(echo -n "${sentieon_auth_data_base64}" | base64 -d)
echo "Decoded and exported Sentieon test-license system environment variables"
fi
sentieon \\
driver \\
-t $task.cpus \\
$reference \\
$args \\
$input_str \\
--algo ReadWriter \\
$args2 \\
${prefix}.${format}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
format = input.extension == "bam" ? "bam" : "cram"
index = format == "bam" ? "bam.bai" : "cram.crai"
"""
touch ${prefix}.${format}
touch ${prefix}.${index}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
END_VERSIONS
"""
}
71 changes: 71 additions & 0 deletions modules/nf-core/sentieon/readwriter/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: sentieon_readwriter
description: Merges BAM files, and/or convert them into cram files. Also, outputs the result of applying the Base Quality Score Recalibration to a file.
keywords:
- merge
- convert
- readwriter
- sentieon
tools:
- sentieon:
description: |
Sentieon® provides complete solutions for secondary DNA/RNA analysis for a variety of sequencing platforms, including short and long reads.
Our software improves upon BWA, STAR, Minimap2, GATK, HaplotypeCaller, Mutect, and Mutect2 based pipelines and is deployable on any generic-CPU-based computing system.
homepage: https://www.sentieon.com/
documentation: https://www.sentieon.com/
input:
- meta:
type: map
description: |
Groovy Map containing sample information.
e.g. [ id:'test', single_end:false ]
- meta2:
type: map
description: |
Groovy Map containing reference information.
e.g. [ id:'test' ]
- meta3:
type: map
description: |
Groovy Map containing reference information.
e.g. [ id:'test' ]
- input:
type: file
description: BAM/CRAM file.
pattern: "*.{bam,cram}"
- index:
type: file
description: BAI/CRAI file.
pattern: "*.{bai,crai}"
- fasta:
type: file
description: Genome fasta file
pattern: "*.{fa,fasta}"
- fai:
type: file
description: The index of the FASTA reference.
pattern: "*.fai"

output:
- meta:
type: map
description: |
Groovy Map containing reference information.
e.g. [ id:'test', single_end:false ]
- output:
type: file
description: BAM/CRAM file
pattern: "*.{bam,cram}"
- index:
type: file
description: BAM/CRAM index file
pattern: "*.{bai,crai}"
- output_index:
type: file
description: BAM/CRAM alignment and the corresponding index file
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@ramprasadn"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3279,6 +3279,10 @@ sentieon/haplotyper:
- modules/nf-core/sentieon/haplotyper/**
- tests/modules/nf-core/sentieon/haplotyper/**

sentieon/readwriter:
- modules/nf-core/sentieon/readwriter/**
- tests/modules/nf-core/sentieon/readwriter/**

sentieon/varcal:
- modules/nf-core/sentieon/varcal/**
- tests/modules/nf-core/sentieon/varcal/**
Expand Down
31 changes: 31 additions & 0 deletions tests/modules/nf-core/sentieon/readwriter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { SENTIEON_READWRITER as SENTIEON_READWRITER_BAM } from '../../../../../modules/nf-core/sentieon/readwriter/main.nf'
include { SENTIEON_READWRITER as SENTIEON_READWRITER_CRAM } from '../../../../../modules/nf-core/sentieon/readwriter/main.nf'

workflow test_readwriter_bam {

bam = [
[ id: 'test' ],
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
]

SENTIEON_READWRITER_BAM ( bam, [[:],[]], [[:],[]] )
}

workflow test_readwriter_cram {

cram = [
[ id: 'test' ],
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true)
]

fasta = Channel.of([ [ id:'test' ], file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)]).collect()
fai = Channel.of([ [ id:'test' ], file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)]).collect()

SENTIEON_READWRITER_CRAM ( cram, fasta, fai )
}
10 changes: 10 additions & 0 deletions tests/modules/nf-core/sentieon/readwriter/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
process {

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

withLabel: 'sentieon' {
ext.sentieon_auth_mech_base64 = secrets.SENTIEON_AUTH_MECH_BASE64
ext.sentieon_auth_data_base64 = secrets.SENTIEON_AUTH_DATA_BASE64
}

}
39 changes: 39 additions & 0 deletions tests/modules/nf-core/sentieon/readwriter/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- name: sentieon test_readwriter_bam
command: nextflow run ./tests/modules/nf-core/sentieon/readwriter -entry test_readwriter_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sentieon/readwriter/nextflow.config
tags:
- sentieon
- sentieon/readwriter
files:
- path: ./output/sentieon/test.bam
- path: ./output/sentieon/test.bam.bai
- path: ./output/sentieon/versions.yml

- name: sentieon test_readwriter_cram
command: nextflow run ./tests/modules/nf-core/sentieon/readwriter -entry test_readwriter_cram -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sentieon/readwriter/nextflow.config
tags:
- sentieon
- sentieon/readwriter
files:
- path: ./output/sentieon/test.cram
- path: ./output/sentieon/test.cram.crai
- path: ./output/sentieon/versions.yml

- name: sentieon test_readwriter_bam_stub
command: nextflow run ./tests/modules/nf-core/sentieon/readwriter -entry test_readwriter_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sentieon/readwriter/nextflow.config -stub
tags:
- sentieon
- sentieon/readwriter
files:
- path: ./output/sentieon/test.bam
- path: ./output/sentieon/test.bam.bai
- path: ./output/sentieon/versions.yml

- name: sentieon test_readwriter_cram_stub
command: nextflow run ./tests/modules/nf-core/sentieon/readwriter -entry test_readwriter_cram -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sentieon/readwriter/nextflow.config -stub
tags:
- sentieon
- sentieon/readwriter
files:
- path: ./output/sentieon/test.cram
- path: ./output/sentieon/test.cram.crai
- path: ./output/sentieon/versions.yml

0 comments on commit b28e4dd

Please sign in to comment.