mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
commit
278a4a5669
6 changed files with 338 additions and 0 deletions
4
.github/filters.yml
vendored
4
.github/filters.yml
vendored
|
@ -281,6 +281,10 @@ seacr_callpeak:
|
|||
- software/seacr/callpeak/**
|
||||
- tests/software/seacr/callpeak/**
|
||||
|
||||
seqkit_split2:
|
||||
- software/seqkit/split2/**
|
||||
- tests/software/seqkit/split2/**
|
||||
|
||||
seqwish_induce:
|
||||
- software/seqwish/induce/**
|
||||
- tests/software/seqwish/induce/**
|
||||
|
|
59
software/seqkit/split2/functions.nf
Normal file
59
software/seqkit/split2/functions.nf
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* -----------------------------------------------------
|
||||
* 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.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"
|
||||
}
|
||||
}
|
||||
}
|
59
software/seqkit/split2/main.nf
Normal file
59
software/seqkit/split2/main.nf
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
def options = initOptions(params.options)
|
||||
|
||||
process SEQKIT_SPLIT2 {
|
||||
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), publish_id:meta.id) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::seqkit=0.15.0" : null)
|
||||
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/seqkit:0.15.0--0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/seqkit:0.15.0--0"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(reads)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.split/*.gz"), emit: reads
|
||||
path("*.version.txt") , emit: version
|
||||
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
|
||||
if(meta.single_end){
|
||||
"""
|
||||
seqkit \
|
||||
split2 \
|
||||
$options.args \
|
||||
--threads $task.cpus \
|
||||
-1 ${reads} \
|
||||
--out-dir ${prefix}.split
|
||||
|
||||
echo \$(seqkit --version 2>&1) | sed 's/^.*seqkit //; s/Using.*\$//' > ${software}.version.txt
|
||||
"""
|
||||
} else {
|
||||
"""
|
||||
seqkit \
|
||||
split2 \
|
||||
$options.args \
|
||||
--threads $task.cpus \
|
||||
-1 ${reads[0]} \
|
||||
-2 ${reads[1]} \
|
||||
--out-dir ${prefix}.split
|
||||
|
||||
echo \$(seqkit --version 2>&1) | sed 's/^.*seqkit //; s/Using.*\$//' > ${software}.version.txt
|
||||
"""
|
||||
}
|
||||
}
|
59
software/seqkit/split2/meta.yml
Normal file
59
software/seqkit/split2/meta.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
name: seqkit_split2
|
||||
description: Split single or paired-end fastq.gz files
|
||||
keywords:
|
||||
- split
|
||||
- fastq
|
||||
tools:
|
||||
- seqkit:
|
||||
description: |
|
||||
Cross-platform and ultrafast toolkit for FASTA/Q file manipulation, written by Wei Shen.
|
||||
homepage: https://github.com/shenwei356/seqkit
|
||||
documentation: https://bioinf.shenwei.me/seqkit/
|
||||
doi: 10.1371/journal.pone.0163962
|
||||
params:
|
||||
- outdir:
|
||||
type: string
|
||||
description: |
|
||||
The pipeline's output directory. By default, the module will
|
||||
output files into `$params.outdir/<SOFTWARE>`
|
||||
- publish_dir_mode:
|
||||
type: string
|
||||
description: |
|
||||
Value for the Nextflow `publishDir` mode parameter.
|
||||
Available: symlink, rellink, link, copy, copyNoFollow, move.
|
||||
- enable_conda:
|
||||
type: boolean
|
||||
description: |
|
||||
Run the module with Conda using the software specified
|
||||
via the `conda` directive
|
||||
- singularity_pull_docker_container:
|
||||
type: boolean
|
||||
description: |
|
||||
Instead of directly downloading Singularity images for use with Singularity,
|
||||
force the workflow to pull and convert Docker containers instead.
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- reads:
|
||||
type: file
|
||||
description: FastQ files
|
||||
pattern: "*.{fq.gz/fastq.gz}"
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- reads:
|
||||
type: file
|
||||
description: Split fastq files
|
||||
pattern: "*.{fq.gz/fastq.gz}"
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
authors:
|
||||
- "@FriederikeHanssen"
|
55
tests/software/seqkit/split2/main.nf
Normal file
55
tests/software/seqkit/split2/main.nf
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { SEQKIT_SPLIT2 as SEQKIT_SPLIT2_LENGTH } from '../../../../software/seqkit/split2/main.nf' addParams( options: ['args': '--by-length 26K'] )
|
||||
include { SEQKIT_SPLIT2 as SEQKIT_SPLIT2_SIZE } from '../../../../software/seqkit/split2/main.nf' addParams( options: ['args': '--by-size 200' ] )
|
||||
include { SEQKIT_SPLIT2 as SEQKIT_SPLIT2_PART } from '../../../../software/seqkit/split2/main.nf' addParams( options: ['args': '--by-part 3'] )
|
||||
|
||||
workflow test_seqkit_split2_single_end_length {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_R1.fastq.gz", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_LENGTH ( input )
|
||||
}
|
||||
|
||||
workflow test_seqkit_split2_single_end_size {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_R1.fastq.gz", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_SIZE ( input )
|
||||
}
|
||||
|
||||
workflow test_seqkit_split2_single_end_part {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:true ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_R1.fastq.gz", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_PART ( input )
|
||||
}
|
||||
|
||||
workflow test_seqkit_split2_paired_end_length {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_*", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_LENGTH ( input )
|
||||
}
|
||||
|
||||
workflow test_seqkit_split2_paired_end_size {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_*", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_SIZE ( input )
|
||||
}
|
||||
|
||||
workflow test_seqkit_split2_paired_end_part {
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
file("${launchDir}/tests/data/fastq/dna/SRR396636_*", checkIfExists: true) ]
|
||||
|
||||
SEQKIT_SPLIT2_PART ( input )
|
||||
}
|
102
tests/software/seqkit/split2/test.yml
Normal file
102
tests/software/seqkit/split2/test.yml
Normal file
|
@ -0,0 +1,102 @@
|
|||
- name: seqkit split2 single-end length
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_single_end_length -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_single_end
|
||||
- length
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: fb45cfec0d0d37f85abe81a0d299137e
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 0dfb5284ee0bb7e1b77b57dc1bd16311
|
||||
|
||||
|
||||
- name: seqkit split2 single-end size
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_single_end_size -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_single_end
|
||||
- size
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: e76ac276819eb862c0a931755a220b50
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 79eb15ff1aac645308fab188915f9edf
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_003.fastq.gz
|
||||
md5sum: f01fa62d34012a2e9cc48972dfe8c14c
|
||||
|
||||
- name: seqkit split2 single-end part
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_single_end_part -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_single_end
|
||||
- part
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: c394bc973e1f0f9bda835e4a7610d2e1
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 152e4470b8caeed1fc1c0326f34aa4e6
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_003.fastq.gz
|
||||
md5sum: 6d8a9f6ed0f4eadbb8b1c560bfea384d
|
||||
|
||||
- name: seqkit split2 paired-end length
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_paired_end_length -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_paired_end
|
||||
- length
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: fb45cfec0d0d37f85abe81a0d299137e
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 0dfb5284ee0bb7e1b77b57dc1bd16311
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_001.fastq.gz
|
||||
md5sum: 4e9704a4a0f4bcab4900b6fcd9323d8a
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_002.fastq.gz
|
||||
md5sum: da93241d0cfa84d4b806e1e102c16977
|
||||
|
||||
- name: seqkit split2 paired-end size
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_paired_end_size -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_paired_end
|
||||
- size
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: e76ac276819eb862c0a931755a220b50
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 79eb15ff1aac645308fab188915f9edf
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_003.fastq.gz
|
||||
md5sum: f01fa62d34012a2e9cc48972dfe8c14c
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_001.fastq.gz
|
||||
md5sum: 357bfa5b981f34d87f682aebcf5e46fe
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_002.fastq.gz
|
||||
md5sum: f48f3389d2870f4934139a901e5c4bb2
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_003.fastq.gz
|
||||
md5sum: d161aa05bac2f7d1823da0479949512b
|
||||
|
||||
- name: seqkit split2 paired-end part
|
||||
command: nextflow run ./tests/software/seqkit/split2 -entry test_seqkit_split2_paired_end_part -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqkit
|
||||
- seqkit_split2
|
||||
- seqkit_split2_paired_end
|
||||
- part
|
||||
files:
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_001.fastq.gz
|
||||
md5sum: c394bc973e1f0f9bda835e4a7610d2e1
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_002.fastq.gz
|
||||
md5sum: 152e4470b8caeed1fc1c0326f34aa4e6
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_003.fastq.gz
|
||||
md5sum: 6d8a9f6ed0f4eadbb8b1c560bfea384d
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_001.fastq.gz
|
||||
md5sum: 228aff8f1e56050967476fcad164a4fc
|
||||
- path: output/seqkit/test.split/SRR396636_R2.part_002.fastq.gz
|
||||
md5sum: 41047f3df10126c0df7f8e9bfd752b83
|
||||
- path: output/seqkit/test.split/SRR396636_R1.part_003.fastq.gz
|
||||
md5sum: 6d8a9f6ed0f4eadbb8b1c560bfea384d
|
Loading…
Reference in a new issue