Assay RT calculation is not proper
https://github.com/PyProphet/pyprophet/blob/eb048de3014c676d704250cdd443e81af14e32f0/pyprophet/export.py#L59
To get assay_rt, we should be doing exp_rt - lib2expTrafo(delta_rt). Currently, we are subtracting library_space time from experimental_space time. lib2expTrafo function would convert delta_rt from library_space to experimental_space.
Are you sure? I think this is implemented after the following calculation:
https://github.com/OpenMS/OpenMS/blob/b7f3d1bb456f17a7c4ae42b20721bbfdf70e9ce3/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp#L624
Before this, expected_rt is transformed using trafo.
https://github.com/OpenMS/OpenMS/blob/b7f3d1bb456f17a7c4ae42b20721bbfdf70e9ce3/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp#L1101
https://github.com/OpenMS/OpenMS/blob/b7f3d1bb456f17a7c4ae42b20721bbfdf70e9ce3/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp#L539
Sorry, I should have said assay_rt calculation is not correct.
I'm unfortunately still not sure if I understand the problem. I think the following is happening:
- OpenSWATH uses assay iRT and then first transforms this to assay RT.
- A window around the assay RT is extracted and features are found. This results in a feature RT (also referred to as EXP_RT).
- Then the delta RT between the feature RT and assay RT is computed.
Since we don't store assay RT in the OSW files, we compute this in PyProphet on the fly. For this, we use the feature RT and subtract the delta RT. All of these calculations are done in RT rather than in iRT space. Is there something going wrong in the computations? Is it correct or different in the TSV output? I thought that assay_rt is identical in the original TSV and PyProphet TSV output.
- Then the delta RT between the feature RT and assay RT is computed.
delta RT is trafo.apply(feature RT) - assay RT https://github.com/OpenMS/OpenMS/blob/b7f3d1bb456f17a7c4ae42b20721bbfdf70e9ce3/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp#L1101
EXP_RT is taken from FEATURE.EXP_RT in pyProphet, which is in the unit of experimental time, whereas delta RT is computed in the unit of library time. I haven't compared with the output file. I did compare manually in the .osw files in FEATURE and PRECURSOR table.
I am also not sure if we are on the same page for the definition of iRT. I think iRT time would be unit-less, whereas Library and Experimental time would be in the unit of second.
I believe delta RT is computed also in experimental time: https://github.com/OpenMS/OpenMS/blob/b7f3d1bb456f17a7c4ae42b20721bbfdf70e9ce3/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFinderScoring.cpp#L756
What might be confusing is that expected_rt is first obtained in library space and then transformed to experimental space.
So I think the PyProphet computation is the same as the OpenSWATH, right?
I am not sure about this calculation. In the final output .osw file, for one feature I calculated that FEATURE.DELTA_RT = FEATURE.NORM_RT - PRECURSOR.LIBRARY_RT Therefore, it looks like that FEATURE.DELTA_RT is in the library space.