pygecko.gc_tools.analysis package

Submodules

pygecko.gc_tools.analysis.analysis_settings module

class pygecko.gc_tools.analysis.analysis_settings.Analysis_Settings(chromatogram: ndarray)

Bases: object

Analysis_Settings class for storing information about parameters for raw data processing.

sn

Signal to noise ratio for peak detection.

Type:

int

time_range

Time range for peak detection.

Type:

tuple

indices_range

Indices range for peak detection.

Type:

list

width

Width for peak detection.

Type:

int, float

prominence_ms

Prominence for peak detection via MS.

Type:

int

prominence_fid

Prominence for peak detection via FID.

Type:

int

trace_prominence

Prominence for peak detection on individual mass traces.

Type:

int

height

Height for peak detection.

Type:

int

savgol_window

Window size for Savitzky-Golay filter.

Type:

int

max_half_window

Maximum half window size for Snip algorithm.

Type:

int

boarder_threshold

Threshold for boarder detection.

Type:

int

boarder_window

Window size for boarder detection.

Type:

int

max_isotopic_diff

Max deviation of isotopic peak intensity for analyte assignment.

Type:

float

min_rel_intensity

Minimum relative intensity for m/z trace to be considered for analyte assignment.

Type:

float

scan_rate

Scan rate of chromatogram.

Type:

float

boarder_threshold: int | None
boarder_window: int | None
height: int | None
indices_range: list[int | None]
max_half_window: int | None
max_isotopic_diff: float | None
min_rel_intensity: float | None
pop(key: str, default)
prominence_fid: int | None
prominence_ms: int | None
savgol_window: int | None
scan_rate: float
sn: int
time_range: tuple | None
trace_prominence: int | None
update(**kwargs)

Updates settings by setting the keyword arguments after checking.

Parameters:

**kwargs – Keyword arguments for settings.

width: int | float | None

pygecko.gc_tools.analysis.quantification module

class pygecko.gc_tools.analysis.quantification.Quantification

Bases: object

A class wrapping functions for calculating yields based on peak areas.

static quantify_calibration(peak: FID_Peak, standard: FID_Peak, slope: float, intercept: float) int

Returns the relative quantity of an analyte based on a calibration curve.

Parameters:
  • peak (FID_Peak) – Peak to calculate the relative quantity for.

  • standard (FID_Peak) – Standard peak to use for quantification.

  • slope (float) – Slope of the calibration curve.

  • intercept (float) – Intercept of the calibration curve.

Returns:

Relative quantity of analyte.

Return type:

yield_ (int)

static quantify_polyarc(peak: FID_Peak, std_peak: FID_Peak) int

Returns the relative quantity of an analyte based on the ratio of the analytes carbon-normalized peak area to the carbon-normalized peak area of a standard.

Parameters:
  • peak – Peak to calculate the relative quantity for.

  • std_peak – Standard peak to use for quantification.

Returns:

Relative quantity of analyte.

Return type:

yield_ (int)

static quantify_ratio(peak: FID_Peak, standard: FID_Peak) int

Returns the relative quantity of an analyte based on the ratio of the analytes peak area to the peak area of a standard.

Parameters:
  • peak (FID_Peak) – Peak to calculate the relative quantity for.

  • standard (FID_Peak) – Standard peak to use for quantification.

Returns:

Relative quantity of analyte.

Return type:

yield_ (int)

pygecko.gc_tools.analysis.retention_indices module

class pygecko.gc_tools.analysis.retention_indices.RI_Calibration(injection: FID_Injection | MS_Injection, c_count: int, rt: float)

Bases: object

A class for storing information about a retention index calibration and calculating retention indices.

calibration

Calibration injection.

Type:

FID_Injection|MS_Injection

alkanes

Array of alkanes with columns for smiles, carbon count and retention time.

Type:

np.ndarray

gradient

Gradient of the linear fit of the calibration.

Type:

float

intercept

Intercept of the linear fit of the calibration.

Type:

float

alkanes: ndarray
assign_ris(gc_data: Injection | GC_Sequence, alignment=False) None

Assigns retention indices to peaks in a GC_Sequence or Injection.

Parameters:
  • gc_data (Injection|GC_Sequence) – GC_Sequence or Injection to assign retention indices to.

  • alignment (bool) – If True, retention times are aligned to the internal standard. Default is False.

calculate_ri(peak: Peak, align_factor=0) float | None

Returns the retention index for a given peak.

Parameters:
  • peak (Peak) – Peak to calculate the retention index for.

  • align_factor (float) – Alignment factor for the retention time. Default is 0.

Returns:

Retention index.

Return type:

ri (float)

calculate_ri_fit(rt)

Returns the retention index for a given retention time calculated using the linear fit of the calibration.

Parameters:

rt (float) – Retention time.

Returns:

Retention index.

Return type:

ri (float)

calibration: FID_Injection | MS_Injection
gradient: float
intercept: float

pygecko.gc_tools.analysis.spectral_matching module

class pygecko.gc_tools.analysis.spectral_matching.Spectral_Match(peaks: tuple[MS_Peak, MS_Peak], ms_score, rt_score)

Bases: object

A class to represent a match between two mass spectra.

peaks

Tuple containing the matched peaks.

Type:

tuple[MS_Peak, MS_Peak]

ms_score

Score of the match based on the cosine similarity of the mass spectra.

Type:

float

rt_score

Score of the match based on the difference in retention time.

Type:

float

classmethod find_peak(peak: MS_Peak, injection: MS_Injection, rt_threshold=0.1, ms_threshold=0.9) T | None

Returns a Spectral_Match object if the peak is found in the injection and None otherwise.

Parameters:
  • peak (MS_Peak) – Peak to find.

  • injection (MS_Injection) – Injection to search for the peak.

  • rt_threshold (float, optional) – Retention time threshold for the match. Defaults to 0.1.

  • ms_threshold (float, optional) – Mass spectrum similarity threshold for the match. Defaults to 0.9.

Returns:

Spectral_Match object if the peak is found and None otherwise.

Return type:

Spectral_Match|None

classmethod match_peaks(peak1: MS_Peak, peak2: MS_Peak, rt_threshold=0.1, ms_threshold=0.9) T | None

Returns a Spectral_Match object if the peaks match and None otherwise.

Parameters:
  • peak1 (MS_Peak) – First peak to compare.

  • peak2 (MS_Peak) – Second peak to compare.

  • rt_threshold (float, optional) – Retention time threshold for the match. Defaults to 0.1.

  • ms_threshold (float, optional) – Mass spectrum similarity threshold for the match. Defaults to 0.9.

Returns:

Spectral_Match object if the peaks match and None otherwise.

Return type:

Spectral_Match|None

ms_score: float
peaks: tuple[MS_Peak, MS_Peak]
rt_score: float

Module contents