Loading...
Loading...
Compare original and translation side by side
references/references/tooluniverse-phylogeneticstooluniverse-rnaseq-deseq2tooluniverse-single-celltooluniverse-statistical-modelingtooluniverse-phylogeneticstooluniverse-rnaseq-deseq2tooluniverse-single-celltooluniverse-statistical-modelingundefinedundefined
**Installation**:
```bash
pip install pandas numpy scipy statsmodels patsy scikit-image opencv-python-headless tifffile
**安装命令**:
```bash
pip install pandas numpy scipy statsmodels patsy scikit-image opencv-python-headless tifffileSTART: User question about microscopy data
│
├─ Q1: What type of data is available?
│ │
│ ├─ PRE-QUANTIFIED DATA (CSV/TSV with measurements)
│ │ └─ Workflow: Load → Parse question → Statistical analysis
│ │ Pattern: Most common BixBench pattern (bix-18, bix-19, bix-41, bix-54)
│ │ See: Section "Quantitative Data Analysis" below
│ │
│ └─ RAW IMAGES (TIFF, PNG, multi-channel)
│ └─ Workflow: Load → Segment → Measure → Analyze
│ See: references/image_processing.md
│
├─ Q2: What type of analysis is needed?
│ │
│ ├─ STATISTICAL COMPARISON
│ │ ├─ Two groups → t-test or Mann-Whitney
│ │ ├─ Multiple groups → ANOVA or Dunnett's test
│ │ ├─ Two factors → Two-way ANOVA
│ │ └─ Effect size → Cohen's d, power analysis
│ │ See: references/statistical_analysis.md
│ │
│ ├─ REGRESSION MODELING
│ │ ├─ Dose-response → Polynomial (quadratic, cubic)
│ │ ├─ Ratio optimization → Natural spline
│ │ └─ Model comparison → R-squared, F-statistic, AIC/BIC
│ │ See: references/statistical_analysis.md
│ │
│ ├─ CELL COUNTING
│ │ ├─ Fluorescence (DAPI, NeuN) → Threshold + watershed
│ │ ├─ Brightfield → Adaptive threshold
│ │ └─ High-density → CellPose or StarDist (external)
│ │ See: references/cell_counting.md
│ │
│ ├─ COLONY SEGMENTATION
│ │ ├─ Swarming assays → Otsu threshold + morphology
│ │ ├─ Biofilms → Li threshold + fill holes
│ │ └─ Growth assays → Time-lapse tracking
│ │ See: references/segmentation.md
│ │
│ └─ FLUORESCENCE QUANTIFICATION
│ ├─ Intensity measurement → regionprops
│ ├─ Colocalization → Pearson/Manders
│ └─ Multi-channel → Channel-wise quantification
│ See: references/fluorescence_analysis.md
│
└─ Q3: When to use scikit-image vs OpenCV?
├─ scikit-image: Scientific analysis, measurements, regionprops
├─ OpenCV: Fast processing, real-time, large batches
└─ Both: Often interchangeable for basic operations
See: references/image_processing.md "Library Selection Guide"开始:用户询问显微镜数据相关问题
│
├─ 问题1:可用数据类型是什么?
│ │
│ ├─ 预量化数据(含测量值的CSV/TSV)
│ │ └─ 工作流:加载 → 解析问题 → 统计分析
│ │ 模式:最常见的BixBench模式(bix-18、bix-19、bix-41、bix-54)
│ │ 参考:下文“定量数据分析”章节
│ │
│ └─ 原始图像(TIFF、PNG、多通道)
│ └─ 工作流:加载 → 分割 → 测量 → 分析
│ 参考:references/image_processing.md
│
├─ 问题2:需要何种类型的分析?
│ │
│ ├─ 统计对比
│ │ ├─ 两组对比 → t检验或Mann-Whitney检验
│ │ ├─ 多组对比 → ANOVA或Dunnett检验
│ │ ├─ 双因素 → 双因素ANOVA
│ │ └─ 效应量 → Cohen's d、功效分析
│ │ 参考:references/statistical_analysis.md
│ │
│ ├─ 回归建模
│ │ ├─ 剂量反应 → 多项式(二次、三次)
│ │ ├─ 比例优化 → 自然样条
│ │ └─ 模型对比 → R平方、F统计量、AIC/BIC
│ │ 参考:references/statistical_analysis.md
│ │
│ ├─ 细胞计数
│ │ ├─ 荧光(DAPI、NeuN) → 阈值 + 分水岭算法
│ │ ├─ 明场 → 自适应阈值
│ │ └─ 高密度 → CellPose或StarDist(外部工具)
│ │ 参考:references/cell_counting.md
│ │
│ ├─ 菌落分割
│ │ ├─ 扩散实验 → Otsu阈值 + 形态学操作
│ │ ├─ 生物膜 → Li阈值 + 孔洞填充
│ │ └─ 生长实验 → 延时追踪
│ │ 参考:references/segmentation.md
│ │
│ └─ 荧光定量
│ ├─ 强度测量 → regionprops
│ ├─ 共定位 → Pearson/Manders系数
│ └─ 多通道 → 分通道定量
│ 参考:references/fluorescence_analysis.md
│
└─ 问题3:何时使用scikit-image vs OpenCV?
├─ scikit-image:科学分析、测量、regionprops
├─ OpenCV:快速处理、实时分析、大批次数据
└─ 两者均可:基础操作通常可互换
参考:references/image_processing.md中的“库选择指南”import os, glob, pandas as pdimport os, glob, pandas as pd
**Common Column Names**:
- Area: Colony or cell area in pixels or calibrated units
- Circularity: 4*pi*area/perimeter^2, range [0,1], 1.0 = perfect circle
- Round: Roundness = 4*area/(pi*major_axis^2)
- Genotype/Strain: Biological grouping variable
- Ratio: Co-culture mixing ratio (e.g., "1:3", "5:1")
- NeuN/DAPI/GFP: Cell marker counts or intensities
**常见列名**:
- Area:菌落或细胞的面积(像素或校准单位)
- Circularity:4*pi*面积/周长²,范围[0,1],1.0表示完美圆形
- Round:圆度 = 4*面积/(pi*长轴²)
- Genotype/Strain:生物分组变量
- Ratio:共培养混合比例(如"1:3"、"5:1")
- NeuN/DAPI/GFP:细胞标记物计数或强度def grouped_summary(df, group_cols, measure_col):
"""Calculate summary statistics by group."""
summary = df.groupby(group_cols)[measure_col].agg(
Mean='mean',
SD='std',
Median='median',
Min='min',
Max='max',
N='count'
).reset_index()
summary['SEM'] = summary['SD'] / np.sqrt(summary['N'])
return summarydef grouped_summary(df, group_cols, measure_col):
"""按分组计算汇总统计量。"""
summary = df.groupby(group_cols)[measure_col].agg(
Mean='mean',
SD='std',
Median='median',
Min='min',
Max='max',
N='count'
).reset_index()
summary['SEM'] = summary['SD'] / np.sqrt(summary['N'])
return summary
For detailed statistical functions, see: **references/statistical_analysis.md**
详细统计函数请参考:**references/statistical_analysis.md**undefinedundefinedundefinedundefined| Cell Type | Density | Best Method | Notes |
|---|---|---|---|
| Nuclei (DAPI) | Low-Medium | Otsu + watershed | Standard approach |
| Nuclei (DAPI) | High | CellPose/StarDist | Handles touching |
| Colonies | Well-separated | Otsu threshold | Fast, reliable |
| Colonies | Touching | Watershed | Edge detection |
| Cells (phase) | Any | Adaptive threshold | Handles uneven illumination |
| Fluorescence | Low signal | Li threshold | More sensitive |
| 细胞类型 | 密度 | 最佳方法 | 说明 |
|---|---|---|---|
| 细胞核(DAPI) | 中低密度 | Otsu阈值 + 分水岭算法 | 标准方法 |
| 细胞核(DAPI) | 高密度 | CellPose/StarDist | 处理重叠细胞 |
| 菌落 | 分离良好 | Otsu阈值 | 快速可靠 |
| 菌落 | 相互接触 | 分水岭算法 | 边缘检测 |
| 细胞(相差) | 任意密度 | 自适应阈值 | 处理不均匀光照 |
| 荧光 | 低信号 | Li阈值 | 灵敏度更高 |
| Task | Primary Tool | Reference |
|---|---|---|
| Load measurement CSV | pandas.read_csv() | This file |
| Group statistics | df.groupby().agg() | This file |
| T-test | scipy.stats.ttest_ind() | statistical_analysis.md |
| ANOVA | statsmodels.ols + anova_lm() | statistical_analysis.md |
| Dunnett's test | scipy.stats.dunnett() | statistical_analysis.md |
| Cohen's d | Custom function (pooled SD) | statistical_analysis.md |
| Power analysis | statsmodels TTestIndPower | statistical_analysis.md |
| Polynomial regression | statsmodels.OLS + poly features | statistical_analysis.md |
| Natural spline | patsy.cr() + statsmodels.OLS | statistical_analysis.md |
| Cell segmentation | skimage.filters + watershed | cell_counting.md |
| Colony segmentation | skimage.filters.threshold_otsu | segmentation.md |
| Fluorescence quantification | skimage.measure.regionprops | fluorescence_analysis.md |
| Colocalization | Pearson/Manders | fluorescence_analysis.md |
| Image loading | tifffile, skimage.io | image_processing.md |
| Batch processing | scripts/batch_process.py | scripts/ |
| 任务 | 主要工具 | 参考文档 |
|---|---|---|
| 加载测量CSV | pandas.read_csv() | 本文档 |
| 分组统计 | df.groupby().agg() | 本文档 |
| t检验 | scipy.stats.ttest_ind() | statistical_analysis.md |
| ANOVA | statsmodels.ols + anova_lm() | statistical_analysis.md |
| Dunnett检验 | scipy.stats.dunnett() | statistical_analysis.md |
| Cohen's d | 自定义函数(合并标准差) | statistical_analysis.md |
| 功效分析 | statsmodels TTestIndPower | statistical_analysis.md |
| 多项式回归 | statsmodels.OLS + 多项式特征 | statistical_analysis.md |
| 自然样条 | patsy.cr() + statsmodels.OLS | statistical_analysis.md |
| 细胞分割 | skimage.filters + 分水岭算法 | cell_counting.md |
| 菌落分割 | skimage.filters.threshold_otsu | segmentation.md |
| 荧光定量 | skimage.measure.regionprops | fluorescence_analysis.md |
| 共定位 | Pearson/Manders系数 | fluorescence_analysis.md |
| 图像加载 | tifffile, skimage.io | image_processing.md |
| 批量处理 | scripts/batch_process.py | scripts/ |
scripts/undefinedscripts/undefined
---
---multcomp::glhtscipy.stats.dunnett()ns(x, df=4)patsy.cr(x, knots=...)t.test()scipy.stats.ttest_ind()aov()statsmodels.formula.api.ols()sm.stats.anova_lm()multcomp::glhtscipy.stats.dunnett()ns(x, df=4)patsy.cr(x, knots=...)t.test()scipy.stats.ttest_ind()aov()statsmodels.formula.api.ols()sm.stats.anova_lm()int(round(val, -3))int(round(val, -3))