unravel.cluster_stats.mean_IF_summary module#
Use cstats_mean_IF_summary (cmis) from UNRAVEL to plot and summarize mean IF intensities.
This script handles two input schemas:
- Cluster-only CSVs from
cstats_mean_IF: sample, cluster_ID, n_voxels, mean_intensity
- Cluster-region CSVs from
cstats_mean_IF -a atlas.nii.gz: sample, cluster_ID, region_ID, n_voxels, mean_intensity
- Outputs:
cluster_mean_IF_summary/cluster_<cluster_id>.pdf
cluster_region_mean_IF_summary/cluster_<cluster_id>_region_<region_id>.pdf
Summary CSV with t-test, Tukey, or Dunnett results
Note
The first word of each CSV filename is used as the group name. Example: Control_sample01_cFos_z.csv -> group = Control
If significant differences are found, a prefix ‘_’ is added to the plot filename.
Usage for cluster-only t-tests:#
cstats_mean_IF_summary –order Control Treatment –labels Control Treatment -t ttest [-v]
Usage for cluster-region Dunnett tests:#
- cstats_mean_IF_summary
–order Saline MBDB MDAI RMDMA SMDMA –labels Saline MBDB MDAI R-MDMA S-MDMA -t dunnett -alt greater [-c 1 2 3] [-r 101 102 103] [-v]
Usage with optional region LUT:#
- cstats_mean_IF_summary
–order Saline MBDB MDAI RMDMA SMDMA –labels Saline MBDB MDAI R-MDMA S-MDMA -t dunnett -l CCFv3-2020__regionID_side_IDpath_region_abbr.csv -v
- unravel.cluster_stats.mean_IF_summary.significance_label(p_value)[source]#
Return significance stars from a p-value.
- unravel.cluster_stats.mean_IF_summary.resolve_lut_path(lut)[source]#
Resolve LUT path from explicit path or unravel/core/csvs/.
- unravel.cluster_stats.mean_IF_summary.get_region_info(region_id, region_lut=None)[source]#
Return region name and abbreviation if available.
- unravel.cluster_stats.mean_IF_summary.load_all_data()[source]#
Load all CSVs once and add group names from filenames.
- unravel.cluster_stats.mean_IF_summary.perform_t_tests(df, order)[source]#
Perform pairwise t-tests between groups.
- unravel.cluster_stats.mean_IF_summary.perform_dunnett(df, order, alt)[source]#
Perform Dunnett’s tests comparing each non-control group to the first group in order.
- unravel.cluster_stats.mean_IF_summary.safe_col_name(text)[source]#
Make text safe for CSV column names.
- unravel.cluster_stats.mean_IF_summary.write_dunnett_wide_csv(test_df_all, output_folder, output_prefix, order)[source]#
Write a wide-format Dunnett summary CSV.
One row per cluster or cluster-region pair. Columns include group means, n values, treatment-control diffs, adjusted p-values, and significance labels.
- unravel.cluster_stats.mean_IF_summary.add_group_summary_columns(test_df, df)[source]#
Add n, means, and mean differences to the stats table.
- unravel.cluster_stats.mean_IF_summary.run_stats(df, order, test_type, alt)[source]#
Run the selected statistical test.
- unravel.cluster_stats.mean_IF_summary.prepare_plot_df(df, order, labels)[source]#
Apply group order and labels for plotting.
- unravel.cluster_stats.mean_IF_summary.add_significance_bars(ax, significant_comparisons, groups, y_min, y_max)[source]#
Add significance bars to the plot.
- unravel.cluster_stats.mean_IF_summary.get_pair_df(all_df, cluster_id, region_id=None)[source]#
Subset data for one cluster or cluster-region pair.
- unravel.cluster_stats.mean_IF_summary.summarize_pair(all_df, cluster_id, region_id=None, order=None, labels=None, test_type='tukey', alt='two-sided', region_lut=None)[source]#
Run stats for one cluster or cluster-region pair without plotting.