mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 19:18:17 +00:00
Add module kallisto/index (#357)
* add kallisto index module * update kallisto module * add kallisto module tests * update kallisto index test.yml * update test data paths * fix version * fix kallisto index test yml * remove TODOs * Update software/kallisto/index/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/kallisto/index/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * output folder instead Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
acb1a12a56
commit
22eaefe583
6 changed files with 155 additions and 0 deletions
60
software/kallisto/index/functions.nf
Normal file
60
software/kallisto/index/functions.nf
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* -----------------------------------------------------
|
||||||
|
* 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()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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_id = args.publish_by_id ?: false
|
||||||
|
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) {
|
||||||
|
if (!args.filename.endsWith('.version.txt')) {
|
||||||
|
def ioptions = initOptions(args.options)
|
||||||
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
|
if (ioptions.publish_by_id) {
|
||||||
|
path_list.add(args.publish_id)
|
||||||
|
}
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
software/kallisto/index/main.nf
Normal file
39
software/kallisto/index/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process KALLISTO_INDEX {
|
||||||
|
tag "$fasta"
|
||||||
|
label 'process_medium'
|
||||||
|
publishDir "${params.outdir}",
|
||||||
|
mode: params.publish_dir_mode,
|
||||||
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::kallisto=0.46.2" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/kallisto:0.46.2--h4f7b962_1"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/kallisto:0.46.2--h4f7b962_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
path "kallisto" , emit: idx
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
"""
|
||||||
|
kallisto \\
|
||||||
|
index \\
|
||||||
|
$options.args \\
|
||||||
|
-i kallisto \\
|
||||||
|
$fasta
|
||||||
|
|
||||||
|
echo \$(kallisto 2>&1) | sed 's/^kallisto //; s/Usage.*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
31
software/kallisto/index/meta.yml
Normal file
31
software/kallisto/index/meta.yml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
name: kallisto_index
|
||||||
|
description: write your description here
|
||||||
|
keywords:
|
||||||
|
- sort
|
||||||
|
tools:
|
||||||
|
- kallisto:
|
||||||
|
description: Quantifying abundances of transcripts from bulk and single-cell RNA-Seq data, or more generally of target sequences using high-throughput sequencing reads.
|
||||||
|
homepage: https://pachterlab.github.io/kallisto/
|
||||||
|
documentation: https://pachterlab.github.io/kallisto/manual
|
||||||
|
tool_dev_url: https://github.com/pachterlab/kallisto
|
||||||
|
doi: ""
|
||||||
|
licence: ['BSD_2_clause']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: genome fasta file
|
||||||
|
pattern: "*.{fasta}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- idx:
|
||||||
|
type: index
|
||||||
|
description: Kallisto genome index
|
||||||
|
pattern: "*.idx"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@ggabernet"
|
|
@ -250,6 +250,10 @@ ivar_variants:
|
||||||
- software/ivar/variants/**
|
- software/ivar/variants/**
|
||||||
- tests/software/ivar/variants/**
|
- tests/software/ivar/variants/**
|
||||||
|
|
||||||
|
kallisto_index:
|
||||||
|
- software/kallisto/index/**
|
||||||
|
- tests/software/kallisto/index/**
|
||||||
|
|
||||||
kraken2_run:
|
kraken2_run:
|
||||||
- software/kraken2/run/**
|
- software/kraken2/run/**
|
||||||
- tests/software/kraken2/run/**
|
- tests/software/kraken2/run/**
|
||||||
|
|
13
tests/software/kallisto/index/main.nf
Normal file
13
tests/software/kallisto/index/main.nf
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { KALLISTO_INDEX } from '../../../../software/kallisto/index/main.nf' addParams( options: [:] )
|
||||||
|
|
||||||
|
workflow test_kallisto_index {
|
||||||
|
|
||||||
|
def input = []
|
||||||
|
input = file("${launchDir}/tests/data/genomics/sarscov2/genome/genome.fasta", checkIfExists: true)
|
||||||
|
|
||||||
|
KALLISTO_INDEX ( input )
|
||||||
|
}
|
8
tests/software/kallisto/index/test.yml
Normal file
8
tests/software/kallisto/index/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
- name: kallisto index test_kallisto_index
|
||||||
|
command: nextflow run tests/software/kallisto/index -entry test_kallisto_index -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- kallisto
|
||||||
|
- kallisto_index
|
||||||
|
files:
|
||||||
|
- path: output/kallisto/kallisto
|
||||||
|
md5sum: bf8a58d329dddc96f0c32f7823bc0310
|
Loading…
Reference in a new issue