mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
New module: isoseq3/refine
(#748)
* 📦 NEW: Add isoseq3/refine module * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: Re add 10000 data test * 👌 IMPROVE: Add parallelization * 🐛 FIX: Correct Typo * 👌 IMPROVE: Add some pbindex * 🐛 FIX: Add pbi extension to files * 👌 IMPROVE: The module accept one channel (primers moved into the first channel) * 👌 IMPROVE: Assign a value channel to primers input Improve workflow code readability * 👌 IMPROVE: Update to the version of templates * 👌 IMPROVE: Update module to last template version * 👌 IMPROVE: Remove pbi from input files * 👌 IMPROVE: Update test file * 👌 IMPROVE: Final version of test datasets config * 👌 IMPROVE: Remove useless index + Fix Typos * 👌 IMPROVE: Fill contains args * 📦 NEW: Add isoseq3/refine module * 👌 IMPROVE: Add parallelization * 🐛 FIX: Correct Typo * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: Re add 10000 data test * 👌 IMPROVE: Add some pbindex * 🐛 FIX: Add pbi extension to files * 👌 IMPROVE: The module accept one channel (primers moved into the first channel) * 👌 IMPROVE: Assign a value channel to primers input Improve workflow code readability * 👌 IMPROVE: Update to the version of templates * 👌 IMPROVE: Update module to last template version * 👌 IMPROVE: Remove pbi from input files * 👌 IMPROVE: Update test file * 👌 IMPROVE: Final version of test datasets config * 👌 IMPROVE: Remove useless index + Fix Typos * 👌 IMPROVE: Fill contains args * 👌 IMPROVE: Add one channel per output file * 👌 IMPROVE: Minor updates * 👌 IMPROVE: Minors Update - Remove TODO from test.yml - Remove useless piece of code * 📦 NEW: Add isoseq3/refine module * 👌 IMPROVE: Add parallelization * 🐛 FIX: Correct Typo * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: Re add 10000 data test * 👌 IMPROVE: Add some pbindex * 🐛 FIX: Add pbi extension to files * 👌 IMPROVE: The module accept one channel (primers moved into the first channel) * 👌 IMPROVE: Assign a value channel to primers input Improve workflow code readability * 👌 IMPROVE: Update to the version of templates * 👌 IMPROVE: Update module to last template version * 👌 IMPROVE: Remove pbi from input files * 👌 IMPROVE: Update test file * 👌 IMPROVE: Fill contains args * 📦 NEW: Add isoseq3/refine module * 👌 IMPROVE: Add parallelization * 🐛 FIX: Correct Typo * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: Re add 10000 data test * 👌 IMPROVE: Add some pbindex * 🐛 FIX: Add pbi extension to files * 👌 IMPROVE: The module accept one channel (primers moved into the first channel) * 👌 IMPROVE: Assign a value channel to primers input Improve workflow code readability * 👌 IMPROVE: Update to the version of templates * 👌 IMPROVE: Update module to last template version * 👌 IMPROVE: Remove pbi from input files * 👌 IMPROVE: Update test file * 👌 IMPROVE: Add one channel per output file * 👌 IMPROVE: Minor updates * 👌 IMPROVE: Minors Update - Remove TODO from test.yml - Remove useless piece of code * 🐛 FIX: Remove unwanted files * 🐛 FIX: Protect \ * 🐛 FIX: Remove test files * Apply suggestions from code review * Apply suggestions from code review * Update tests/modules/isoseq3/refine/test.yml Co-authored-by: Gregor Sturm <mail@gregor-sturm.de> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
84f2302920
commit
79d38a306b
6 changed files with 225 additions and 0 deletions
78
modules/isoseq3/refine/functions.nf
Normal file
78
modules/isoseq3/refine/functions.nf
Normal file
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// Extract name of module from process name using $task.process
|
||||
//
|
||||
def getProcessName(task_process) {
|
||||
return task_process.tokenize(':')[-1]
|
||||
}
|
||||
|
||||
//
|
||||
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||
//
|
||||
def initOptions(Map args) {
|
||||
def Map options = [:]
|
||||
options.args = args.args ?: ''
|
||||
options.args2 = args.args2 ?: ''
|
||||
options.args3 = args.args3 ?: ''
|
||||
options.publish_by_meta = args.publish_by_meta ?: []
|
||||
options.publish_dir = args.publish_dir ?: ''
|
||||
options.publish_files = args.publish_files
|
||||
options.suffix = args.suffix ?: ''
|
||||
return options
|
||||
}
|
||||
|
||||
//
|
||||
// Tidy up and join elements of a list to return a path string
|
||||
//
|
||||
def getPathFromList(path_list) {
|
||||
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
|
||||
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
|
||||
return paths.join('/')
|
||||
}
|
||||
|
||||
//
|
||||
// Function to save/publish module results
|
||||
//
|
||||
def saveFiles(Map args) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
|
||||
// Do not publish versions.yml unless running from pytest workflow
|
||||
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||
return null
|
||||
}
|
||||
if (ioptions.publish_by_meta) {
|
||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||
for (key in key_list) {
|
||||
if (args.meta && key instanceof String) {
|
||||
def path = key
|
||||
if (args.meta.containsKey(key)) {
|
||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
||||
}
|
||||
path = path instanceof String ? path : ''
|
||||
path_list.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ioptions.publish_files instanceof Map) {
|
||||
for (ext in ioptions.publish_files) {
|
||||
if (args.filename.endsWith(ext.key)) {
|
||||
def ext_list = path_list.collect()
|
||||
ext_list.add(ext.value)
|
||||
return "${getPathFromList(ext_list)}/$args.filename"
|
||||
}
|
||||
}
|
||||
} else if (ioptions.publish_files == null) {
|
||||
return "${getPathFromList(path_list)}/$args.filename"
|
||||
}
|
||||
}
|
49
modules/isoseq3/refine/main.nf
Normal file
49
modules/isoseq3/refine/main.nf
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ISOSEQ3_REFINE {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
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::isoseq3=3.4.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/isoseq3:3.4.0--0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/isoseq3:3.4.0--0"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam)
|
||||
path primers
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam") , emit: bam
|
||||
tuple val(meta), path("*.bam.pbi") , emit: pbi
|
||||
tuple val(meta), path("*.consensusreadset.xml"), emit: consensusreadset
|
||||
tuple val(meta), path("*.filter_summary.json") , emit: summary
|
||||
tuple val(meta), path("*.report.csv") , emit: report
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
"""
|
||||
isoseq3 \\
|
||||
refine \\
|
||||
-j $task.cpus \\
|
||||
$options.args \\
|
||||
$bam \\
|
||||
$primers \\
|
||||
${prefix}.bam
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
${getProcessName(task.process)}:
|
||||
${getSoftwareName(task.process)}: \$( isoseq3 refine --version|sed 's/isoseq refine //'|sed 's/ (commit.\\+//' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
62
modules/isoseq3/refine/meta.yml
Normal file
62
modules/isoseq3/refine/meta.yml
Normal file
|
@ -0,0 +1,62 @@
|
|||
name: isoseq3_refine
|
||||
description: Generate transcripts by clustering HiFi reads
|
||||
keywords:
|
||||
- isoseq3
|
||||
- isoseq3/refine
|
||||
tools:
|
||||
- isoseq3:
|
||||
description: IsoSeq3 - Scalable De Novo Isoform Discovery
|
||||
homepage: https://github.com/PacificBiosciences/IsoSeq/blob/master/isoseq-clustering.md
|
||||
documentation: https://github.com/PacificBiosciences/IsoSeq/blob/master/isoseq-clustering.md
|
||||
tool_dev_url: https://github.com/PacificBiosciences/IsoSeq/blob/master/isoseq-clustering.md
|
||||
doi: ""
|
||||
licence: ['BSD-3-clause-Clear']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM file, cleaned ccs generated by lima
|
||||
pattern: "*.bam"
|
||||
- primers:
|
||||
type: file
|
||||
description: fasta file of primers
|
||||
pattern: "*.fasta"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test' ]
|
||||
- bam:
|
||||
type: file
|
||||
description: Set of complete reads (with polyA tail), where the polyA has been trimmed
|
||||
pattern: "*.bam"
|
||||
- pbi:
|
||||
type: file
|
||||
description: Pacbio index file from polyA trimmed reads
|
||||
pattern: "*.pbi"
|
||||
- consensusreadset:
|
||||
type: file
|
||||
description: Metadata about read library
|
||||
pattern: "*.xml"
|
||||
- summary:
|
||||
type: file
|
||||
description: json file describing number of full length reads, full length non chimeric reads and full length non chimeric polyA reads
|
||||
pattern: "*.json"
|
||||
- report:
|
||||
type: file
|
||||
description: Metadata about primer and polyA detection (primers/polyA/insert length, strand, primer name)
|
||||
pattern: "*.csv"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@sguizard"
|
|
@ -525,6 +525,10 @@ iqtree:
|
|||
- modules/iqtree/**
|
||||
- tests/modules/iqtree/**
|
||||
|
||||
isoseq3/refine:
|
||||
- modules/isoseq3/refine/**
|
||||
- tests/modules/isoseq3/refine/**
|
||||
|
||||
ismapper:
|
||||
- modules/ismapper/**
|
||||
- tests/modules/ismapper/**
|
||||
|
|
16
tests/modules/isoseq3/refine/main.nf
Normal file
16
tests/modules/isoseq3/refine/main.nf
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { ISOSEQ3_REFINE } from '../../../../modules/isoseq3/refine/main' addParams( options: [suffix:'.refine'] )
|
||||
|
||||
workflow test_isoseq3_refine {
|
||||
|
||||
input = [
|
||||
[ id:'test' ], // meta map
|
||||
file(params.test_data['homo_sapiens']['pacbio']['lima'], checkIfExists: true),
|
||||
]
|
||||
primers = file(params.test_data['homo_sapiens']['pacbio']['primers'], checkIfExists: true)
|
||||
|
||||
ISOSEQ3_REFINE ( input, primers )
|
||||
}
|
16
tests/modules/isoseq3/refine/test.yml
Normal file
16
tests/modules/isoseq3/refine/test.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: isoseq3 refine test_isoseq3_refine
|
||||
command: nextflow run tests/modules/isoseq3/refine -entry test_isoseq3_refine -c tests/config/nextflow.config
|
||||
tags:
|
||||
- isoseq3
|
||||
- isoseq3/refine
|
||||
files:
|
||||
- path: output/isoseq3/test.refine.bam
|
||||
md5sum: e8387afd5f66a7f6a89f90a0dcf3b823
|
||||
- path: output/isoseq3/test.refine.bam.pbi
|
||||
md5sum: 8097cad9e472f2f79de6de5fe3dcc822
|
||||
- path: output/isoseq3/test.refine.consensusreadset.xml
|
||||
contains: [ 'pbds:ConsensusReadSet' ]
|
||||
- path: output/isoseq3/test.refine.filter_summary.json
|
||||
md5sum: 87f8bdd5c60741f47b8a991e002f7ef3
|
||||
- path: output/isoseq3/test.refine.report.csv
|
||||
md5sum: d42a139e5d9b08396bdb087c01243ea9
|
Loading…
Reference in a new issue