massdash.structs.FeatureMap

class massdash.structs.FeatureMap(feature_df: DataFrame, sequence: str, precursor_charge: int, config: TargetedDIAConfig = None, verbose: bool = False)

Bases: object

Class for storing a feature map a feature map only contains the following columns: - mz: mass to charge ratio - rt: retention time - im: ion mobility - int: intensity - ms_level: 1 for precursor, 2 for fragment - annotation: annotation of precursor/fragment

feature_df

A DataFrame containing the feature map

Type:

pd.DataFrame

has_im

A boolean indicating if the feature map has ion mobility data

Type:

bool

empty() bool

Check if the FeatureMap is empty.

Returns:

True if the feature_df is empty, False otherwise.

Return type:

bool

get_precursor_chromatograms() List[Chromatogram]

Get a list of precursor chromatograms from the feature map

get_precursor_mobilograms() List[Mobilogram]

Get a list of precursor ion mobility from the feature map

get_precursor_spectra() List[Spectrum]

Get a list of precursor spectra from the feature map

get_transition_chromatograms() List[Chromatogram]

Get a list of transition chromatograms from the feature map

get_transition_mobilograms() List[Mobilogram]

Get a list of transition ion mobility from the feature map

get_transition_spectra() List[Spectrum]

Get a list of transition spectra from the feature map

static integrate_intensity_across_two_dimensions(df: ~pandas.core.frame.DataFrame, index: str = 'im', columns: str = 'rt', values: str = 'int', axis: int = 0, integration_function=<function sum>) Tuple[ndarray, ndarray]

Integrate intensity across two dimensions of a DataFrame.

Parameters:
  • df (pd.DataFrame) – The input DataFrame.

  • index (str) – The name of the index column. Default is ‘im’.

  • columns (str) – The name of the columns. Default is ‘rt’.

  • values (str) – The name of the values. Default is ‘int’.

  • axis (int) – The axis to compute the average intensity across. Must be 0 or 1. Default is 0.

  • integration_function (function) – The function to use to integrate the intensity values. Default is np.sum.

Returns:

The x-axis values and the average intensity values.

Return type:

Tuple of two numpy arrays

to_chromatograms() TransitionGroup

Convert the feature map to a TransitionGroup object storing chromatograms

Returns:

A TransitionGroup object storing chromatograms

Return type:

TransitionGroup

to_mobilograms() TransitionGroup

Convert the feature map to a TransitionGroup object storing mobilograms

Returns:

A TransitionGroup object storing mobilograms

Return type:

TransitionGroup

to_spectra() TransitionGroup

Convert the feature map to a TransitionGroup object storing spectra

Returns:

A TransitionGroup object storing spectra

Return type:

TransitionGroup