AlignmentEngine
- class modifinder.engines.Abtracts.AlignmentEngine(**kwargs)[source]
Bases:
ABC
Base class for alignment engines
It provides the basic structure for alignment engines in ModiFinder.
- abstract align(network: DiGraph, mz_tolerance: float = 0.02, ppm_tolerance: float = 100.0, align_all: bool = True, **kwargs)[source]
Aligns the spectra in the network
For each edge in the network, aligns the spectrum of the start node with the spectrum of the end node. If the edge has already been aligned, and align_all is False, the edge will not be realigned.
- Parameters:
(nx.DiGraph) (network) –
(float (ppm_tolerance) –
optional) (If True, all edges will be aligned. If False, only the edges that have not been aligned will be aligned. Defaults to False.) –
(float –
optional) –
(bool (align_all) –
optional) –
- abstract align_single(SpectrumTuple1, SpectrumTuple2, mz_tolerance: float = 0.02, ppm_tolerance: float = 100.0, **kwargs)[source]
Aligns two spectra, returns the alignment details as an EdgeDetail object
- Parameters:
(SpectrumTuple) (SpectrumTuple2) –
(SpectrumTuple) –
(float) (ppm_tolerance) –
(float) –
kwargs (additional arguments) –
- Returns:
EdgeDetail
- Return type:
the edge detail object
See also
For an example of an AlignmentEngine, see CosineAlignmentEngine
AnnotationEngine
- class modifinder.engines.Abtracts.AnnotationEngine(**kwargs)[source]
Bases:
ABC
Base class for annotation engines
It provides the basic structure for annotation engines in ModiFinder.
- abstract annotate_single(compound, modify_compound: bool = True, **kwargs) List[Tuple[int, List[str]]] [source]
provides annotation for the peaks in a single compound
:param : compound (Compound): the compound to be annotated :param : modify_compound (bool): whether to modify the passed compound with the annotations :param : kwargs: additional arguments
- Returns:
Mapping[int, List[str]]: a dictionary with the indices of the peaks as keys and the list of annotations as values
- abstract get_fragment_info(Compound: Compound, fragment: int) Tuple[List[int], List[Tuple[int, int]], str, str] [source]
converts a fragment to a SMILES string
:param : Compound (Compound): the compound :param : fragment (int): the fragment
- Returns:
tuple(atomlist -> List[int], edge_list -> List[Tuple[int, int]], formula -> str, smiles -> str): a tuple containing the atom list, the edge list, the formula and the SMILES string
See also
For an example of an AnnotationEngine, see MAGMaAnnotationEngine
EvaluationEngine
- class modifinder.engines.Abtracts.EvaluationEngine(**kwargs)[source]
Bases:
ABC
Base class for evaluation engines
It provides the basic structure for evaluation engines in ModiFinder.
- abstract evaluate_single(known_compound_structure: Mol, unknonwn_compound_structure: Mol, probabilities: List[float], **kwargs)[source]
Evaluates the prediction of a single compound
- Parameters:
known_compound_structure (rdkit Chem.Mol) – The known compound structure
unknonwn_compound_structure (rdkit Chem.Mol) – The unknown compound structure
probabilities (List[float]) – The probabilities of each atom being the modification site
kwargs (dict) – additional arguments
See also
For an example of an EvaluationEngine, see BasicEvaluationEngine