
Analysis Module¶
flyqma.analysis
provides several tools for statistically comparing measured fluorescence levels between subpopulations of cells.
-
class
flyqma.analysis.statistics.
CelltypeComparison
(measurements, basis, label='celltype', test='MW', **kwargs)[source]¶ Summary of comparisons between all labeled celltypes.
Attributes:
measurements (pd.DataFrame) - measurement data
basis (str) - attribute on which populations are compared
label (str) - attribute used to define population labels
test (str) - statistical test used, one of (‘KS’, ‘t’, ‘MW’)
-
compare_celltype
(type1, type2, **kwargs)[source]¶ Args:
type1 (str) - first cell type
type2 (str) - second cell type
kwargs: keyword arguments for statistical test
Returns:
p (float) - p value for comparison statistic
is_greater_than (bool) - True if first population mean is greater
-
property
pairs
¶ Unique pairs of labels.
-
-
class
flyqma.analysis.statistics.
PairwiseCelltypeComparison
(measurements, type1, type2, basis, label='celltype', concurrent_only=True)[source]¶ Pairwise statistical comparison between two concurrent cell types.
Attributes:
label (str) - attribute used to stratify populations
type1 (str) - first label
type2 (str) - second label
Inherited attributes:
x (pd.DataFrame) - measurements of first population
y (pd.DataFrame) - measurements of second population
basis (str) - attribute on which populations are compared
-
format_axis
(ax, colors=None, axis_labels=None, mode='violin', ylabel=None)[source]¶ Format axis.
Args:
ax (matplotlib.axes.AxesSubplot)
colors (dict) - color for each box/violin keyed by label
axis_labels (dict) - axis label for each box/violin keyed by label
mode (str) - type of comparison, either ‘box’, ‘violin’, or ‘strip’
ylabel (str) - label for y axis
-
plot
(ax=None, colors=None, mode='violin', ylabel=None, **kwargs)[source]¶ Visualize comparison using seaborn box or violinplot.
Args:
ax (matplotlib.axes.AxesSubplot)
colors (dict) - color for each box/violin keyed by label
mode (str) - type of comparison, either ‘box’, ‘violin’, or ‘strip’
ylabel (str) - label for yaxis
kwargs: keyword arguments for seaborn plotting function
-
-
class
flyqma.analysis.statistics.
PairwiseComparison
(x, y, basis)[source]¶ Pairwise statistical comparison between measurements of two populations.
Attributes:
x (pd.DataFrame) - measurements of first population
y (pd.DataFrame) - measurements of second population
basis (str) - attribute on which populations are compared
-
compare
(test='MW', **kwargs)[source]¶ Run statistical test.
Args:
test (str) - name of test used, one of (‘KS’, ‘t’, ‘MW’)
Returns:
p (float) - p-value
is_greater_than (bool) - True if first population mean is greater
kwargs: keyword arguments for statistical test
-
property
is_greater_than
¶ True if first population mean is greater than the second.
-