masskit_ai.spectrum.peptide package

Subpackages

Submodules

masskit_ai.spectrum.peptide.peptide_callbacks module

class masskit_ai.spectrum.peptide.peptide_callbacks.PeptideCB(*args: Any, **kwargs: Any)

Bases: Callback

callbacks for peptide spectra training

on_validation_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx)

masskit_ai.spectrum.peptide.peptide_constants module

masskit_ai.spectrum.peptide.peptide_embed module

class masskit_ai.spectrum.peptide.peptide_embed.EmbedPeptide(config)

Bases: Embed1D

peptide 1D embedding

get_mod_list(row)

given a data row, return a numpy array of mods

Parameters:

row – data row

Returns:

mods as numpy array

mods_channels()

number of channels for modifications

Returns:

number of channels

mods_embed(row)

embed the peptide modifications as a one hot tensor

Parameters:

row – data record

Returns:

one hot tensor

static mods_singleton_channels()

the number of mods_singleton channels

Returns:

the number of mod channels

mods_singleton_embed(row)

embed the modifications as a float tensor ranging from 0 to the number of mods

Parameters:

row – data record

Returns:

float tensor

static peptide_channels()

number of channels for peptide embedding

Returns:

number of channels

peptide_embed(row)

embed the peptide sequence as a one hot tensor

Parameters:

row – data record

Returns:

one hot tensor

static peptide_singleton_channels()

number of channels for peptide singleton embedding

Returns:

number of channels

peptide_singleton_embed(row)

embed the peptide sequence as a float tensor ranging from 0 to the number of amino acids

Parameters:

row – data record

Returns:

one hot tensor

masskit_ai.spectrum.peptide.peptide_prediction module

masskit_ai.spectrum.peptide.peptide_prediction.upres_peptide_spectra(df, ion_types=None, max_mz=0, min_mz=0)

take a dataframe with predicted spectra, generate matching theoretical spectra, and upres matching peaks

Parameters:
  • df – list of spectra

  • ion_types – ion types to use when generating theoretical spectra, defaults to None

  • max_mz – maximum mz value for calculating cosine score. 0 means don’t filter

  • min_mz – the minimum mz value for calculation the cosine score

masskit_ai.spectrum.peptide.peptide_prediction.upres_peptide_spectrum(predicted_spectrum, ion_types=None)

match a theoretical peptide spectrum to a predicted spectrum and copy over the theoretical mz values to the predicted spectrum. If there are more than one matches to a predicted spectrum, don’t match

Parameters:
  • predicted_spectrum – the predicted spectrum

  • ion_types – ion types to use when generating theoretical spectra, defaults to None

masskit_ai.spectrum.peptide.peptide_samplers module

class masskit_ai.spectrum.peptide.peptide_samplers.LengthSampler(*args, **kwargs)

Bases: BaseSampler

sampler based on length of a peptide. borrowed from alphafold 2

probability()

method to compute the probability of sampling a particular record

Returns:

numpy array with the probability of sampling, from [0,1]

class masskit_ai.spectrum.peptide.peptide_samplers.LengthSampler2(*args, **kwargs)

Bases: BaseSampler

sampler based on length of a peptide. borrowed from alphafold 2

probability()

method to compute the probability of sampling a particular record

Returns:

numpy array with the probability of sampling, from [0,1]

class masskit_ai.spectrum.peptide.peptide_samplers.LengthSampler3(*args, **kwargs)

Bases: BaseSampler

sampler based on length of a peptide. borrowed from alphafold 2

probability()

method to compute the probability of sampling a particular record

Returns:

numpy array with the probability of sampling, from [0,1]

Module contents