nf-core_modules/modules/pbccs/main.nf
Sébastien Guizard bbf268c5d3
new module: pbccs (#688)
* 📦 NEW: First commit of pbccs module

* 👌 IMPROVE: Remove option from command + rename output (ccs -> bam)

* 👌 IMPROVE: Move .pbi output  into report channel

* 🐛FIX: Correct code after --rq option removal from command line module

- module main.nf: Remove ramaining rq input channel
- Test main.nf: Transfert rq into addParams
- Test test.yml: Update md5sums

* 🐛FIX: Repair additionnal option usage

* 👌 IMPROVE: Add some pacbio test files

* 🐛 FIX: Add Pacbio index to test_data.config

* 👌 IMPROVE: CCS is run in parallel with --chunk option

* 👌 IMPROVE: Add Pbindex in bam ouput channel

* 👌 IMPROVE: Change label to process_low

* 👌 IMPROVE: Define reports files names + add json version of txt report

* 🐛 FIX: Add missing backslashes

* 🐛 FIX: Add missing gz extension

* 🐛 FIX: update ouput channel

* 🐛 FIX: output file name

* 👌 IMPROVE: .gitignore

* 👌 IMPROVE: Update function.nf to last version

* 👌 IMPROVE: Update saveAs in main.nf

* 👌 IMPROVE: Add pbccs module

* 🐛 FIX: Fix Broken test

* 👌 IMPROVE: Update test_data.config

* 🐛 FIX: Fix test

* 👌 IMPROVE: Update path of test dataset files

* 👌 IMPROVE: Remove useless index + Fix Typos

* 📦 NEW: First commit of pbccs module

* 👌 IMPROVE: Remove option from command + rename output (ccs -> bam)

* 👌 IMPROVE: Move .pbi output  into report channel

* 🐛FIX: Correct code after --rq option removal from command line module

- module main.nf: Remove ramaining rq input channel
- Test main.nf: Transfert rq into addParams
- Test test.yml: Update md5sums

* 🐛FIX: Repair additionnal option usage

* 👌 IMPROVE: Add some pacbio test files

* 🐛 FIX: Add Pacbio index to test_data.config

* 👌 IMPROVE: CCS is run in parallel with --chunk option

* 👌 IMPROVE: Add Pbindex in bam ouput channel

* 👌 IMPROVE: Change label to process_low

* 👌 IMPROVE: Define reports files names + add json version of txt report

* 🐛 FIX: Add missing backslashes

* 🐛 FIX: Add missing gz extension

* 🐛 FIX: update ouput channel

* 🐛 FIX: output file name

* 👌 IMPROVE: .gitignore

* 👌 IMPROVE: Update function.nf to last version

* 👌 IMPROVE: Update saveAs in main.nf

* 👌 IMPROVE: Add pbccs module

* 🐛 FIX: Fix Broken test

* 👌 IMPROVE: Update test_data.config

* 🐛 FIX: Fix test

* 👌 IMPROVE: Update path of test dataset files

* 👌 IMPROVE: Remove useless index + Fix Typos

* 🐛 FIX: fill contains args

* 👌 IMPROVE: One output => One Channel

* 👌 IMPROVE: One input => One channel

* 🐛 FIX: Update tests

* 🐛 FIX: Remove TODOs from test.yaml

* 👌 IMPROVE: Revert and keep bam and pbi together

* 🐛 FIX: Remove old rq input from meta.yml

* 👌 IMPROVE: Update test to match input channels

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 11:48:18 +01:00

54 lines
2.1 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
options = initOptions(params.options)
process PBCCS {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::pbccs=6.0.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/pbccs:6.0.0--h9ee0642_2"
} else {
container "quay.io/biocontainers/pbccs:6.0.0--h9ee0642_2"
}
input:
tuple val(meta), path(bam), path(pbi)
val chunk_num
val chunk_on
output:
tuple val(meta), path("*.ccs.bam") , emit: bam
tuple val(meta), path("*.ccs.bam.pbi") , emit: pbi
tuple val(meta), path("*.ccs_report.txt" ) , emit: ccs_report_txt
tuple val(meta), path("*.ccs_report.json" ) , emit: ccs_report_json
tuple val(meta), path("*.zmw_metrics.json.gz"), emit: zmw_metrics
tuple val(meta), path("*.version.txt" ) , emit: version
script:
def software = getSoftwareName(task.process)
// def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def ccs = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs.bam'
def report_txt = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs_report.txt'
def report_json = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs_report.json'
def zmw_metrics = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.zmw_metrics.json.gz'
"""
ccs \\
$bam \\
$ccs \\
--report-file $report_txt \\
--report-json $report_json \\
--metrics-json $zmw_metrics \\
--chunk $chunk_num/$chunk_on \\
-j $task.cpus \\
$options.args
echo \$(ccs --version 2>&1) | grep -e 'commit' > ${software}.version.txt
"""
}