tacco.plots.sigmap

sigmap(adata, value_key, group_key, sample_key=None, position_key=None, position_split=2, min_obs=0, basis_adata=None, basis_value_key=None, basis_group_key=None, basis_sample_key=None, basis_position_key=None, basis_position_split=None, basis_min_obs=None, fillna=None, restrict_groups=None, restrict_values=None, basis_restrict_groups=None, basis_restrict_values=None, p_corr='fdr_bh', method='mwu', reduction=None, normalization=None, assume_counts=None, reads=False, colors=None, axsize=None, value_dendrogram=False, group_dendrogram=False, value_order=None, group_order=None, ax=None)[source]

Plot heatmap of contribution to groups and mark significant differences with asterisks.

Parameters:
  • adata – An AnnData with annotation in .obs.

  • value_key – The .obs or .obsm key with the values to determine the enrichment for.

  • group_key – The .obs key with categorical group information.

  • sample_key – The .obs key with categorical sample information for p-value determination. If None, use only the aggregated data is plotted.

  • position_key – The .obsm key or array-like of .obs keys with the position space coordinates. If None, no position splits are performed.

  • position_split – The number of splits per spatial dimension before enrichment. Can be a tuple with the spatial dimension as length to assign a different split per dimension. If None, no position splits are performed. See also min_obs.

  • min_obs – The minimum number of observations per sample: if less observations are available, the sample is not used. This also limits the number of position_split to stop splitting if the split would decrease the number of observations below this threshold.

  • basis_adata – Another AnnData with annotation in .obs to compare. If None, only the adata composition is shown.

  • basis_value_key – The .obs or .obsm key for basis_adata with the values to determine the enrichment for. If None, value_key is used.

  • basis_group_key – The .obs key with categorical group information for basis_adata. If None, value_key is used.

  • basis_sample_key – The .obs key with categorical sample information for basis_adata. If None, sample_key is used.

  • basis_position_key – Like position_key but for basis_adata. If None, no position splits are performed.

  • basis_position_split – Like position_split but for basis_adata. If None, position_split is used.

  • basis_min_obs – Like min_obs but for basis_adata. If None, min_obs is used.

  • fillna – If None, observation containing NA in the values are filtered. Else, NA values are replaced with this value.

  • restrict_groups – A list-like containing the groups within which the enrichment analysis is to be done. If None, all groups are included.

  • restrict_values – A list-like containing the values within which the enrichment analysis is to be done. If None, all values are included. Works only for categorical values.

  • basis_restrict_groups – Like restrict_groups but for basis_adata.

  • basis_restrict_values – Like restrict_values but for basis_adata.

  • p_corr – The name of the p-value correction method to use. Possible values are the ones available in multipletests(). If None, no p-value correction is performed.

  • method

    Specification of methods to use for enrichment. Available are:

    • ’fisher’: Fishers exact test; only for categorical values. Ignores the reduction and normalization arguments.

    • ’mwu’: MannWhitneyU test

  • reduction

    The reduction to apply on each (group,sample) subset of the data. Possible values are:

    • ’sum’: sum of the values over observations

    • ’mean’: mean of the values over observations

    • ’median’: median of the values over observations

    • None: use observations directly

    • a callable mapping a DataFrame to its reduced counterpart

  • normalization

    The normalization to apply on each reduced (group,sample) subset of the data. Possible values are:

    • ’sum’: normalize values by their sum (yields fractions)

    • ’percent’: like ‘sum’ scaled by 100 (yields percentages)

    • ’gmean’: normalize values by their geometric mean (yields contributions which make more sense for enrichments than fractions, due to zero-sum issue; see enrichments())

    • ’clr’: “Center logratio transform”; like ‘gmean’ with additional log transform; makes the distribution more normal and better suited for t tests

    • None: no normalization

    • a value name from value_key: all values are normalized to this contribution

    • a callable mapping a DataFrame to its normalized counterpart

  • assume_counts – Ony relevant for normalization==’gmean’ and normalization==’clr’; whether to regularize zeros by adding a pseudo count of 1 or by replacing them by 1e-3 of the minimum value. If None, check whether the data are consistent with count data and assume counts accordingly, except if reads==True, then also assume_counts==True.

  • reads – Whether to weight the values by the total count per observation

  • colors – The mapping of value names to colors. If None, a set of standard colors is used.

  • axsize – Tuple of width and size of a single axis. If None, use automatic values.

  • value_dendrogram – Whether to draw a dendrogram for the values

  • group_dendrogram – Whether to draw a dendrogram for the groups

  • value_order – Set the order of the values explicitly; this option is incompatible with value_dendrogram.

  • group_order – Set the order of the groups explicitly; this option is incompatible with group_dendrogram.

  • ax – The Axes to plot on. If None, creates a fresh figure for plotting. Incompatible with dendrogram plotting.

Returns:

A Figure if ax is None, else None.