deeplc
DeepLC: Retention time prediction for peptides carrying any modification.
- deeplc.calibrate(psm_list_reference, model=None, calibration=None, predict_kwargs=None)
Return a Calibration instance fitted to the reference dataset.
- Parameters:
psm_list_reference (PSMList) – List of PSMs to use as reference for calibration.
model (Module | PathLike | str | None) – Trained model or path to model file.
calibration (Calibration | None) – Calibration instance to use. If None, SplineTransformerCalibration is used.
predict_kwargs (dict | None) – Additional keyword arguments to pass to the prediction function.
- Returns:
Fitted calibration instance.
- Return type:
- deeplc.predict(psm_list, model=None, predict_kwargs=None, return_matrix=False)
Predict retention times for a list of PSMs using a trained model.
- Parameters:
psm_list (PSMList | list[PSM | Peptidoform | str]) – List of PSMs to predict retention times for.
model (Module | PathLike | str | None) – Trained model or path to model file. If None, the default DeepLC model is used.
predict_kwargs (dict | None) – Additional keyword arguments to pass to the prediction function.
return_matrix (bool) – If True, return the full prediction matrix of shape
(n, n_heads)when using a multitask model. If False (default), return a 1D array of shape(n,)using head 0 when model output is 2D.
- Returns:
Retention time predictions. Shape
(n,)unlessreturn_matrix=Trueand model produces multitask output, in which case shape is(n, n_heads).- Return type:
np.ndarray
- deeplc.predict_and_calibrate(psm_list, psm_list_reference=None, model=None, calibration=None, predict_kwargs=None)
Predict retention times and calibrate to a reference.
- Parameters:
psm_list (PSMList | list[PSM | Peptidoform | str]) – List of PSMs to predict retention times for.
psm_list_reference (PSMList | list[PSM | Peptidoform | str] | None) – List of PSMs to use as reference for calibration. If None, the best PSMs are automatically selected from
psm_list(auto-calibration). This requires that the input PSM list contains observed retention times, score and decoy status to select the best PSMs for auto-calibration.model (Module | PathLike | str | None) – Trained model or path to model file.
calibration (Calibration | None) – Calibration instance to use. If None, SplineTransformerCalibration is used.
predict_kwargs (dict | None) – Additional keyword arguments to pass to the prediction function.
- Returns:
Calibrated retention time predictions.
- Return type:
np.ndarray
- deeplc.finetune_and_predict(psm_list, psm_list_reference=None, model=None, train_kwargs=None, predict_kwargs=None)
Fine-tune the model to a reference and predict new retention times.
- Parameters:
psm_list (PSMList | list[PSM | Peptidoform | str]) – List of PSMs to predict retention times for.
psm_list_reference (PSMList | list[PSM | Peptidoform | str] | None) – List of PSMs to use as reference for calibration. If None, the best PSMs are automatically selected from
psm_list(auto-calibration). This requires that the input PSM list contains observed retention times, score and decoy status to select the best PSMs for auto-calibration.model (Module | PathLike | str | None) – Trained model or path to model file.
train_kwargs (dict | None) – Additional keyword arguments to pass to the training function.
predict_kwargs (dict | None) – Additional keyword arguments to pass to the prediction function.
- Returns:
Calibrated retention time predictions after fine-tuning.
- Return type:
np.ndarray
- deeplc.finetune(psm_list_reference, psm_list_validation=None, validation_split=0.1, model=None, train_kwargs=None)
Fine-tune an existing model.
- Parameters:
psm_list_reference (PSMList) – List of PSMs to use as reference for fine-tuning.
psm_list_validation (PSMList | None) – List of PSMs to use for validation during fine-tuning. If None, a split from psm_list is used.
validation_split (float) – Fraction of
psm_list_referenceto use for validation whenpsm_list_validationis None.model (Module | PathLike | str | None) – Trained model or path to model file.
train_kwargs (dict | None) – Additional keyword arguments to pass to the training function.
- Returns:
Fine-tuned model.
- Return type:
- deeplc.save_model(model, path)
Save a model’s state dict to a file.
Use
load_model()(viapredict()) to reload the saved checkpoint.
- deeplc.train(psm_list_reference, psm_list_validation=None, validation_split=0.1, train_kwargs=None)
Train a new model from scratch.
- Parameters:
psm_list_reference (PSMList) – List of PSMs to use as reference for fine-tuning.
psm_list_validation (PSMList | None) – List of PSMs to use for validation. If None, a split from psm_list is used.
validation_split (float) – If psm_list_validation is None, this fraction of psm_list will be used for validation.
train_kwargs (dict | None) – Additional keyword arguments to pass to the training function.
- Returns:
Trained model.
- Return type: