esmraldi.theoreticalspectrum

Module Contents

Classes

TheoreticalSpectrum

This class aims at generating a theoretical spectrum from a list of species

class esmraldi.theoreticalspectrum.TheoreticalSpectrum(molecules, adducts, modifications=[])

This class aims at generating a theoretical spectrum from a list of species

mix_species(species, optional=False)

Mix species of different families.

All possible combinations are extracted.

Parameters
species: list

SpeciesRule list

optional: bool

whether this species if optional or not

Returns
np.ndarray

mix of SpeciesRule

merge_dicts_mz(dict1, dict2)

Merges two dictionaries, where keys=values and values=mz by summing their keys and values.

Parameters
dict1: dict

first dictionary

dict2: dict

second dictionary

Returns
dict

merged dictionary

expand_mix(mix)

Generates the full list of species from all species rules contained in the mix.

Maps the masses to all possible names.

Parameters
mix: np.ndarray

mix of SpeciesRule

Returns
dict

mapping of all species (name to mz)

molecules_regexp(adduct, molecules)

Extracts all molecules with fit the regexp in adduct.

Parameters
adduct: SpeciesRule

adduct or modification

molecules: dict

all molecules

Returns
dict

molecules which match the adduct or modification

mix_molecules_regexp(mix, molecules)

All molecules matching regexp from species in a mix.

Parameters
mix: list

list of SpeciesRule

molecules: dict

all molecules

Returns
dict

molecules matching every modification add functions

add_all_adducts_to_molecules(molecules, adducts)

Add adducts and modifications, and every permutation of them to molecules.

Parameters
molecules: dict

molecule mapping names to mz

adducts: list

adduct species rule list

Returns
dict

theoretical spectrum

add_adduct_to_molecules(molecules, adduct, rules_max={})

Add one adduct to all molecules.

Parameters
molecules: list

molecule molecule names to mz

adduct: SpeciesRule

adduct or modification

rules_max: dict

rules constraining number of adduct per molecule

Returns
dict

molecules with every combination of adduct

add_adducts_to_molecules_regexp(adduct)

Add adducts based on regexp.

Parameters
adduct: SpeciesRule

adduct or modification

Returns
dict

molecules matching regexp of adduct