oktoberfest.data.Spectra.add_intensities

Spectra.add_intensities(intensities, annotation, fragment_type)

Add predicted intensities and convert to sparse matrix.

This function takes two numpy arrays, containing intensities and the fragment ion annotations in ProForma notation representing the column index. Each intensity array is reordered using the annotation to match the order of the fragment ion annotations in self.var_names and stored as a csr_matrix.

Parameters:
  • intensities (ndarray) – intensity numpy array to add with shapes (n x m)

  • annotation (ndarray) – fragment ion annotation numpy array in ProForma notation with shape (… x m). Only the first row of the annotation array is used, i.e. intensities for all PSMs must be provided in the same order.

  • fragment_type (FragmentType) – the type of intensities to add. Can be FragmentType.RAW or FragmentType.PRED.