oktoberfest.pr.Predictor.predict_at_once
- Predictor.predict_at_once(data, xl=False, **kwargs)
Retrieve and return predictions in one go.
This function takes a Spectra object containing information about PSMs and predicts peptide properties. The configuration of Koina is set using the kwargs. See the Koina function for details. TODO, link this properly.
- Parameters:
- Return type:
tuple[dict[str,ndarray],dict[str,ndarray]] |dict[str,ndarray]- Returns:
a dictionary with targets (keys) and predictions (values)
- Example:
>>> from oktoberfest import predict as pr >>> import pandas as pd >>> # Required 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) >>> intensity_predictor = pr.Predictor.from_koina( >>> model_name="Prosit_2020_intensity_HCD", >>> server_url="koina.wilhelmlab.org:443", >>> ssl=True) >>> predictions = intensity_predictor.predict_at_once(data=library) >>> print(predictions)