mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Add module for seqwish/induce
This commit is contained in:
parent
ed573db194
commit
206b605666
7 changed files with 208 additions and 0 deletions
4
.github/filters.yml
vendored
4
.github/filters.yml
vendored
|
@ -225,6 +225,10 @@ seacr_callpeak:
|
|||
- software/seacr/callpeak/**
|
||||
- tests/software/seacr/callpeak/**
|
||||
|
||||
seqwish_induce:
|
||||
- software/seqwish/induce/**
|
||||
- tests/software/seqwish/induce/**
|
||||
|
||||
star_align:
|
||||
- software/star/align/**
|
||||
- tests/software/star/align/**
|
||||
|
|
59
software/seqwish/induce/functions.nf
Normal file
59
software/seqwish/induce/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"
|
||||
}
|
||||
}
|
||||
}
|
44
software/seqwish/induce/main.nf
Normal file
44
software/seqwish/induce/main.nf
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
params.options = [:]
|
||||
def options = initOptions(params.options)
|
||||
|
||||
def VERSION = '0.4.1'
|
||||
|
||||
process SEQWISH_INDUCE {
|
||||
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::seqwish=0.4.1" : null)
|
||||
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/seqwish:0.4.1--h8b12597_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/seqwish:0.4.1--h8b12597_0"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(paf), path(fasta)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gfa"), emit: gfa
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
"""
|
||||
seqwish \\
|
||||
--threads $task.cpus \\
|
||||
--paf-alns=$paf \\
|
||||
--seqs=$fasta \\
|
||||
--gfa=${prefix}.gfa \\
|
||||
$options.args
|
||||
|
||||
echo $VERSION > ${software}.version.txt
|
||||
"""
|
||||
}
|
67
software/seqwish/induce/meta.yml
Normal file
67
software/seqwish/induce/meta.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
name: seqwish_induce
|
||||
description: Induce a variation graph in GFA format from alignments in PAF format
|
||||
keywords:
|
||||
- induce
|
||||
- paf
|
||||
- gfa
|
||||
- graph
|
||||
- variation graph
|
||||
tools:
|
||||
- seqwish:
|
||||
description: |
|
||||
seqwish implements a lossless conversion from pairwise alignments between
|
||||
sequences to a variation graph encoding the sequences and their alignments.
|
||||
homepage: https://github.com/ekg/seqwish
|
||||
documentation: https://github.com/ekg/seqwish
|
||||
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 ]
|
||||
- paf:
|
||||
type: file
|
||||
description: PAF file of alignments
|
||||
pattern: "*.{paf,paf.gz}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: FASTA file used to generate alignments
|
||||
pattern: "*.{fa,fa.gz,fasta,fasta.gz}"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- gfa:
|
||||
type: file
|
||||
description: Variation graph in GFA1 format
|
||||
pattern: "*.{gfa}"
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
authors:
|
||||
- "@heuermh"
|
|
@ -0,0 +1,11 @@
|
|||
lcl|MT192765.1_cds_QIK50426.1_1 21291 1 21289 + lcl|MT192765.1_cds_QIK50426.1_1 21291 1 21289 21288 21288 60 tp:A:P cm:i:3984 s1:i:21288 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50427.1_2 3822 8 3821 + lcl|MT192765.1_cds_QIK50427.1_2 3822 8 3821 3813 3813 60 tp:A:P cm:i:722 s1:i:3813 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50428.1_3 828 4 819 + lcl|MT192765.1_cds_QIK50428.1_3 828 4 819 815 815 60 tp:A:P cm:i:148 s1:i:815 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50429.1_4 228 6 226 + lcl|MT192765.1_cds_QIK50429.1_4 228 6 226 220 220 60 tp:A:P cm:i:42 s1:i:220 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50430.1_5 669 6 663 + lcl|MT192765.1_cds_QIK50430.1_5 669 6 663 657 657 60 tp:A:P cm:i:115 s1:i:657 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50431.1_6 186 0 185 + lcl|MT192765.1_cds_QIK50431.1_6 186 0 185 185 185 60 tp:A:P cm:i:33 s1:i:185 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50432.1_7 366 1 358 + lcl|MT192765.1_cds_QIK50432.1_7 366 1 358 357 357 60 tp:A:P cm:i:64 s1:i:357 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50433.1_8 132 6 124 + lcl|MT192765.1_cds_QIK50433.1_8 132 6 124 118 118 60 tp:A:P cm:i:20 s1:i:118 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50434.1_9 366 6 357 + lcl|MT192765.1_cds_QIK50434.1_9 366 6 357 351 351 60 tp:A:P cm:i:68 s1:i:351 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50435.1_10 1260 4 1255 + lcl|MT192765.1_cds_QIK50435.1_10 1260 4 1255 1251 1251 60 tp:A:P cm:i:231 s1:i:1251 s2:i:0 dv:f:0 rl:i:0
|
||||
lcl|MT192765.1_cds_QIK50436.1_11 117 0 116 + lcl|MT192765.1_cds_QIK50436.1_11 117 0 116 116 116 60 tp:A:P cm:i:19 s1:i:116 s2:i:0 dv:f:0 rl:i:0
|
15
tests/software/seqwish/induce/main.nf
Normal file
15
tests/software/seqwish/induce/main.nf
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { SEQWISH_INDUCE } from '../../../../software/seqwish/induce/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_seqwish_induce {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'GCA_011545545.1_ASM1154554v1_cds_from_genomic' ], // meta map
|
||||
[ file("${launchDir}/tests/data/paf/GCA_011545545.1_ASM1154554v1_cds_from_genomic.paf", checkIfExists: true) ],
|
||||
[ file("${launchDir}/tests/data/fasta/sarscov2/GCA_011545545.1_ASM1154554v1_cds_from_genomic.fna", checkIfExists: true) ] ]
|
||||
|
||||
SEQWISH_INDUCE ( input )
|
||||
}
|
8
tests/software/seqwish/induce/test.yml
Normal file
8
tests/software/seqwish/induce/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: seqwish induce
|
||||
command: nextflow run ./tests/software/seqwish/induce -entry test_seqwish_induce -c tests/config/nextflow.config
|
||||
tags:
|
||||
- seqwish
|
||||
- seqwish_induce
|
||||
files:
|
||||
- path: output/seqwish/GCA_011545545.1_ASM1154554v1_cds_from_genomic.gfa
|
||||
md5sum: 216a02d3aca322a457c31a62c628548e
|
Loading…
Reference in a new issue