deeplc.data

Dataset classes and utilities for DeepLC.

class deeplc.data.DeepLCDataset(peptidoforms, target_retention_times=None, add_ccs_features=False)

Bases: Dataset

Initialize the DeepLCDataset.

Parameters:
  • peptidoforms (list[Peptidoform | str]) – A list of peptidoforms, which can be either Peptidoform objects or their string representations.

  • target_retention_times (np.ndarray | None) – An array of target retention times corresponding to the peptidoforms. If None, targets will be set to NaN.

  • add_ccs_features (bool) – Whether to include CCS features in the encoded representation. Default is False.

Raises:

ValueError – If target_retention_times is provided and its length does not match the number of peptidoforms.

classmethod from_psm_list(psm_list, add_ccs_features=False)

Create a DeepLCDataset from a PSMList.

Parameters:
  • psm_list (PSMList) – A PSMList containing the peptidoforms and their corresponding retention times.

  • add_ccs_features (bool) – Whether to include CCS features in the encoded representation. Default is False.

Returns:

A DeepLCDataset instance created from the provided PSMList.

Return type:

DeepLCDataset

deeplc.data.split_datasets(train_data: _DatasetT, validation_data: _DatasetT, validation_split: float) tuple[_DatasetT, _DatasetT]
deeplc.data.split_datasets(train_data: _DatasetT, validation_data: None, validation_split: float) tuple[Subset[_DatasetT], Subset[_DatasetT]]

Split the dataset into training and validation sets.

Parameters:
  • train_data (Dataset) – The dataset to be split.

  • validation_data (Dataset | None) – If provided, this dataset will be used as the validation set. If None, the train_data will be split.

  • validation_split (float) – The fraction of the dataset to be used as the validation set if validation_data is None.

Returns:

A tuple containing the training and validation datasets.

Return type:

tuple[Dataset, Dataset] | tuple[Subset, Subset]

Raises:

ValueError – If validation_data is None and train_data does not implement __len__ method.