oktoberfest.pr.Predictor.predict_rt
- Predictor.predict_rt(data, **kwargs)
Generate retention time predictions and add them to the provided data object.
This function takes a Spectra object containing information about PSMs and predicts retention times. The configuration of Koina/DLomix is set using the kwargs.
- Parameters:
data (
Spectra) – Spectra object containing the data required for prediction and to store the predictions in after retrieval from the server.kwargs – Additional keyword arguments forwarded to Koina/DLomix::predict
- Example:
>>> from oktoberfest.data.spectra import Spectra >>> from oktoberfest import predict as pr >>> import pandas as pd >>> # Requiered columns: MODIFIED_SEQUENCE, COLLISION_ENERGY, PRECURSOR_CHARGE and FRAGMENTATION >>> meta_df = pd.DataFrame({"MODIFIED_SEQUENCE": ["AAAC[UNIMOD:4]RFVQ","RM[UNIMOD:35]PC[UNIMOD:4]HKPYL"], >>> "COLLISION_ENERGY": [30,35], >>> "PRECURSOR_CHARGE": [1,2], >>> "FRAGMENTATION": ["HCD","HCD"]}) >>> var = Spectra._gen_vars_df() >>> library = Spectra(obs=meta_df, var=var) >>> library.strings_to_categoricals() >>> irt_predictor = pr.Predictor.from_koina( >>> model_name="Prosit_2019_irt", >>> server_url="koina.wilhelmlab.org:443", >>> ssl=True) >>> irt_predictor.predict_rt(data=library) >>> print(library.obs["PREDICTED_IRT"])