Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sentieon wgsmetrics #3727

Merged
merged 7 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ jobs:
tags: sentieon/readwriter
- profile: "conda"
tags: sentieon/varcal
- profile: "conda"
tags: sentieon/wgsmetrics
- profile: "conda"
tags: spaceranger/count
- profile: "conda"
Expand Down
81 changes: 81 additions & 0 deletions modules/nf-core/sentieon/wgsmetrics/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
process SENTIEON_WGSMETRICS {
tag "$meta.id"
label 'process_medium'
label 'sentieon'

secret 'SENTIEON_LICENSE_BASE64'

container 'nf-core/sentieon:202112.06'

input:
tuple val(meta), path(bam), path(bai)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)
tuple val(meta4), path(intervals_list)


output:
tuple val(meta), path('*.txt'), emit: wgs_metrics
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 input = bam.sort().collect{"-i $it"}.join(' ')
def prefix = task.ext.prefix ?: "${meta.id}"
def interval = intervals_list ? "--interval ${intervals_list}" : ""
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 \\
-r $fasta \\
$input \\
$interval \\
$args \\
--algo WgsMetricsAlgo ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
END_VERSIONS
"""

stub:
// 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 prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g")
END_VERSIONS
"""
}
73 changes: 73 additions & 0 deletions modules/nf-core/sentieon/wgsmetrics/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "sentieon_wgsmetrics"
description: Collects whole genome quality metrics from a bam file
keywords:
- metrics
- bam
- 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' ]`
- meta4:
type: map
description: |
Groovy Map containing reference information
e.g. `[ id:'test' ]`
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- bai:
type: file
description: Index of th sorted BAM/CRAM/SAM file
pattern: "*.{bai,crai,sai}"
- fasta:
type: file
description: Genome fasta file
pattern: "*.{fa,fasta}"
- fai:
type: file
description: Index of the genome fasta file
pattern: "*.fai"
- interval_list:
type: file
description: bed or interval_list file containing interval in the reference that will be used in the analysis
pattern: "*.{bed,interval_list}"

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"
- wgs_metrics:
type: file
description: File containing the information about mean base quality score for each sequencing cycle
pattern: "*.txt"

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 @@ -3299,6 +3299,10 @@ sentieon/readwriter:
- modules/nf-core/sentieon/readwriter/**
- tests/modules/nf-core/sentieon/readwriter/**

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

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

nextflow.enable.dsl = 2

include { SENTIEON_WGSMETRICS } from '../../../../../modules/nf-core/sentieon/wgsmetrics/main.nf'

workflow test_sentieon_wgsmetrics {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)
]
fasta = [
[id:'genome'],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
fai = [
[id:'genome'],
file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
]

SENTIEON_WGSMETRICS ( input, fasta, fai, [[:],[]] )
}
10 changes: 10 additions & 0 deletions tests/modules/nf-core/sentieon/wgsmetrics/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
}

}
8 changes: 8 additions & 0 deletions tests/modules/nf-core/sentieon/wgsmetrics/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: "sentieon wgsmetrics"
command: nextflow run ./tests/modules/nf-core/sentieon/wgsmetrics -entry test_sentieon_wgsmetrics -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/sentieon/wgsmetrics/nextflow.config
tags:
- "sentieon"
- "sentieon/wgsmetrics"
files:
- path: "output/sentieon/test.txt"
- path: "output/sentieon/versions.yml"
Loading