mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
added maxquant
This commit is contained in:
parent
e937c7950a
commit
d255e00f7a
3 changed files with 178 additions and 0 deletions
68
modules/maxquant/lfq/functions.nf
Normal file
68
modules/maxquant/lfq/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// 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_meta = args.publish_by_meta ?: []
|
||||
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_meta) {
|
||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||
for (key in key_list) {
|
||||
if (args.meta && key instanceof String) {
|
||||
def path = key
|
||||
if (args.meta.containsKey(key)) {
|
||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
||||
}
|
||||
path = path instanceof String ? path : ''
|
||||
path_list.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
63
modules/maxquant/lfq/main.nf
Normal file
63
modules/maxquant/lfq/main.nf
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters.
|
||||
// All other parameters MUST be provided as a string i.e. "options.args"
|
||||
// where "params.options" is a Groovy Map that MUST be provided via the addParams section of the including workflow.
|
||||
// Any parameters that need to be evaluated in the context of a particular sample
|
||||
// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately.
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process MAXQUANT_LFQ {
|
||||
tag "$meta.id"
|
||||
label 'process_long'
|
||||
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:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::maxquant=2.0.1.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/https://depot.galaxyproject.org/singularity/maxquant:2.0.1.0--py39hdfd78af_2"
|
||||
} else {
|
||||
container "quay.io/biocontainers/quay.io/biocontainers/maxquant:2.0.1.0--py39hdfd78af_2"
|
||||
}
|
||||
|
||||
input:
|
||||
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
|
||||
// MUST be provided as an input via a Groovy Map called "meta".
|
||||
// This information may not be required in some instances e.g. indexing reference genome files:
|
||||
// https://github.com/nf-core/modules/blob/master/software/bwa/index/main.nf
|
||||
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
|
||||
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
|
||||
tuple val(meta), path(raw), path(paramfile)
|
||||
|
||||
output:
|
||||
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
|
||||
tuple val(meta), path("combined/txt/*.txt"), emit: maxquant_txt
|
||||
// TODO nf-core: List additional required output channels/values here
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
|
||||
// If the software is unable to output a version number on the command-line then it can be manually specified
|
||||
// e.g. https://github.com/nf-core/modules/blob/master/software/homer/annotatepeaks/main.nf
|
||||
// TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "$options.args" variable
|
||||
// TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter
|
||||
// using the Nextflow "task" variable e.g. "--threads $task.cpus"
|
||||
// TODO nf-core: Please replace the example samtools command below with your module's command
|
||||
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
|
||||
"""
|
||||
maxquant --version > maxquant.version.txt
|
||||
# Write number of threads into parameter file
|
||||
sed "s_\<numThreads\>.*_\<numThreads\>12\<\/numThreads\>_" ${paramfile}
|
||||
# Correct folder names
|
||||
sed -i "s|PLACEHOLDER|\$PWD/|g" "${paramfile}"
|
||||
mkdir temp
|
||||
|
||||
maxquant ${paramfile}
|
||||
"""
|
||||
}
|
47
modules/maxquant/lfq/meta.yml
Normal file
47
modules/maxquant/lfq/meta.yml
Normal file
|
@ -0,0 +1,47 @@
|
|||
name: maxquant_lfq
|
||||
## TODO nf-core: Add a description of the module and list keywords
|
||||
description: write your description here
|
||||
keywords:
|
||||
- sort
|
||||
tools:
|
||||
- maxquant:
|
||||
## TODO nf-core: Add a description and other details for the software below
|
||||
description: MaxQuant is a quantitative proteomics software package designed for analyzing large mass-spectrometric data sets. License restricted.
|
||||
homepage: None
|
||||
documentation: None
|
||||
tool_dev_url: None
|
||||
doi: ""
|
||||
licence: ['http://www.coxdocs.org/lib/exe/fetch.php?media=license_agreement.pdf']
|
||||
|
||||
## TODO nf-core: Add a description of all of the variables used as input
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
## TODO nf-core: Delete / customise this example input
|
||||
- parfile:
|
||||
type: file
|
||||
description: MaxQuant parameter file (XML)
|
||||
pattern: "*.{xml}"
|
||||
|
||||
## TODO nf-core: Add a description of all of the variables used as output
|
||||
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}"
|
||||
## TODO nf-core: Delete / customise this example output
|
||||
- maxquant_txt:
|
||||
type: file
|
||||
description: tables with peptides and protein information
|
||||
pattern: "*.{txt}"
|
||||
|
||||
authors:
|
||||
- "@veitveit"
|
Loading…
Reference in a new issue