Repository navigation
Description
Description of feature
Dear @daichengxin @vdemichev @jpfeuffer:
I have started testing the DIANN pipeline in quantms. The main problem I found is that still the pipeline is really slow. However, after talking to @vdemichev some other issues should be solved. First two ideas about what do we want to solve between DIANN and quantms:
quantms + diann should be able to:
- reanalyze DIA-based data in PRIDE Archive annotated in SDRFs and Uniprot FASTA files.
- export the results into standard file formats including mzTab + mzML (still pending issue here mzTab for DIA-NN #119 that we will continue discussing)
- use the capabilities of quantms to run DIANN distributed and cloud as much as possible.
The current pipeline/parallelization does the following :
- Generate the "generic config files" for the analysis including the PTMs, Enzyme rules, etc. For that, we use the following command in one node:
prepare_diann_parameters.py generate \
--enzyme "Trypsin" \
--fix_mod "" \
--var_mod "Oxidation (M),Carbamidomethyl (C)" \
--precursor_tolerence 10 \
--precursor_tolerence_unit ppm \
--fragment_tolerence 0.05 \
--fragment_tolerence_unit Da \
> GENERATE_DIANN_CFG.log
This actually generates a file (diann_config.cfg) like containing the following information:
--dir ./mzMLs --cut K*,R*,!*P --var-mod Oxidation,15.994915,M --var-mod Carbamidomethyl,57.021464,C --mass-acc 10 --mass-acc-ms1 20 --matrices --report-lib-info
-
Each raw file in the SDRF is converted to mzML; or the mzML that was converted outside the pipeline (ABSiex case) is used for the analysis.
-
For each mzML, we generate in parallel the corresponding theoretical spectral library using the following command:
diann `cat library_config.cfg` \
--fasta Homo-sapiens-uniprot-reviewed-isoforms-contaminants-decoy-202105.fasta \
--fasta-search \
--f 20181116_QEHFX3_BP_RSLCcap_hHeart_DIA_58.mzML \
--out-lib 20181116_QEHFX3_BP_RSLCcap_hHeart_DIA_58_lib.tsv \
--min-pr-mz 350 \
--max-pr-mz 1650 \
\
\
--missed-cleavages 2 \
--min-pep-len 6 \
--max-pep-len 40 \
--min-pr-charge 2 \
--max-pr-charge 4 \
--var-mods 3 \
--threads 25 \
--predictor \
--verbose 3 \
> diann.log
Note: This step is extremely slow. In addition, @vdemichev as commented me that generating a spectral library by raw file will give you wrong results in the next step (step 4) when searching all the data together and perform the quantification (q-value wrong).
- The quantification step the pipeline uses all the mzMLs and libraries generated in the individual steps to perform the quantification and statistical assessment:
diann `cat diann_config.cfg` \
--lib N294-1_lib.tsv--lib N294-2_lib.tsv--lib N295-1_lib.tsv--lib N295-2_lib.tsv--lib N296-1_lib.tsv--lib N299-1_lib.tsv--lib N296-2_lib.tsv--lib N299-2_lib.tsv \
--relaxed-prot-inf \
--fasta Homo-sapiens-uniprot-reviewed-isoforms-contaminants-decoy-202105.fasta \
\
\
\
\
--threads 25 \
--missed-cleavages 2 \
--min-pep-len 6 \
--max-pep-len 40 \
--min-pr-charge 2 \
--max-pr-charge 4 \
--var-mods 3 \
--matrix-spec-q 0.01 \
\
--reannotate \
\
--out diann_report.tsv \
--verbose 3 \
> diann.log
Discussing with @vdemichev about performance, he mentioned that this approach will give you wrong statistical results.
- can you suggest which changes can be done to parallelize DIANN?
- can you suggest which parameters can improve the performance of all the steps?
Lets discuss the ideas in this thread in details.
Activity
vdemichev commentedon Apr 28, 2022
Hi All, below are some thoughts how to structure the workflow.
Step 1. Generate an in silico predicted spectral library from a FASTA sequence database (in Uniprot format). This step does not require any raw files. The slowdown observed was because it was carried out for each raw file separately, whereas it should only be carried out once per FASTA.
For most DIA experiments, it's better to use the default DIA-NN settings: max 1 missed cleavage, peptide length range 7-30, no variable modifications. Anything else will lead to a slowdown and, potentially, slightly worse performance. Yes, if there's really huge amount of methionine oxidation, then including M(ox) as variable mod (and setting max var mods to some reasonable number, e.g. 1 or 2) might be ultimately beneficial, but I am yet to see a dataset where it would provide a significant advantage. Protein N-terminal acetylation is typically fine to include but it will also yield to a minor slowdown due to PTM scoring overhead.
Result: *.predicted.speclib file containing an in silico library.
Step 2. Preliminary analysis of individual raw files. Now, one could of course do everything automatically as part of MBR analysis, but, as I understand, the goal is to make things as parallelisable as possible, so let's discuss how to do this 'manually'. Thus, step 2 consists of analysing each run separately with the in silico library generated in step 1. The mass accuracies and the scan window settings in DIA-NN should be either fixed or left automatic. In the latter case, please use --individual-mass-acc and --individual-windows. If mass accuracies are automatic, please also supply the --quick-mass-acc command. Specify a folder with --temp where .quant files will be saved to.
Result: *.quant file for each raw file that contains IDs and quant info; log file.
Step 3. Assemble an empirical spectral library from the .quant files. For this all .quant files must be accessible for the given instance of DIA-NN. No access to the raw data is required, if DIA-NN is supplied with the --rt-profiling command, which I strongly recommend. This corresponds to "IDs, RT & IM profiling" mode of library generation, which I would recommend for this workflow. To execute this step, run DIA-NN with the --use-quant command, listing all raw files with --f though (but they don't need to be accessible, these file names are only used to infer .quant files file names). The location of .quant files can be specified with --temp, please see the docs. If the mass accuracies and the scan window settings in DIA-NN were automatic during Step 2, please use --individual-mass-acc and/or --individual-windows, respectively.
Result: *.tsv spectral library.
Step 4. Final analysis of individual raw files. Could now use the empirical spectral library to analyse all files in one go (much faster than the preliminary step), but let's consider again how to do things manually with analysis steps for each run being separate. As in step 2, need to process each run with the empirical spectral library. Now, mass accuracies & scan window must be fixed here. In case they were not fixed for Step 2, in the log file produced by the Step 3, there's a line like "Averaged recommended settings for this experiment: Mass accuracy = 11ppm, MS1 accuracy = 15ppm, Scan window = 7": need to extract the settings from this line and pass to DIA-NN during this search step. Specify a folder with --temp where .quant files will be saved to, make sure it's a different folder from the one used previously, so that old .quant files (preliminary analysis) are not overwritten. For best protein inference during the next step, need to specify a FASTA database during this step and also make sure protein inference is enabled.
Result: *.quant file for each raw file that contains IDs and quant info.
Step 5. Summarise the info. For this need the .tsv empirical spectral library, the FASTA database to annotate it and the newly created during step 4 .quant files. Run DIA-NN specifying the raw file names with --f (but they again don't need to be accessible, these file names are only used to infer .quant files file names) and with --use-quant, with --temp specifying the .quant files location. Here indicate --relaxed-prot-inf (for FragPipe-like protein inference) and --pg-level 2 (implicit grouping by gene names). --pg-level 0 is also OK (implicit grouping by sequence IDs). If using --pg-level 2 and having multiple species in the database, can add --species-genes (adds a suffix to gene names indicating the species - works provided the database is Uniprot-formatted).
Result: DIA-NN output files.
vdemichev commentedon Apr 28, 2022
Some notes:
ypriverol commentedon Apr 28, 2022
@daichengxin Lets start to implement this approach for the next release of the pipeline. I will add some lines here to clarify the pipeline steps:
Step 1 library generation from FASTA:
Default parameters:
--quick-mass-accunless the following parameters are provided:--mass-acc 10,--mass-acc-ms1 20@vdemichev in this original analysis we should remove some parameters related with inference, etc. because this is done in the last step 5.? Any other parameter related with quantitation, inference, etc. that will speed this step.
Nothing to be clarified here 👍
@vdemichev when we extract this from the log files "Averaged recommended settings for this experiment: Mass accuracy = 11ppm, MS1 accuracy = 15ppm, Scan window = 7" in Step 2, Then run each independent file against the "summarize" library with their corresponding settings extracted from the log?
Step 2
Nothing to clarify here 👍
vdemichev commentedon Apr 29, 2022
Indeed, protein inference only happens at Step 5. Quantification - at Steps 4 and 5. These algorithms however don't take any CPU time.
This log line will be displayed during Step 3 (sorry, I initially incorrectly wrote that it's Step 2; in fact it is Step 3, now also corrected it above) and will provide recommended averages, based on summarising the analysis carried out at Step 2. So these settings will be the same for all runs during Step 4.
daichengxin commentedon May 1, 2022
max miss cleavagesmin peptide lengthmax peptide lengthmax_mods. These parameters are shared withmsgfandcomet, Do I need to modify the default values in nextflow.config?The current modification parameters come directly from the SDRF file.
no variable modifications and variable modifications like M(ox) and N-term(ac) should be provided by SDRFmeaning I only keep these two as variable modifications and filter out other variable modifiers?ypriverol commentedon May 1, 2022
@daichengxin
max_modsin DIA analysis.ypriverol commentedon May 3, 2022
Sept 1 step finished in #169
jpfeuffer commentedon May 3, 2022
Also in regular closed search, I would not advise searching for more 2-3 max_mods right?
ypriverol commentedon May 3, 2022
The decision should actually be made between 2 and 3. For diann the default should be 2, but in DDA the most common used is 3 😏
jpfeuffer commentedon May 3, 2022
Ok but I think after generating the library only once, this might not be the bottleneck anymore.. let's see
31 remaining items
ypriverol commentedon May 19, 2022
Thanks @vdemichev for the feedback.
daichengxin commentedon May 20, 2022
Hi @vdemichev . This is the log for step 4 with fasta, Could you check again ?
report.log.txt
jpfeuffer commentedon May 20, 2022
With or without? It looks like he suggested without if I am not mistakenm
ypriverol commentedon May 20, 2022
@vdemichev How we combine the FDR parameters (q-value thresholds in each step). I guess we MUST pass the FDR threshold in the last step?.
For DDA data, we use the PSM and Protein FDR at the project level (meaning last step). We also filter FDR at
runlevel PSM FDR with 0.10% by ms_run to be more stringent.vdemichev commentedon May 20, 2022
@daichengxin Step 4 log seems good!
@ypriverol FDR thresholds during steps 2-4 should be set to 1%. During Step 5, can use any threshold. Filtering stricter than 1% might significantly reduce IDs - it's always better to analyse at 1%, and then the user can filter the output for their specific workflow. --matrix-spec-q and --matrix-qvalue affect matrices only, not the main report. I suggest not using these, as default settings for matrices seem the best for most datasets, and those users who want more stringent can filter the main report. But good to include matrices too, for those who don't use R/Python.
ypriverol commentedon May 21, 2022
@vdemichev correct me If I'm wrong:
--matrix-qvalue = 0.01), the user will be able to set different values in case they want to get more ids, but by default with be 0.01.--matrix-spec-q: we will pass this default value 1% (this is 0.01) to run protein filter, if the users wants to define their own value to get less highlight reliable data, they can relax this parameter. In reanalysis because we can't check in details each dataset, we may use this parameter as default 0.01 for high reliable results.--matrix-qvalue: Configurable also in the Step 5 for the user if they want to get more ids they may use a less stringent FDR let say 0.05.We will not use in any step the
--matrix-tr-qvalueor--matrix-ch-qvalue.Please correct me if I understand the parameter's combination well.
vdemichev commentedon May 21, 2022
Hi @ypriverol, matrix q-value setting only controls the q-value filtering of matrix output, nothing else. So of no relevance for Steps 1-4. For Steps 2-4, please only use --qvalue 0.01 (but 0.01 is the default value, so can also just omit this).
--matrix-spec-q: configures run-specific protein FDR for matrix output. Other software simply does not have this setting at all, filtering on run-specific protein FDR is questionable (many advise against it) and reduces data completeness. So for most applications it's better not to filter, and DIA-NN by default does not filter. Note that global protein FDR is always applied to matrices regardless of this setting.
--matrix-qvalue - again, better to keep 0.01 (default) for most applications. Whoever wants stricter filtering can always filter the main report manually. 0.05 is too relaxed for most applications. As matrices cannot be filtered further, better to stick to a reasonable value which is 0.01.
daichengxin commentedon May 21, 2022
Hi @vdemichev . Is it reasonable to manually filter the value of the column
Q.Valuein main report so that downstream analysis?vdemichev commentedon May 21, 2022
Yes, if the --qvalue was set to value higher than 0.01 (this is OK only for Step 5), then the output report must be filtered at Q.Value <= 0.01. Applying more strict filtering than 0.01 will result in more missing values & likely worse downstream analysis. I suggest not to do that, as tghis strict filtering will inevitably result in mahy people looking at the data and thinking, falsely, that the ID numbers are low and missing value rate is high...
Adding details to notes and explaining each step