Skip to content

Commit

Permalink
Add PSMRescoring、PSMFDRControl、Phosphoscoring、ProteinInference、Featur…
Browse files Browse the repository at this point in the history
…emapper 、ProteinQuant subworkflow
  • Loading branch information
daichengxin committed Nov 15, 2021
1 parent 018c34d commit 1d8971e
Show file tree
Hide file tree
Showing 56 changed files with 919 additions and 248 deletions.
67 changes: 67 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,82 @@ params {
modules {
'sdrfparsing' {
args = 'convert-openms -t2 -l'
publish_files = ['log': 'logs']
}
'decoydatabase' {
args = ''
publish_files = ['log': 'logs']
}
'multiqc' {
args = ''
}
'thermorawfileparser' {
args = ''
publish_dir = ""
publish_files = ['log': 'logs']
}
'openmspeakpicker' {
args = ''
}
'isobaricanalyzer' {
args = ''
publish_files = ['log': 'logs']
}
'searchenginemsgf' {
args = ''
publish_files = ['log': 'logs']
}
'searchenginecomet' {
args = ''
publish_files = ['log': 'logs']
}
'indexpeptides' {
args = ''
publish_files = ['log': 'logs']
}
'extractpsmfeature' {
args = ''
publish_files = ['log': 'logs']
}
'percolator' {
args = ''
}
'falsediscoveryrate' {
args = ''
}
'idpep' {
args = ''
}
'idscoreswitcher' {
args = '-new_score_orientation lower_better'
}
'consensusid' {
args = ''
}
'idfilter' {
args = ''
suffix = '.idXML'
}
'luciphoradapter' {
args = ''
}
'idmapper' {
args = ''
}
'filemerge' {
args = ''
}
'epifany' {
args = ''
}
'proteininference' {
args = ''
}
'idconflictresolver' {
args = ''
}
'proteinquantifier' {
args = ''
}
}
}
2 changes: 1 addition & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ params {
// Input data
input = 'https://raw.githubusercontent.com/daichengxin/quantms/dev/assets/PXD000001.sdrf.tsv'

quant_method = 'TMT'
quant_method = 'ISO'
database = 'https://raw.githubusercontent.com/daichengxin/proteomicstmt/dev/tmt_testdata/erwinia_carotovora.fasta'
posterior_probabilities = "percolator"
search_engines = "msgf"
Expand Down
2 changes: 1 addition & 1 deletion conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ params {
// Input data for full size test
input = 'https://raw.githubusercontent.com/daichengxin/quantms/dev/assets/PXD000001.sdrf.tsv'

quant_method = 'TMT'
quant_method = 'ISO'
database = 'https://raw.githubusercontent.com/daichengxin/proteomicstmt/dev/tmt_testdata/erwinia_carotovora.fasta'
posterior_probabilities = "percolator"
search_engines = "comet,msgf"
Expand Down
4 changes: 2 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WorkflowMain.initialise(workflow, params, log)
========================================================================================
*/

if (params.quant_method == 'TMT') {
if (params.quant_method == 'ISO') {
include { TMT } from './workflows/tmt'
} else if (params.quant_method == 'LFQ') {
include { LFQ } from './workflows/lfq'
Expand All @@ -37,7 +37,7 @@ if (params.quant_method == 'TMT') {
//

workflow NFCORE_QUANTMS {
if (params.quant_method == 'TMT') {
if (params.quant_method == 'ISO') {
TMT()
} else if (params.quant_method == 'LFQ') {
LFQ()
Expand Down
File renamed without changes.
47 changes: 47 additions & 0 deletions modules/local/openms/consensusid/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'

params.options = [:]
options = initOptions(params.options)

process CONSENSUSID {
label 'process_medium'
// TODO could be easily parallelized
label 'process_single_thread'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "openms::openms=2.7.0pre" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/openms:2.6.0--h4afb90d_0"
} else {
container "quay.io/biocontainers/openms:2.6.0--h4afb90d_0"
}

input:
tuple val(meta), path(id_file)

output:
tuple val(meta), path("${meta.id}_consensus.idXML"), emit: consensusids
path "*.version.txt", emit: version
path "*.log", emit: log
script:
def software = getSoftwareName(task.process)

"""
ConsensusID \\
-in ${id_file} \\
-out ${meta.id}_consensus.idXML \\
-per_spectrum \\
-threads $task.cpus \\
-algorithm $params.consensusid_algorithm \\
-filter:min_support $params.min_consensus_support \\
-filter:considered_hits $params.consensusid_considered_top_hits \\
-debug 100 \\
$options.args \\
> ${meta.id}_consensusID.log
echo \$(ConsensusID 2>&1) > ${software}.version.txt
"""
}
38 changes: 38 additions & 0 deletions modules/local/openms/consensusid/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: consensusid
description: Computes a consensus from results of multiple peptide identification engines.
keywords:
- FDR
- decoy
- OpenMS
tools:
- ConsensusID :
description: |
Tool to Computes a consensus from results of multiple peptide identification engines.
homepage: https://abibuilder.informatik.uni-tuebingen.de/archive/openms/Documentation/nightly/html/TOPP_ConsensusID.html
documentation: https://abibuilder.informatik.uni-tuebingen.de/archive/openms/Documentation/nightly/html/TOPP_ConsensusID.html
input:
- meta:
type: map
description: Groovy Map containing sample information
- id_file:
type: file
description: |
Identifications from searching a target-decoy database.
output:
- meta:
type: map
description: Groovy Map containing sample information
- id_files_idx_ForIDPEP_FDR:
type: file
description: |
Identifications with annotated FDR.
- log:
type: file
description: log file
pattern: "*.log"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@daichengxin"
16 changes: 7 additions & 9 deletions modules/local/openms/epifany/functions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ def getSoftwareName(task_process) {
//
def initOptions(Map args) {
def Map options = [:]
options.top_PSMs = args.top_PSMs ?: 1
options.greedy_group_resolution = args.greedy_group_resolution ?: 'none'
options.update_PSM_probabilities = args.update_PSM_probabilities ?: 'true'
options.keep_best_PSM_only = args.keep_best_PSM_only ?: 'true'
options.epi_debug = args.epi_debug ?: 100
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
options.args = args.args ?: ''
options.args1 = args.args1 ?: ''
options.args2 = args.args2 ?: ''
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
}

Expand Down
16 changes: 8 additions & 8 deletions modules/local/openms/epifany/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ process EPIFANY {
}

input:
path consus_file
tuple val(meta), path(consus_file)

output:
path "${consus_file.baseName}_epi.consensusXML", emit: epi_inference
tuple val(meta), path("${consus_file.baseName}_epi.consensusXML"), emit: epi_inference
path "*.version.txt", emit: version
path "*.log", emit: log

Expand All @@ -33,14 +33,14 @@ process EPIFANY {
-in ${consus_file} \\
-protein_fdr true \\
-threads $task.cpus \\
-debug $options.epi_debug \\
-algorithm:keep_best_PSM_only $options.keep_best_PSM_only \\
-algorithm:update_PSM_probabilities $options.update_PSM_probabilities \\
-greedy_group_resolution $options.greedy_group_resolution \\
-algorithm:top_PSMs $options.top_PSMs \\
-debug 100 \\
-algorithm:keep_best_PSM_only $params.keep_best_PSM_only \\
-algorithm:update_PSM_probabilities $params.update_PSM_probabilities \\
-greedy_group_resolution $params.greedy_group_resolution \\
-algorithm:top_PSMs $params.top_PSMs \\
-out ${consus_file.baseName}_epi.consensusXML \\
> ${consus_file.baseName}_inference.log
echo \$(Epifany --version 2>&1) > ${software}.version.txt
echo \$(Epifany 2>&1) > ${software}.version.txt
"""
}
7 changes: 4 additions & 3 deletions modules/local/openms/extractpsmfeature/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ process EXTRACTPSMFEATURE {
}

input:
tuple mzml_id, path id_file
tuple val(meta), path(id_file)

output:
tuple mzml_id, path "${id_file.baseName}_feat.idXML", emit: id_files_idx_feat
tuple val(meta), path("${id_file.baseName}_feat.idXML"), emit: id_files_idx_feat
path "*.version.txt", emit: version
path "*.log", emit: log

Expand All @@ -34,8 +34,9 @@ process EXTRACTPSMFEATURE {
-in ${id_file} \\
-out ${id_file.baseName}_feat.idXML \\
-threads $task.cpus \\
$options.args \\
> ${id_file.baseName}_extract_psm_feature.log
echo \$(PSMFeatureExtractor --version 2>&1) > ${software}.version.txt
echo \$(PSMFeatureExtractor 2>&1) > ${software}.version.txt
"""
}
12 changes: 6 additions & 6 deletions modules/local/openms/extractpsmfeature/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ tools:
homepage: https://abibuilder.informatik.uni-tuebingen.de/archive/openms/Documentation/nightly/html/UTILS_PSMFeatureExtractor.html
documentation: https://abibuilder.informatik.uni-tuebingen.de/archive/openms/Documentation/nightly/html/UTILS_PSMFeatureExtractor.html
input:
- mzml_id:
type: value
description: MD5
- meta:
type: map
description: Groovy Map containing sample information
- id_file:
type: file
description: |
Input idXML file containing the identifications.
output:
- mzml_id:
type: value
description: MD5
- meta:
type: map
description: Groovy Map containing sample information
- id_files_idx_feat:
type: file
description: |
Expand Down
68 changes: 68 additions & 0 deletions modules/local/openms/falsediscoveryrate/functions.nf
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Loading

0 comments on commit 1d8971e

Please sign in to comment.