Data Models
nplinker.metabolomics
¶
MolecularFamily
¶
MolecularFamily(id: str)
Class to model molecular family.
Attributes:
-
id
(str
) –Unique id for the molecular family.
-
spectra_ids
(set[str]
) –Set of spectrum ids in the molecular family.
-
spectra
(set[Spectrum]
) –Set of Spectrum objects in the molecular family.
-
strains
(StrainCollection
) –StrainCollection object that contains strains in the molecular family.
Parameters:
-
id
(str
) –Unique id for the molecular family.
Source code in src/nplinker/metabolomics/molecular_family.py
add_spectrum
¶
add_spectrum(spectrum: Spectrum) -> None
Add a Spectrum object to the molecular family.
Parameters:
-
spectrum
(Spectrum
) –Spectrum
object to add to the molecular family.
Source code in src/nplinker/metabolomics/molecular_family.py
detach_spectrum
¶
detach_spectrum(spectrum: Spectrum) -> None
Remove a Spectrum object from the molecular family.
Parameters:
-
spectrum
(Spectrum
) –Spectrum
object to remove from the molecular family.
Source code in src/nplinker/metabolomics/molecular_family.py
has_strain
¶
Spectrum
¶
Spectrum(
id: str,
mz: list[float],
intensity: list[float],
precursor_mz: float,
rt: float = 0,
metadata: dict | None = None,
)
Class to model MS/MS Spectrum.
Attributes:
-
id
–the spectrum ID.
-
mz
–the list of m/z values.
-
intensity
–the list of intensity values.
-
precursor_mz
–the m/z value of the precursor.
-
rt
–the retention time in seconds.
-
metadata
–the metadata of the spectrum, i.e. the header information in the MGF file.
-
gnps_annotations
(dict
) –the GNPS annotations of the spectrum.
-
gnps_id
(str | None
) –the GNPS ID of the spectrum.
-
strains
(StrainCollection
) –the strains that this spectrum belongs to.
-
family
(MolecularFamily | None
) –the molecular family that this spectrum belongs to.
-
peaks
(ndarray
) –2D array of peaks, each row is a peak of (m/z, intensity) values.
Parameters:
-
id
(str
) –the spectrum ID.
-
mz
(list[float]
) –the list of m/z values.
-
intensity
(list[float]
) –the list of intensity values.
-
precursor_mz
(float
) –the precursor m/z.
-
rt
(float
, default:0
) –the retention time in seconds. Defaults to 0.
-
metadata
(dict | None
, default:None
) –the metadata of the spectrum, i.e. the header information in the MGF file.
Source code in src/nplinker/metabolomics/spectrum.py
peaks
cached
property
¶
peaks: ndarray
Get the peaks, a 2D array with each row containing the values of (m/z, intensity).