campa.pl.get_intensity_change
- get_intensity_change(adata, groupby, marker_dict=None, limit_to_groups=None, reference=None, reference_group=None, color='logfoldchange', size='mean_reference', group_sizes_barplot=None, pval='ttest', alpha=0.05, norm_by_group=None)[source]
Get data for plotting intensity comparison with
plot_intensity_change().Calculate mean intensity differences between perturbations or clusters. If no reference is given, use all other groups (except the current one) as reference. Colours show log2-foldchange / mean intensity changes / z-score changes, depending on the
colorargument. Dot size shows mean intensity of reference group that is compared to, or indicates the p-value, depending on thesizeargument.- Parameters
adata (
AnnData) – Adata containing aggregated information by clusters. E.g. result ofFeatureExtractor.get_intensity_adata().groupby (
str) – column inadata.obscontaining the groups to compare.marker_dict (
Union[Mapping[str,Iterable[str]],Iterable[str],None]) – Limit/group vars that are shown, either by passing list or dict (adds annotations to plot).limit_to_groups (
Optional[Mapping[str,Union[str,List[str]]]]) – Dict with obs as keys and groups from obs as values, to subset adata before plotting.reference (
Union[List[str],str,None]) – Reference cluster/perturbation to compare to. If not defined, will compare each value ingroupbyagainst the rest.reference_group (
Optional[str]) – Obs entry that contains reference grouping (by default,groupbyis used).color (
str) – Colour of dots, either logfoldchange or meanchange.size (
str) – sizes of dots, either mean_reference or pval (distinguish significant and non-significant dots).group_sizes_barplot (
Optional[str]) – Mean size of groups shown as a bar plot to the right. Either None (do not show), mean (mean size of groups), meanchange (mean difference of group size from reference), foldchange.pval (
str) – Type of test done to determine p-values. Either ttest or mixed_model. mixed_model calculates a mixed model using wells as random effects and should be preferred. Note that when using norm_by_group, the mixed model will be calculated on the normalised values, which differs from the model used in the original publication.alpha (
float) –pvalthreshold above which dots are not shownnorm_by_group (
Optional[str]) – Divide all mean values by the mean values of this group. This is done separately for the reference and the values to compare to.
- Returns
data to input to
plot_intensity_change().- Return type
Mapping[str, Any]