Skip to content

Commit

Permalink
Merge pull request nf-core#12 from TalusBio/bb_feature/skip_prelim
Browse files Browse the repository at this point in the history
Bb feature/skip prelim
  • Loading branch information
daichengxin committed Jan 10, 2024
2 parents e80ba58 + 639e507 commit 3c80318
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ debug_dir
test_out

lint_log.txt
node_modules
2 changes: 2 additions & 0 deletions modules/local/diann_preliminary_analysis/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ process DIANN_PRELIMINARY_ANALYSIS {
# Precursor Tolerance unit was: ${meta['precursormasstoleranceunit']}
# Fragment Tolerance unit was: ${meta['fragmentmasstoleranceunit']}
# Final mas accuracy is '${mass_acc}'
diann --lib ${predict_library} \\
--f ${ms_file} \\
--threads ${task.cpus} \\
Expand Down
4 changes: 4 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ params {
species_genes = false
diann_normalize = true
diann_speclib = null

/// DIA-NN: Extras
skip_preliminary_analysis = false
empirical_assembly_log = null

// MSstats general options
msstats_remove_one_feat_prot = true
Expand Down
14 changes: 14 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,20 @@
"help_text": "If passed, will use that spectral library to carry out the DIA-NN search, instead of predicting one from the fasta file.",
"hidden": false
},
"skip_preliminary_analysis": {
"type": "boolean",
"description": "Skip the preliminary analysis step, thus use the passed spectral library as-is insted of generating a local concensus library.",
"fa_icon": "fas fa-forward",
"default": false,
"hidden": false
},
"empirical_assembly_log": {
"type": "string",
"description": "The log file for the empirical assembly, Only used if `--skip_preliminary_analysis` is set to `true` and `--diann_speclib` is passed. If passed, will use that log file to carry out the DIA-NN search, instead of running a preliminary search.",
"fa_icon": "fas fa-file",
"help_text": "If passed, will use that log file to carry out the DIA-NN search, instead of predicting one from the fasta file.",
"hidden": false
},
"diann_debug": {
"type": "integer",
"description": "Debug level",
Expand Down
86 changes: 56 additions & 30 deletions workflows/dia.nf
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ workflow DIA {
result ->
meta: preprocessed_meta(result[0])
ms_file:result[1]
}
}
.set { ch_result }

meta = ch_result.meta.unique { it[0] }

DIANNCFG(meta)
ch_software_versions = ch_software_versions.mix(DIANNCFG.out.version.ifEmpty(null))
ch_software_versions = ch_software_versions
.mix(DIANNCFG.out.version.ifEmpty(null))

//
// MODULE: SILICOLIBRARYGENERATION
Expand All @@ -62,34 +63,48 @@ workflow DIA {
speclib = SILICOLIBRARYGENERATION.out.predict_speclib
}

//
// MODULE: DIANN_PRELIMINARY_ANALYSIS
//
DIANN_PRELIMINARY_ANALYSIS(ch_file_preparation_results.combine(speclib))
ch_software_versions = ch_software_versions.mix(DIANN_PRELIMINARY_ANALYSIS.out.version.ifEmpty(null))
if (params.skip_preliminary_analysis) {
assembly_log = Channel.fromPath(params.empirical_assembly_log)
empirical_library = Channel.fromPath(params.diann_speclib)
indiv_fin_analysis_in = ch_file_preparation_results.combine(ch_searchdb)
.combine(assembly_log)
.combine(empirical_library)

//
// MODULE: ASSEMBLE_EMPIRICAL_LIBRARY
//
// Order matters in DIANN, This shoudl be sorted for reproducible results.
ASSEMBLE_EMPIRICAL_LIBRARY(
ch_result.ms_file.collect(),
meta,
DIANN_PRELIMINARY_ANALYSIS.out.diann_quant.collect(),
speclib
)
ch_software_versions = ch_software_versions.mix(ASSEMBLE_EMPIRICAL_LIBRARY.out.version.ifEmpty(null))
empirical_lib = empirical_library
} else {
//
// MODULE: DIANN_PRELIMINARY_ANALYSIS
//
DIANN_PRELIMINARY_ANALYSIS(ch_file_preparation_results.combine(speclib))
ch_software_versions = ch_software_versions
.mix(DIANN_PRELIMINARY_ANALYSIS.out.version.ifEmpty(null))

//
// MODULE: ASSEMBLE_EMPIRICAL_LIBRARY
//
// Order matters in DIANN, This shoudl be sorted for reproducible results.
ASSEMBLE_EMPIRICAL_LIBRARY(
ch_result.ms_file.collect(),
meta,
DIANN_PRELIMINARY_ANALYSIS.out.diann_quant.collect(),
speclib
)
ch_software_versions = ch_software_versions
.mix(ASSEMBLE_EMPIRICAL_LIBRARY.out.version.ifEmpty(null))
indiv_fin_analysis_in = ch_file_preparation_results
.combine(ch_searchdb)
.combine(ASSEMBLE_EMPIRICAL_LIBRARY.out.log)
.combine(ASSEMBLE_EMPIRICAL_LIBRARY.out.empirical_library)

empirical_lib = ASSEMBLE_EMPIRICAL_LIBRARY.out.empirical_library
}

//
// MODULE: INDIVIDUAL_FINAL_ANALYSIS
//
INDIVIDUAL_FINAL_ANALYSIS(
ch_file_preparation_results
.combine(ch_searchdb)
.combine(ASSEMBLE_EMPIRICAL_LIBRARY.out.log)
.combine(ASSEMBLE_EMPIRICAL_LIBRARY.out.empirical_library)
)
ch_software_versions = ch_software_versions.mix(INDIVIDUAL_FINAL_ANALYSIS.out.version.ifEmpty(null))
INDIVIDUAL_FINAL_ANALYSIS(indiv_fin_analysis_in)
ch_software_versions = ch_software_versions
.mix(INDIVIDUAL_FINAL_ANALYSIS.out.version.ifEmpty(null))

//
// MODULE: DIANNSUMMARY
Expand All @@ -103,9 +118,17 @@ workflow DIA {
.ms_file.map { msfile -> file(msfile).getName() }
.collect()
.set { ms_file_names }
DIANNSUMMARY(ms_file_names, meta, ASSEMBLE_EMPIRICAL_LIBRARY.out.empirical_library,
INDIVIDUAL_FINAL_ANALYSIS.out.diann_quant.collect(), ch_searchdb)
ch_software_versions = ch_software_versions.mix(DIANNSUMMARY.out.version.ifEmpty(null))

DIANNSUMMARY(
ms_file_names,
meta,
empirical_lib,
INDIVIDUAL_FINAL_ANALYSIS.out.diann_quant.collect(),
ch_searchdb)

ch_software_versions = ch_software_versions.mix(
DIANNSUMMARY.out.version.ifEmpty(null)
)

//
// MODULE: DIANNCONVERT
Expand All @@ -118,15 +141,18 @@ workflow DIA {
ch_searchdb,
DIANNSUMMARY.out.version
)
ch_software_versions = ch_software_versions.mix(DIANNCONVERT.out.version.ifEmpty(null))
ch_software_versions = ch_software_versions
.mix(DIANNCONVERT.out.version.ifEmpty(null))

//
// MODULE: MSSTATS
ch_msstats_out = Channel.empty()
if (!params.skip_post_msstats) {
MSSTATS(DIANNCONVERT.out.out_msstats)
ch_msstats_out = MSSTATS.out.msstats_csv
ch_software_versions = ch_software_versions.mix(MSSTATS.out.version.ifEmpty(null))
ch_software_versions = ch_software_versions.mix(
MSSTATS.out.version.ifEmpty(null)
)
}

emit:
Expand Down

0 comments on commit 3c80318

Please sign in to comment.