数据再分析

本教程将将展示如何运行辅助分析流程 SAW reanalyze,进行

聚类分析

在生信下游分析中,聚类是一种关键且基本的算法处理,可将具有相似特征的空间表达点归为同组,该过程有助于揭示表达数据中的底层结构和模式。

在进行分析前,需要根据数据的物种和组织类型来选择合适的 bin size 例如,哺乳动物细胞的直径约为 10 µm,DNB 的物理间距为 500 nm,因此 bin20 会是一个合适的选择。

调用 Leiden 算法 进行聚类时,--Leiden-resolution 参数的默认值为 1.0,它可以调控 Leiden 聚类时的分群颗粒度,值越大,分群簇越多。并且,可以开启 --marker 参数,基于 Leiden 算法的分群结果进行差异表达分析。

如果使用 bin GEF 进行聚类,运行命令如下:

saw reanalyze cluster \
    --gef=/path/to/input/GEF \
    --bin-size=20 \
    --Leiden-resolution=1.0 \
    --marker \
    --output=/path/to/output/clustering

基于 bin GEF 的聚类输出如下:

clustering
├── <SN>.bin20_1.0.h5ad  ##<SN>.<bin_size>_<resolution>.h5ad, containing analysis results
├── find_marker_genes.csv  ##original output CSV
└── bin20_marker_features.csv  ##formatted CSV for visualization in StereoMap

在运行分析时开启 --marker ,将获得与差异表达分析相关的结果,即 find_marker_genes.csv<bin_size>_marker_features.csv

  • find_marker_genes.csv 是原始差异分析结果文件。
  • <bin_size>_marker_features.csv 是一个经过格式调整CSV,记录了每个类群的平均 MID count、L2FC、校正后的 p-value 和基因在类群内的表达占比等。

如果使用 cellbin GEF 进行聚类,运行命令如下:

saw reanalyze cluster \
    --cellbin-gef=/path/to/input/cellbin/GEF \
    --Leiden-resolution=1.0 \
    --marker \
    --output=/path/to/output/clustering

基于 cellbin GEF 的聚类输出如下:

clustering
├── <SN>.cellbin.gef  ##a copy of input cellbin GEF but with new clustering information
├── <SN>.cellbin_1.0.h5ad  ##<SN>.cellbin_<resolution>.h5ad, containing analysis results
├── find_marker_genes.csv  ##original output CSV
└── cellbin_marker_features.csv  ##formatted CSV for visualization in StereoMap

矩阵套索

StereoMap 中的交互式工具可以 lasso (手动圈选)感兴趣区域,它需要 SAW reanalyze 分析流程来协助将 lasso GeoJSON 中区域信息转化为特征表达矩阵。

如果使用 bin GEF 进行 lasso,运行分析如下:

saw reanalyze lasso \
    --gef=/path/to/input/GEF \
    --lasso-geojson=/path/to/lasso/GeoJSON \
    --bin-size=1,20,50 \
    --output=/path/to/output/lasso

--bin-size 参数可以接收一个列表,以便一次生成多个 bin size 的表达矩阵文件。

基于 bin GEF 的 lasso 输出如下:

lasso
├── <label1>
│       ├── SN.<label1>.label.gef  ##lasso GEF of bin1
│       └── segmentation
│              ├── SN.lasso.<bin_size_list[0]>.<label1>.gem.gz  ##GEM of lasso area of different bin sizes
│              ...
│              ├── SN.lasso.<bin_size_list[n]>.<label1>.gem.gz
│              └── SN.lasso.<label1>.mask.tif  ##mask image of lasso area
└── <label2>
       ├── ...
       └── ...

如果使用 cellbin GEF 进行 lasso,运行分析如下:

saw reanalyze lasso \
    --cellbin-gef=/path/to/input/cellbin/GEF \
    --lasso-geojson=/path/to/lasso/GeoJSON \
    --output=/path/to/output/lasso

基于 cellbin GEF 的 lasso 输出如下:

lasso
├── <label1>
│       └── SN.<label1>.label.cellbin.gef  ##cellbin GEF of lasso area
└── <label2>
        └── ...

差异表达分析

SAW reanalyze 可以使用来自 StereoMapdiffexp GeoJSON 文件,基于聚类类群选择和套索区域进行差异表达分析。

选定的聚类类群和套索区域被记录在 diffexp GeoJSON 文件中。

运行分析如下:

saw reanalyze diffExp \
    --count-data=/path/to/previous/SAW/count/result/folder/id \
    --diffexp-geojson=/path/to/StereoMap/diffexp/GeoJSON \
    --output=/path/to/output/differential_expression

--count-data 是相关联的SAW count 分析任务的输出目录,SAW reanalyze 将自动搜索差异表达分析所需的数据文件。相关信息记录在 *.diffexp.geojson 中。

差异表达分析输出如下:

differential_expression
├── <SN>.<bin_size>_1.0.h5ad  ##H5ad containing analysis results
├── find_marker_genes.csv  ##original output CSV
└── <bin_size>_marker_features.csv  ##formatted CSV for visualization in StereoMap

或:

differential_expression
├── <SN>.cellbin_1.0.h5ad  ##H5ad for cellbin containing analysis results
├── find_marker_genes.csv  ##original output CSV
└── cellbin_marker_features.csv  ##formatted CSV for visualization in StereoMap

蛋白组&转录组联合分析

SAW multiomics 可以整合RNA和蛋白质数据,并通过 TotalVI 变分推断计算潜在空间。对潜在空间进行聚类分析,并进行 one-vs-all 差异表达分析,以找到标记基因和蛋白质。

您可以使用基因和蛋白 bin GEF进行联合分析,运行分析如下:

saw reanalyze multiomics \
    --gef=/path/to/input/gene/GEF,/path/to/input/protein/GEF \
    --protein-panel=/path/to/ProteinPanel.list \
    --bin-size=50 \
    --output=/path/to/output/joint_analysis

或使用基因和蛋白 cellbin GEF进行联合分析:

saw reanalyze multiomics \
    --cellbin-gef=/path/to/input/gene/cellbin/GEF,/path/to/input/protein/cellbin/GEF \
    --protein-panel=/path/to/ProteinPanel.list \
    --output=/path/to/output/joint_analysis

--gpu-id <NUM> 可加速计算。

请确保找到样本在 SAW count 使用过的蛋白列表。您也可以使用 --ref-libraries <CSV> 代替 --protein-panel <PANEL>

联合分析输出如下:

joint_analysis
├── <SN>.<bin_size>.differential_expression.csv ##original outoput CSV containing differential expression results
└── <SN>.<bin_size>.h5mu ##mutimodal data containing clustering results

或:

joint_analysis
├── <SN>.cellbin.differential_expression.csv ##original outoput CSV containing differential expression results
└── <SN>.cellbin.h5mu ##mutimodal data containing clustering results

基于自定义MID范围过滤矩阵

StereoMap 中的交互式工具可以手动设置 feature 的 MID 范围。

saw reanalyze midFilter \
    --gef=/path/to/input/GEF \
    --mid-json=/path/to/FilterMID.json \
    --output=/path/to/output/mid_filtering

输出如下:

mid_filtering
└── <SN>.filter.gef ##common GEF filtered by MID range

或:

mid_filtering
└── <SN>.protein.filter.gef ##protein GEF filtered by MID range

自动去除蛋白背景信号

一种自动去除非特异性结合蛋白信号的方法。算法细节请查阅 Proteome background removal

saw reanalyze removeBackground \
    --gef=/path/to/output/input/protein/GEF \
    --bin-size=50 \
    --protein-panel=/path/to/ProteinPanel.list \
    --output=/path/to/output/removeBackground

请确保找到样本在 SAW count 使用过的蛋白列表。您也可以使用 --ref-libraries <CSV> 代替 --protein-panel <PANEL>

基于蛋白 bin GEF 的输出如下:

removeBackground
└── A03684D4.protein.tissue.rmbg.gem.gz ##protein expression matrix after backgrou
© 2025 STOmics Tech. All rights reserved.Modified: 2025-03-07 10:28:04

results matching ""

    No results matching ""