pyprophet icon indicating copy to clipboard operation
pyprophet copied to clipboard

Assay RT calculation is not proper

Open shubham1637 opened this issue 6 years ago • 7 comments

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.

shubham1637 avatar Oct 03 '19 17:10 shubham1637

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

grosenberger avatar Oct 03 '19 18:10 grosenberger

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

shubham1637 avatar Oct 03 '19 18:10 shubham1637

Sorry, I should have said assay_rt calculation is not correct.

shubham1637 avatar Oct 03 '19 18:10 shubham1637

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.

grosenberger avatar Oct 05 '19 11:10 grosenberger

  • 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.

shubham1637 avatar Oct 06 '19 23:10 shubham1637

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?

grosenberger avatar Oct 07 '19 11:10 grosenberger

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.

shubham1637 avatar Oct 07 '19 18:10 shubham1637