mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
* Add module: nf-core hackathon #207 : new module: msisensor/msi * Add module: nf-core hackathon #207 : new module: msisensor/msi * Fix 4-spacing issues (caught in PR linting) * Code review fixes & update configs * Code review: remove stray echo * Code review: Add msisensor modules * Slashes to underscores to get tests to run on github * Update software/msisensor/scan/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/msisensor/scan/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/msisensor/msi/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/msisensor/msi/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Add all outputs to meta.ymls * Fixes from code review * Fixes from code review Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
f90b8ecb24
commit
fead37d57a
11 changed files with 391 additions and 0 deletions
60
software/msisensor/msi/functions.nf
Normal file
60
software/msisensor/msi/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"
|
||||
}
|
||||
}
|
||||
}
|
45
software/msisensor/msi/main.nf
Normal file
45
software/msisensor/msi/main.nf
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process MSISENSOR_MSI {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
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::msisensor=0.5" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/msisensor:0.5--hb3646a4_2"
|
||||
} else {
|
||||
container "quay.io/biocontainers/msisensor:0.5--hb3646a4_2"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(normal_bam), path(normal_bai), path(tumor_bam), path(tumor_bai), val(metascan), path(homopolymers)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${prefix}") , emit: output
|
||||
tuple val(meta), path("${prefix}_dis") , emit: output_dis
|
||||
tuple val(meta), path("${prefix}_germline"), emit: output_germline
|
||||
tuple val(meta), path("${prefix}_somatic") , emit: output_somatic
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
"""
|
||||
msisensor \\
|
||||
msi \\
|
||||
-d $homopolymers \\
|
||||
-n $normal_bam \\
|
||||
-t $tumor_bam \\
|
||||
-o $prefix \\
|
||||
$options.args
|
||||
|
||||
echo \$(msisensor 2>&1) | sed -nE 's/Version:\\sv([0-9]\\.[0-9])/\\1/ p' > ${software}.version.txt
|
||||
"""
|
||||
}
|
69
software/msisensor/msi/meta.yml
Normal file
69
software/msisensor/msi/meta.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
name: msisensor_msi
|
||||
|
||||
description: Evaluate microsattelite instability (MSI) using paired tumor-normal sequencing data
|
||||
keywords:
|
||||
- homoploymer,microsatellite
|
||||
tools:
|
||||
- msisensor:
|
||||
description: MSIsensor is a C++ program to detect replication slippage variants at microsatellite regions, and differentiate them as somatic or germline.
|
||||
homepage: https://github.com/ding-lab/msisensor
|
||||
documentation: None
|
||||
tool_dev_url: None
|
||||
doi: "10.1093/bioinformatics/btt755"
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- normal_bam:
|
||||
type: file
|
||||
description: Coordinate sorted BAM/CRAM/SAM file from normal tissue
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- normal_bai:
|
||||
type: file
|
||||
description: Index for coordinate sorted BAM/CRAM/SAM file from normal tissue
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- tumor_bam:
|
||||
type: file
|
||||
description: Coordinate sorted BAM/CRAM/SAM file from tumor tissue
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- tumor_bai:
|
||||
type: file
|
||||
description: Index for coordinate sorted BAM/CRAM/SAM file from tumor tissue
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- homopolymers:
|
||||
type: file
|
||||
description: Output file from MSIsensor scan module
|
||||
pattern: "*.msisensor_scan.tab"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
- txt:
|
||||
type: file
|
||||
description: MSIsensor MSI final report file
|
||||
pattern: "*.output"
|
||||
- txt:
|
||||
type: file
|
||||
description: MSIsensor MSI DIS report file
|
||||
pattern: "*.output_dis"
|
||||
- txt:
|
||||
type: file
|
||||
description: MSIsensor MSI germline report file
|
||||
pattern: "*.output_germline"
|
||||
- txt:
|
||||
type: file
|
||||
description: MSIsensor MSI somatic report file
|
||||
pattern: "*.output_somatic"
|
||||
authors:
|
||||
- "@kevbrick"
|
60
software/msisensor/scan/functions.nf
Normal file
60
software/msisensor/scan/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"
|
||||
}
|
||||
}
|
||||
}
|
40
software/msisensor/scan/main.nf
Normal file
40
software/msisensor/scan/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process MSISENSOR_SCAN {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
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::msisensor=0.5" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/msisensor:0.5--hb3646a4_2"
|
||||
} else {
|
||||
container "quay.io/biocontainers/msisensor:0.5--hb3646a4_2"
|
||||
}
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fasta)
|
||||
|
||||
output:
|
||||
tuple (val(meta), path("*.tab"), emit: txt)
|
||||
path ("*.version.txt" , emit: version)
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
"""
|
||||
msisensor \\
|
||||
scan \\
|
||||
-d $fasta \\
|
||||
-o ${prefix}.msisensor_scan.tab \\
|
||||
$options.args
|
||||
|
||||
echo \$(msisensor 2>&1) | sed -nE 's/Version:\\sv([0-9]\\.[0-9])/\\1/ p' > ${software}.version.txt
|
||||
"""
|
||||
}
|
42
software/msisensor/scan/meta.yml
Normal file
42
software/msisensor/scan/meta.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: msisensor_scan
|
||||
|
||||
description: Scan a reference genome to get microsatellite & homopolymer information
|
||||
keywords:
|
||||
- homoploymer,microsatellite
|
||||
tools:
|
||||
- msisensor:
|
||||
description: MSIsensor is a C++ program to detect replication slippage variants at microsatellite regions, and differentiate them as somatic or germline.
|
||||
homepage: https://github.com/ding-lab/msisensor
|
||||
documentation: None
|
||||
tool_dev_url: None
|
||||
doi: "10.1093/bioinformatics/btt755"
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- fasta:
|
||||
type: file
|
||||
description: FASTA file
|
||||
pattern: "*.{fa,fasta}"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
- txt:
|
||||
type: file
|
||||
description: MSIsensor scan output file of homopolymers & minisatellites
|
||||
pattern: "*.msisensor_scan.txt"
|
||||
|
||||
authors:
|
||||
- "@kevbrick"
|
|
@ -278,6 +278,14 @@ mosdepth:
|
|||
- software/mosdepth/**
|
||||
- tests/software/mosdepth/**
|
||||
|
||||
msisensor_scan:
|
||||
- software/msisensor/scan/**
|
||||
- tests/software/msisensor/scan/**
|
||||
|
||||
msisensor_msi:
|
||||
- software/msisensor/msi/**
|
||||
- tests/software/msisensor/msi/**
|
||||
|
||||
multiqc:
|
||||
- software/fastqc/**
|
||||
- software/multiqc/**
|
||||
|
|
31
tests/software/msisensor/msi/main.nf
Normal file
31
tests/software/msisensor/msi/main.nf
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { MSISENSOR_SCAN } from '../../../../software/msisensor/scan/main.nf' addParams( options: [:] )
|
||||
include { MSISENSOR_MSI } from '../../../../software/msisensor/msi/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_msisensor_msi {
|
||||
|
||||
def scaninput = []
|
||||
scaninput = [ [ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ]
|
||||
scan = MSISENSOR_SCAN ( scaninput )
|
||||
|
||||
// IMPERFECT TEST:
|
||||
// USING SARS-COV2 DATA AS NORMAL:TUMOR PAIR THIS WILL SUFFICE TO
|
||||
// TEST MODULE EXECUTION, BUT NOT FUNCTIONALITY.
|
||||
// FUNCTIONALITY HAS BEEN TESTED MANUALY USING AUTHOR-PROVIDED TEST
|
||||
// DATA (https://github.com/ding-lab/msisensor/tree/master/test)
|
||||
def input = []
|
||||
|
||||
input = Channel.from([ [ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['illumina']['test_methylated_paired_end_sorted_bam'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_methylated_paired_end_sorted_bam_bai'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
|
||||
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ])
|
||||
//scan.txt.view()
|
||||
input.concat(scan.txt).collect().view()
|
||||
// BIT CLUMSY:
|
||||
MSISENSOR_MSI ( input.concat(scan.txt).collect() )
|
||||
}
|
14
tests/software/msisensor/msi/test.yml
Normal file
14
tests/software/msisensor/msi/test.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- name: msisensor msi
|
||||
command: nextflow run ./tests/software/msisensor/msi -entry test_msisensor_msi -c tests/config/nextflow.config
|
||||
tags:
|
||||
- msisensor
|
||||
- msisensor_msi
|
||||
files:
|
||||
- path: output/msisensor/test
|
||||
md5sum: a3290f7539dbbf83777e8590156c0e28
|
||||
- path: output/msisensor/test_dis
|
||||
md5sum: 060a3fc3701f3b10f6b19da9b21a32b7
|
||||
- path: output/msisensor/test_germline
|
||||
md5sum: d41d8cd98f00b204e9800998ecf8427e
|
||||
- path: output/msisensor/test_somatic
|
||||
md5sum: d41d8cd98f00b204e9800998ecf8427e
|
14
tests/software/msisensor/scan/main.nf
Normal file
14
tests/software/msisensor/scan/main.nf
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { MSISENSOR_SCAN } from '../../../../software/msisensor/scan/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_msisensor_scan {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]
|
||||
|
||||
MSISENSOR_SCAN ( input )
|
||||
}
|
8
tests/software/msisensor/scan/test.yml
Normal file
8
tests/software/msisensor/scan/test.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: msisensor scan
|
||||
command: nextflow run ./tests/software/msisensor/scan -entry test_msisensor_scan -c tests/config/nextflow.config
|
||||
tags:
|
||||
- msisensor
|
||||
- msisensor_scan
|
||||
files:
|
||||
- path: output/msisensor/test.msisensor_scan.tab
|
||||
md5sum: b7ae85acdcfc1a51e867ab3446d6fb59
|
Loading…
Reference in a new issue