msions.kronik

This module contains functions that are useful for interacting with Kronik output files in Python.

Module Contents

Functions

simple_df(→ pandas.DataFrame)

Create a simplified Kronik pandas DataFrame.

filter_df(→ pandas.DataFrame)

Filter a pandas DataFrame containing Kronik data with a start and stop time.

match_rt_mass(→ int)

Match Kronik output with itself.

msions.kronik.simple_df(kro_input: Union[pandas.DataFrame, str], cv: Union[int, str] = None, topN: int = None, bestInt_thresh: float = None, sumInt_thresh: float = None, remove1: bool = False, by_int: bool = False) pandas.DataFrame[source]

Create a simplified Kronik pandas DataFrame.

The DataFrame can be filtered by topN intensity values and/or by removing +1 charges.

Parameters:
  • kro_input (pd.Dataframe or str) – The Kronik pandas DataFrame or Kronik tab-delimited file.

  • cv (int or str) – CV value associated with the dataset or “given” for already present

  • topN (int) – Only include features with topN summed intensity.

  • bestInt_thresh (float) – Only include features with apex intensity above intensity threshold.

  • sumInt_thresh (float) – Only include features with summed intensity above intensity threshold.

  • remove1 (bool) – Remove +1 charges from DataFrame.

  • by_int (bool) – Sort data by summed intensity.

Returns:

A pandas DataFrame of the input file.

Return type:

pd.DataFrame

Examples

>>> import msions.kronik as kro
>>> kro.simple_df("test.kro")
msions.kronik.filter_df(df, start=0, stop=None) pandas.DataFrame[source]

Filter a pandas DataFrame containing Kronik data with a start and stop time.

Parameters:
  • df (pd.DataFrame) – pandas DataFrame containing Kronik data.

  • start (float) – Starting time to use to filter the DataFrame.

  • stop (float) – Ending time to use to filter the DataFrame.

Returns:

A filtered pandas DataFrame.

Return type:

pd.DataFrame

Examples

>>> import msions.kronik as kro
>>> kro_df = kro.simple_df("test.kro")
>>> kro.filter_df(kro_df, start=15.0)
msions.kronik.match_rt_mass(ref_row: pandas.Series, other_df: pandas.DataFrame, rt_diff: float = None) int[source]

Match Kronik output with itself.

Parameters:
  • ref_row (pd.Series) – The row of data to match.

  • other_df (pd.DataFrame) – The other DataFrame to match.

  • rt_diff (float) – Retention time difference window to use to search for a match.

Returns:

Number of matches in DataFrame.

Return type:

int

Examples

>>> from msions.kronik import simple_df
>>> from msions.kronik import match_rt_mass
>>> kro_df = simple_df("test.kro")
>>> redund_df = kro_df.copy()
>>> redund_df["redund"] = redund_df.apply(match_rt_mass, axis=1, other_df=kro_df, rt_diff=1)