mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-13 05:13:09 +00:00
Add stringtie merge module (from nanoseq modules) (#475)
* add stringtie merge module * add md5sum and path for stringtie.merged.gtf * fix errors * try fixing stringtie check error * add tag * remove unreproducible md5sum * address PR suggestions * hopefully fix linting error
This commit is contained in:
parent
16d20a7cc4
commit
6ad50f8ec4
12 changed files with 278 additions and 38 deletions
60
software/stringtie/merge/functions.nf
Normal file
60
software/stringtie/merge/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"
|
||||
}
|
||||
}
|
||||
}
|
35
software/stringtie/merge/main.nf
Normal file
35
software/stringtie/merge/main.nf
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
def options = initOptions(params.options)
|
||||
|
||||
process STRINGTIE_MERGE {
|
||||
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:['']) }
|
||||
|
||||
// Note: 2.7X indices incompatible with AWS iGenomes.
|
||||
conda (params.enable_conda ? "bioconda::stringtie=2.1.4" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/stringtie:2.1.4--h7e0af3c_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/stringtie:2.1.4--h7e0af3c_0"
|
||||
}
|
||||
|
||||
input:
|
||||
path stringtie_gtf
|
||||
path annotation_gtf
|
||||
|
||||
output:
|
||||
path "stringtie.merged.gtf" , emit: merged_gtf
|
||||
|
||||
script:
|
||||
"""
|
||||
stringtie \\
|
||||
--merge $stringtie_gtf \\
|
||||
-G $annotation_gtf \\
|
||||
-o stringtie.merged.gtf
|
||||
"""
|
||||
}
|
31
software/stringtie/merge/meta.yml
Normal file
31
software/stringtie/merge/meta.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: stringtie_merge
|
||||
description: Merges the annotation gtf file and the stringtie output gtf files
|
||||
keywords:
|
||||
- merge
|
||||
- gtf
|
||||
- reference
|
||||
tools:
|
||||
- stringtie2:
|
||||
description: |
|
||||
Transcript assembly and quantification for RNA-Seq
|
||||
homepage: https://ccb.jhu.edu/software/stringtie/index.shtml
|
||||
documentation: https://ccb.jhu.edu/software/stringtie/index.shtml?t=manual
|
||||
input:
|
||||
- stringtie_gtf:
|
||||
type: file
|
||||
description: |
|
||||
Stringtie transcript gtf output(s).
|
||||
pattern: "*.gtf"
|
||||
- annotation_gtf:
|
||||
type: file
|
||||
description: |
|
||||
Annotation gtf file.
|
||||
pattern: "*.gtf"
|
||||
output:
|
||||
- merged_gtf:
|
||||
type: map
|
||||
description: |
|
||||
Merged gtf from annotation and stringtie output gtfs.
|
||||
pattern: "*.gtf"
|
||||
authors:
|
||||
- "@yuukiiwa"
|
56
software/stringtie/stringtie/meta.yml
Normal file
56
software/stringtie/stringtie/meta.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
name: stringtie
|
||||
description: Transcript assembly and quantification for RNA-Se
|
||||
keywords:
|
||||
- transcript
|
||||
- assembly
|
||||
- quantification
|
||||
- gtf
|
||||
|
||||
tools:
|
||||
- stringtie2:
|
||||
description: |
|
||||
Transcript assembly and quantification for RNA-Seq
|
||||
homepage: https://ccb.jhu.edu/software/stringtie/index.shtml
|
||||
documentation: https://ccb.jhu.edu/software/stringtie/index.shtml?t=manual
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: |
|
||||
Stringtie transcript gtf output(s).
|
||||
- gtf:
|
||||
type: file
|
||||
description: |
|
||||
Annotation gtf file.
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- transcript_gtf:
|
||||
type: file
|
||||
description: transcript gtf
|
||||
pattern: "*.{transcripts.gtf}"
|
||||
- coverage_gtf:
|
||||
type: file
|
||||
description: coverage gtf
|
||||
pattern: "*.{coverage.gtf}"
|
||||
- abudance:
|
||||
type: file
|
||||
description: abudance
|
||||
pattern: "*.{abudance.txt}"
|
||||
- ballgown:
|
||||
type: file
|
||||
description: for running ballgown
|
||||
pattern: "*.{ballgown}"
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
authors:
|
||||
- "@drpatelh"
|
|
@ -579,9 +579,13 @@ strelka/germline:
|
|||
- software/strelka/germline/**
|
||||
- tests/software/strelka/germline/**
|
||||
|
||||
stringtie:
|
||||
- software/stringtie/**
|
||||
- tests/software/stringtie/**
|
||||
stringtie/merge:
|
||||
- software/stringtie/merge/**
|
||||
- tests/software/stringtie/merge/**
|
||||
|
||||
stringtie/stringtie:
|
||||
- software/stringtie/stringtie/**
|
||||
- tests/software/stringtie/stringtie/**
|
||||
|
||||
subread/featurecounts:
|
||||
- software/subread/featurecounts/**
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { STRINGTIE as STRINGTIE_FORWARD } from '../../../software/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_forward' ] )
|
||||
include { STRINGTIE as STRINGTIE_REVERSE } from '../../../software/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_reverse' ] )
|
||||
|
||||
/*
|
||||
* Test with forward strandedness
|
||||
*/
|
||||
workflow test_stringtie_forward {
|
||||
input = [ [ id:'test', strandedness:'forward' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] ]
|
||||
gtf = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_FORWARD ( input, gtf )
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with reverse strandedness
|
||||
*/
|
||||
workflow test_stringtie_reverse {
|
||||
input = [ [ id:'test', strandedness:'reverse' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ]
|
||||
]
|
||||
gtf = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_REVERSE ( input, gtf )
|
||||
}
|
38
tests/software/stringtie/merge/main.nf
Normal file
38
tests/software/stringtie/merge/main.nf
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { STRINGTIE as STRINGTIE_FORWARD } from '../../../../software/stringtie/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_forward' ] )
|
||||
include { STRINGTIE as STRINGTIE_REVERSE } from '../../../../software/stringtie/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_reverse' ] )
|
||||
include { STRINGTIE_MERGE as STRINGTIE_FORWARD_MERGE} from '../../../../software/stringtie/merge/main.nf' addParams( options: [ publish_dir:'test_stringtie_forward_merge'] )
|
||||
include { STRINGTIE_MERGE as STRINGTIE_REVERSE_MERGE} from '../../../../software/stringtie/merge/main.nf' addParams( options: [ publish_dir:'test_stringtie_reverse_merge'] )
|
||||
/*
|
||||
* Test with forward strandedness
|
||||
*/
|
||||
workflow test_stringtie_forward_merge {
|
||||
input = [ [ id:'test', strandedness:'forward' ], // meta map
|
||||
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] ]
|
||||
annotation_gtf = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_FORWARD ( input, annotation_gtf )
|
||||
STRINGTIE_FORWARD.out.transcript_gtf
|
||||
.map { it -> it[1] }
|
||||
.set { stringtie_gtf }
|
||||
STRINGTIE_FORWARD_MERGE ( stringtie_gtf, annotation_gtf )
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with reverse strandedness
|
||||
*/
|
||||
workflow test_stringtie_reverse_merge {
|
||||
input = [ [ id:'test', strandedness:'reverse' ], // meta map
|
||||
[ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ]
|
||||
]
|
||||
annotation_gtf = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_REVERSE ( input, annotation_gtf )
|
||||
STRINGTIE_REVERSE.out.transcript_gtf
|
||||
.map { it -> it[1] }
|
||||
.set { stringtie_gtf }
|
||||
STRINGTIE_REVERSE_MERGE ( stringtie_gtf, annotation_gtf )
|
||||
}
|
17
tests/software/stringtie/merge/test.yml
Normal file
17
tests/software/stringtie/merge/test.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
- name: stringtie forward-strand merge
|
||||
command: nextflow run ./tests/software/stringtie/merge/ -entry test_stringtie_forward_merge -c tests/config/nextflow.config
|
||||
tags:
|
||||
- stringtie
|
||||
- stringtie/merge
|
||||
files:
|
||||
- path: ./output/test_stringtie_forward_merge/stringtie.merged.gtf
|
||||
md5sum: 676aa20a2d7a3db18136cdc7ba183099
|
||||
|
||||
- name: stringtie reverse-strand merge
|
||||
command: nextflow run ./tests/software/stringtie/merge/ -entry test_stringtie_reverse_merge -c tests/config/nextflow.config
|
||||
tags:
|
||||
- stringtie
|
||||
- stringtie/merge
|
||||
files:
|
||||
- path: ./output/test_stringtie_reverse_merge/stringtie.merged.gtf
|
||||
md5sum: 67e5102722ecaeea1fb44d1ec0953474
|
28
tests/software/stringtie/stringtie/main.nf
Normal file
28
tests/software/stringtie/stringtie/main.nf
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { STRINGTIE as STRINGTIE_FORWARD } from '../../../../software/stringtie/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_forward' ] )
|
||||
include { STRINGTIE as STRINGTIE_REVERSE } from '../../../../software/stringtie/stringtie/main.nf' addParams( options: [ publish_dir:'test_stringtie_reverse' ] )
|
||||
|
||||
/*
|
||||
* Test with forward strandedness
|
||||
*/
|
||||
workflow test_stringtie_forward {
|
||||
input = [ [ id:'test', strandedness:'forward' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] ]
|
||||
annotation_gtf = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_FORWARD ( input, annotation_gtf )
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with reverse strandedness
|
||||
*/
|
||||
workflow test_stringtie_reverse {
|
||||
input = [ [ id:'test', strandedness:'reverse' ], // meta map
|
||||
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] ]
|
||||
annotation_gtf = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
|
||||
|
||||
STRINGTIE_REVERSE ( input, annotation_gtf )
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
- name: stringtie forward-strand
|
||||
command: nextflow run ./tests/software/stringtie/ -entry test_stringtie_forward -c tests/config/nextflow.config
|
||||
- name: test_stringtie_forward
|
||||
command: nextflow run ./tests/software/stringtie/stringtie/ -entry test_stringtie_forward -c tests/config/nextflow.config
|
||||
tags:
|
||||
- stringtie
|
||||
- stringtie/stringtie
|
||||
files:
|
||||
- path: ./output/test_stringtie_forward/test.transcripts.gtf
|
||||
md5sum: 8abb6a87581bd7a61af74085b5a6daec
|
||||
- path: ./output/test_stringtie_forward/test.gene.abundance.txt
|
||||
md5sum: 7d8bce7f2a922e367cedccae7267c22e
|
||||
- path: ./output/test_stringtie_forward/test.coverage.gtf
|
||||
|
@ -20,13 +20,13 @@
|
|||
- path: ./output/test_stringtie_forward/test.ballgown/e2t.ctab
|
||||
md5sum: e981c0038295ae54b63cedb1083f1540
|
||||
|
||||
- name: stringtie reverse-strand
|
||||
command: nextflow run ./tests/software/stringtie/ -entry test_stringtie_reverse -c tests/config/nextflow.config
|
||||
- name: test_stringtie_reverse
|
||||
command: nextflow run ./tests/software/stringtie/stringtie/ -entry test_stringtie_reverse -c tests/config/nextflow.config
|
||||
tags:
|
||||
- stringtie
|
||||
- stringtie/stringtie
|
||||
files:
|
||||
- path: ./output/test_stringtie_reverse/test.transcripts.gtf
|
||||
md5sum: 8bdcda06f39183fa4312644bd0e41bb5
|
||||
- path: ./output/test_stringtie_reverse/test.gene.abundance.txt
|
||||
md5sum: 7385b870b955dae2c2ab78a70cf05cce
|
||||
- path: ./output/test_stringtie_reverse/test.coverage.gtf
|
Loading…
Reference in a new issue