diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index 292328b0..2b235fd0 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -15,3 +15,7 @@ export_plots: true custom_logo: "./nf-core-quantms_logo_light.png" custom_logo_url: "https://github.com/bigbio/quantms" custom_logo_title: "quantms" + +sp: + quantms/exp_design: + fn: "*_design.tsv" diff --git a/bin/msstats_tmt.R b/bin/msstats_tmt.R index 08e80114..0ac644d8 100755 --- a/bin/msstats_tmt.R +++ b/bin/msstats_tmt.R @@ -210,6 +210,11 @@ if(typeof(reference_norm) == 'character'){ reference_norm <- char_to_boolean[reference_norm] } +if (length(args)<12) { + # outputPrefix + args[12] <- './msstatsiso' +} + csv_input <- args[1] contrast_str <- args[2] control_str <- args[3] @@ -241,5 +246,5 @@ if (l == 1) { test.MSstatsTMT <- groupComparisonTMT(contrast.matrix=contrast_mat, data=processed.quant) #TODO allow manual input (e.g. proteins of interest) - write.table(test.MSstatsTMT$ComparisonResult, file=paste0("msstatsiso_results.csv"), quote=FALSE, sep='\t', row.names = FALSE) + write.table(test.MSstatsTMT$ComparisonResult, file=paste0(args[12],"_comparisons.csv"), quote=FALSE, sep='\t', row.names = FALSE) } diff --git a/modules/local/msstats/main.nf b/modules/local/msstats/main.nf index 905012ce..b1c587bf 100644 --- a/modules/local/msstats/main.nf +++ b/modules/local/msstats/main.nf @@ -1,4 +1,5 @@ process MSSTATS { + tag "$msstats_csv_input.Name" label 'process_medium' conda (params.enable_conda ? "bioconda::bioconductor-msstats=4.2.0" : null) @@ -9,7 +10,7 @@ process MSSTATS { } input: - path out_msstats + path msstats_csv_input output: // The generation of the PDFs from MSstats are very unstable, especially with auto-contrasts. @@ -25,13 +26,14 @@ process MSSTATS { """ msstats_plfq.R \\ - ${out_msstats} \\ + ${msstats_csv_input} \\ ${params.contrasts} \\ "${ref_con}" \\ ${params.msstats_remove_one_feat_prot} \\ ${params.msstatslfq_removeFewMeasurements} \\ ${params.msstatslfq_feature_subset_protein} \\ ${params.msstatslfq_quant_summary_method} \\ + ${msstats_csv_input.baseName} \\ $args \\ > msstats.log \\ || echo "Optional MSstats step failed. Please check logs and re-run or do a manual statistical analysis." diff --git a/modules/local/msstatstmt/main.nf b/modules/local/msstatstmt/main.nf index 5b0d3229..c7e28014 100644 --- a/modules/local/msstatstmt/main.nf +++ b/modules/local/msstatstmt/main.nf @@ -1,4 +1,5 @@ process MSSTATSTMT { + tag "$msstatstmt_csv_input.Name" label 'process_medium' conda (params.enable_conda ? "bioconda::bioconductor-msstatstmt=2.2.0" : null) @@ -9,7 +10,7 @@ process MSSTATSTMT { } input: - path out_msstats_tmt + path msstatstmt_csv_input output: // The generation of the PDFs from MSstatsTMT are very unstable, especially with auto-contrasts. @@ -25,7 +26,7 @@ process MSSTATSTMT { """ msstats_tmt.R \\ - ${out_msstats_tmt} \\ + ${msstatstmt_csv_input} \\ ${params.contrasts} \\ "${ref_con}" \\ ${params.msstats_remove_one_feat_prot} \\ @@ -36,6 +37,7 @@ process MSSTATSTMT { ${params.msstatsiso_global_norm} \\ ${params.msstatsiso_remove_norm_channel} \\ ${params.msstatsiso_reference_normalization} \\ + ${msstatstmt_csv_input.baseName} \\ $args \\ > msstats_tmt.log \\ || echo "Optional MSstatsTMT step failed. Please check logs and re-run or do a manual statistical analysis." diff --git a/modules/local/openms/consensusid/main.nf b/modules/local/openms/consensusid/main.nf index 02c64fa6..0b0a63ba 100644 --- a/modules/local/openms/consensusid/main.nf +++ b/modules/local/openms/consensusid/main.nf @@ -1,4 +1,5 @@ process CONSENSUSID { + tag "$meta.id" label 'process_medium' // TODO could be easily parallelized label 'process_single_thread' diff --git a/modules/local/openms/extractpsmfeatures/main.nf b/modules/local/openms/extractpsmfeatures/main.nf index 3cc6e36b..76c272cc 100644 --- a/modules/local/openms/extractpsmfeatures/main.nf +++ b/modules/local/openms/extractpsmfeatures/main.nf @@ -1,4 +1,5 @@ process EXTRACTPSMFEATURES { + tag "$meta.id" label 'process_very_low' label 'process_single_thread' label 'openms' diff --git a/modules/local/openms/falsediscoveryrate/main.nf b/modules/local/openms/falsediscoveryrate/main.nf index 1978db9c..febd4f61 100644 --- a/modules/local/openms/falsediscoveryrate/main.nf +++ b/modules/local/openms/falsediscoveryrate/main.nf @@ -1,4 +1,5 @@ process FALSEDISCOVERYRATE { + tag "$meta.id" label 'process_low' label 'process_single_thread' label 'openms' diff --git a/modules/local/openms/idfilter/main.nf b/modules/local/openms/idfilter/main.nf index fa99d36d..aa194674 100644 --- a/modules/local/openms/idfilter/main.nf +++ b/modules/local/openms/idfilter/main.nf @@ -1,5 +1,5 @@ process IDFILTER { - + tag {task.ext.suffix == ".idXML" ? "$meta.id" : "$id_file.baseName"} label 'process_very_low' label 'process_single_thread' label 'openms' diff --git a/modules/local/openms/idpep/main.nf b/modules/local/openms/idpep/main.nf index f4ef1cb6..6f08db23 100644 --- a/modules/local/openms/idpep/main.nf +++ b/modules/local/openms/idpep/main.nf @@ -1,4 +1,5 @@ process IDPEP { + tag "$meta.id" label 'process_very_low' conda (params.enable_conda ? "bioconda::openms=2.8.0" : null) diff --git a/modules/local/openms/indexpeptides/main.nf b/modules/local/openms/indexpeptides/main.nf index 3780d068..e316612a 100644 --- a/modules/local/openms/indexpeptides/main.nf +++ b/modules/local/openms/indexpeptides/main.nf @@ -1,4 +1,5 @@ process INDEXPEPTIDES { + tag "$meta.id" label 'process_low' conda (params.enable_conda ? "bioconda::openms=2.8.0" : null) diff --git a/modules/local/openms/msstatsconverter/main.nf b/modules/local/openms/msstatsconverter/main.nf index 6748dced..5974338e 100644 --- a/modules/local/openms/msstatsconverter/main.nf +++ b/modules/local/openms/msstatsconverter/main.nf @@ -1,4 +1,5 @@ process MSSTATSCONVERTER { + tag "$exp_file.Name" label 'process_low' conda (params.enable_conda ? "bioconda::openms=2.8.0" : null) @@ -24,7 +25,7 @@ process MSSTATSCONVERTER { -in ${consensusXML} \\ -in_design ${exp_file} \\ -method ${quant_method} \\ - -out out_msstats.csv \\ + -out ${exp_file.baseName}_out_msstats.csv \\ $args \\ |& tee MSstatsConverter.log diff --git a/modules/local/openms/proteomicslfq/main.nf b/modules/local/openms/proteomicslfq/main.nf index e21f6091..28b61291 100644 --- a/modules/local/openms/proteomicslfq/main.nf +++ b/modules/local/openms/proteomicslfq/main.nf @@ -1,4 +1,5 @@ process PROTEOMICSLFQ { + tag "${expdes.baseName - ~/_design$/}" label 'process_high' conda (params.enable_conda ? "bioconda::openms=2.8.0" : null) @@ -13,10 +14,10 @@ process PROTEOMICSLFQ { path(fasta) output: - path "out.mzTab", emit: out_mztab - path "out.consensusXML", emit: out_consensusXML - path "out_msstats.csv", emit: out_msstats optional true - path "out_triqler.tsv", emit: out_triqler optional true + path "${expdes.baseName - ~/_design$/}.mzTab", emit: out_mztab + path "${expdes.baseName - ~/_design$/}.consensusXML", emit: out_consensusXML + path "*out_msstats.csv", emit: out_msstats optional true + path "*out_triqler.tsv", emit: out_triqler optional true path "debug_mergedIDs.idXML", emit: debug_mergedIDs optional true path "debug_mergedIDs_inference.idXML", emit: debug_mergedIDs_inference optional true path "debug_mergedIDsGreedyResolved.idXML", emit: debug_mergedIDsGreedyResolved optional true @@ -28,8 +29,8 @@ process PROTEOMICSLFQ { script: def args = task.ext.args ?: '' - def msstats_present = params.quantification_method == "feature_intensity" ? '-out_msstats out_msstats.csv' : '' - def triqler_present = (params.quantification_method == "feature_intensity") && (params.add_triqler_output) ? '-out_triqler out_triqler.tsv' : '' + def msstats_present = params.quantification_method == "feature_intensity" ? "-out_msstats ${expdes.baseName - ~/_design$/}_msstats_in.csv" : "" + def triqler_present = (params.quantification_method == "feature_intensity") && (params.add_triqler_output) ? "-out_triqler ${expdes.baseName - ~/_design$/}_triqler_in.tsv" : "" def decoys_present = (params.quantify_decoys || ((params.quantification_method == "feature_intensity") && params.add_triqler_output)) ? '-PeptideQuantification:quantify_decoys' : '' """ @@ -46,12 +47,12 @@ process PROTEOMICSLFQ { -protein_quantification ${params.protein_quant} \\ -alignment_order ${params.alignment_order} \\ -picked_proteinFDR true \\ - -out out.mzTab \\ + -out ${expdes.baseName - ~/_design$/}.mzTab \\ -threads ${task.cpus} \\ ${msstats_present} \\ ${triqler_present} \\ ${decoys_present} \\ - -out_cxml out.consensusXML \\ + -out_cxml ${expdes.baseName - ~/_design$/}.consensusXML \\ -proteinFDR ${params.protein_level_fdr_cutoff} \\ $args \\ |& tee proteomicslfq.log diff --git a/modules/local/openms/thirdparty/percolator/main.nf b/modules/local/openms/thirdparty/percolator/main.nf index 4417c4eb..6c85b1f0 100644 --- a/modules/local/openms/thirdparty/percolator/main.nf +++ b/modules/local/openms/thirdparty/percolator/main.nf @@ -1,4 +1,5 @@ process PERCOLATOR { + tag "$meta.id" label 'process_medium' conda (params.enable_conda ? "bioconda::openms-thirdparty=2.8.0" : null) diff --git a/modules/local/pmultiqc/main.nf b/modules/local/pmultiqc/main.nf index e072bef5..8773db6b 100644 --- a/modules/local/pmultiqc/main.nf +++ b/modules/local/pmultiqc/main.nf @@ -14,14 +14,14 @@ process PMULTIQC { output: path "*.html", emit: ch_pmultiqc_report - path "*.db", optional:true, emit: ch_pmultiqc_db + path "*.db", optional: true, emit: ch_pmultiqc_db path "versions.yml", emit: versions path "*_data", emit: data - path "*_plots", optional:true, emit: plots + path "*_plots", optional: true, emit: plots script: def args = task.ext.args ?: '' - def disable_pmultqic = params.enable_pmultiqc ? "": "--disable_plugin" + def disable_pmultqic = params.enable_pmultiqc ? "" : "--disable_plugin" """ multiqc \\ diff --git a/modules/local/preprocess_expdesign.nf b/modules/local/preprocess_expdesign.nf index 779fcf41..5f3cbef7 100644 --- a/modules/local/preprocess_expdesign.nf +++ b/modules/local/preprocess_expdesign.nf @@ -5,6 +5,7 @@ process PREPROCESS_EXPDESIGN { label 'process_very_low' label 'process_single_thread' + tag "$design.Name" container "frolvlad/alpine-bash" @@ -12,17 +13,17 @@ process PREPROCESS_EXPDESIGN { path design output: - path "experimental_design.tsv", emit: ch_expdesign - path "config.tsv", emit: ch_config + path "${design.baseName}_design.tsv", emit: ch_expdesign + path "${design.baseName}_config.tsv", emit: ch_config script: """ # since we know that we will need to convert from raw to mzML for all tools that need the design (i.e., OpenMS tools) # we edit the design here and change the endings. - sed 's/.raw\\t/.mzML\\t/I' $design > experimental_design.tsv + sed 's/.raw\\t/.mzML\\t/I' ${design} > ${design.baseName}_design.tsv # here we extract the filenames and fake an empty config (since the config values will be deduced from the workflow params) - a=\$(grep -n '^\$' $design | head -n1| awk -F":" '{print \$1}'); sed -e ''"\${a}"',\$d' $design > config.tsv + a=\$(grep -n '^\$' ${design} | head -n1| awk -F":" '{print \$1}'); sed -e ''"\${a}"',\$d' ${design} > ${design.baseName}_config.tsv """ } diff --git a/modules/local/sdrfparsing/main.nf b/modules/local/sdrfparsing/main.nf index 7941b2e9..d63a5e05 100644 --- a/modules/local/sdrfparsing/main.nf +++ b/modules/local/sdrfparsing/main.nf @@ -1,4 +1,5 @@ process SDRFPARSING { + tag "$sdrf.Name" label 'process_low' conda (params.enable_conda ? "conda-forge::pandas_schema bioconda::sdrf-pipelines=0.0.21" : null) @@ -10,9 +11,9 @@ process SDRFPARSING { path sdrf output: - path "experimental_design.tsv", optional:true, emit: ch_expdesign - path "openms.tsv", optional:true, emit: ch_sdrf_config_file - path "*.xml", optional:true, emit: mqpar + path "${sdrf.baseName}_design.tsv", optional: true, emit: ch_expdesign + path "${sdrf.baseName}_config.tsv", optional: true, emit: ch_sdrf_config_file + path "*.xml", optional: true, emit: mqpar path "*.log", emit: log path "versions.yml", emit: version @@ -24,7 +25,9 @@ process SDRFPARSING { ## -l for legacy behavior to always add sample columns ## TODO Update the sdrf-pipelines to dynamic print versions - parse_sdrf convert-openms -t2 -l -s ${sdrf} |& tee sdrf_parsing.log + parse_sdrf convert-openms -t2 -l -s ${sdrf} |& tee ${sdrf.baseName}_parsing.log + mv openms.tsv ${sdrf.baseName}_config.tsv + mv experimental_design.tsv ${sdrf.baseName}_design.tsv cat <<-END_VERSIONS > versions.yml "${task.process}":