Skip to content

Abstract Base Classes

nplinker.metabolomics.abc

SpectrumLoaderBase

Bases: ABC

Abstract base class for SpectrumLoader.

spectra abstractmethod property

spectra: list[Spectrum]

Get Spectrum objects.

Returns:

MolecularFamilyLoaderBase

Bases: ABC

Abstract base class for MolecularFamilyLoader.

get_mfs abstractmethod

get_mfs(keep_singleton: bool) -> list[MolecularFamily]

Get MolecularFamily objects.

Parameters:

  • keep_singleton (bool) –

    True to keep singleton molecular families. A singleton molecular family is a molecular family that contains only one spectrum.

Returns:

Source code in src/nplinker/metabolomics/abc.py
@abstractmethod
def get_mfs(self, keep_singleton: bool) -> list[MolecularFamily]:
    """Get MolecularFamily objects.

    Args:
        keep_singleton: True to keep singleton molecular families. A
            singleton molecular family is a molecular family that contains
            only one spectrum.

    Returns:
        A sequence of MolecularFamily objects.
    """

FileMappingLoaderBase

Bases: ABC

Abstract base class for FileMappingLoader.

mappings abstractmethod property

mappings: dict[str, list[str]]

Get file mappings.

Returns:

  • dict[str, list[str]]

    A mapping from spectrum ID to the names of files where the spectrum occurs.

AnnotationLoaderBase

Bases: ABC

Abstract base class for AnnotationLoader.

annotations abstractmethod property

annotations: dict[str, dict]

Get annotations.

Returns:

  • dict[str, dict]

    A mapping from spectrum ID to its annotations.