# 快速入门

## 0. 测试信息

### 测试数据：

```
./Test_data
```

### 测试脚本：

```
./Scripts/quick_start
```

## 1. 获取SAW输出的文件

方式一：直接下载`SAW count`输出的h5ad文件

方式二：从gef转h5ad：`saw convert gef2h5ad --gef=sample.tissue.gef --bin-size=100 --h5ad=sample.h5ad`

方式三：直接下载`SAW aggr(alpha ver.)`输出的h5mu文件

## 2. 细胞类型注释

**cell2locationMakeRef 构建单细胞参考数据**

```bash
SDAS cellAnnotation cell2locationMakeRef --reference ../Test_data/single_slice/sample_ref.h5ad -o ../output/cellAnnotation_cell2location_ref --label_key annotation2 --filter_rare_cell 0 --cell_percentage_cutoff2 0.05 --nonz_mean_cutoff 1.45 --gpu_id 0
```

**cell2location**&#x20;

```bash
SDAS cellAnnotation cell2location -i ../Test_data/single_slice/sample.h5ad -o ../output/cell2location --reference_csv ../output/cellAnnotation_cell2location_ref/sample_ref_inf_aver.csv --input_gene_symbol_key _index --bin_size 100 --gpu_id 0
```

**RCTD**

```bash
SDAS cellAnnotation rctd -i ../Test_data/single_slice/sample.h5ad -o ../output/cellAnnotation_rctd --reference ../Test_data/single_slice/sample_ref.h5ad --label_key annotation2 --input_gene_symbol_key _index --filter_rare_cell 0 --bin_size 100
```

## 3. 空间结构域识别

**graphST**

```bash
SDAS spatialDomain graphst -i ../Test_data/single_slice/sample.h5ad -o ../output/spatialDomain_graphST --gpu_id 0 --tool mclust --n_clusters 10 --n_hvg 3000 --bin_size 100
```

## 4. 细胞邻域分析

```bash
SDAS cellularNeighborhood singleCelltype -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/cellularNeighborhood_singleCelltype --bin_size 100 --label_key anno_rctd
```

## 5. CNV分析

**使用细胞注释后的h5ad，准备rds文件：**

```bash
SDAS dataProcess h5ad2rds -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/cellAnnotation_rctd
```

**运行inferCNV**

```bash
SDAS infercnv -i ../output/cellAnnotation_rctd/sample_anno_rctd.rds --h5ad ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/infercnv --bin_size 100 --label_key anno_rctd --gene_symbol_key _index --species human --cutoff 0.02 --ref_group_names Mac_SPP1,Monocyte_S100A8,Plasma_IgG,CD8_Tem
```

## 6. 空间基因共表达分析

**hdWGCNA**

```bash
SDAS coexpress hdwgcna -i ../Test_data/single_slice/sample.h5ad -o ../output/coexpress_hdwgcna --bin_size 100 --selected_genes top5000
```

## 7. 差异基因分析

**wilcoxon**

```bash
SDAS DEG -i ../output/spatialDomain_graphST/sample_domain_graphst.h5ad -o ../output/DEG_wilcoxon --de_method wilcoxon --group_key domain_graphst --ident1 3 --ident2 8
```

## 8. 基因集富集分析

**GSEA**

```bash
SDAS geneSetEnrichment gsea -i ../output/spatialDomain_graphST/sample_domain_graphst.h5ad -o ../output/geneSetEnrichment_gsea --species human --group_key domain_graphst --ident1 3 --ident2 8 --gmt sdas_deg_enrichment/lib/GSEADB/h.all.v2024.1.Hs.symbols.gmt
```

**Enrichr**

```bash
SDAS geneSetEnrichment enrichr -i ../output/DEG_wilcoxon/de_wilcoxon.domain_graphst.3-vs-8.sig_filtered.csv -o ../output/geneSetEnrichment_enrichr --species human --cut_off 0.05
```

## 9. 蛋白相互作用

```bash
SDAS PPI -i ../Test_data/PPI/gene_300.txt -o ../output/PPI --species human --cluster GN
```

## 10. 细胞通讯分析

**cellchat**

```bash
SDAS CCI cellchat -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/CCI_cellchat_nospatial --label_key anno_rctd --gene_symbol_key _index --species human --type truncatedMean
```

## 11. 轨迹分析

**使用注释后的h5ad，准备rds文件：**

```bash
SDAS dataProcess h5ad2rds -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/cellAnnotation_rctd
```

**运行monocle3：**

```bash
SDAS trajectory monocle3 -i ../output/cellAnnotation_rctd/sample_anno_rctd.rds -o ../output/trajectory_monocle3 --gene_symbol_key _index --root_key anno_rctd --root CAF_CXCL14
```

## 12. 转录因子分析

```bash
SDAS TF -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/TF --label_key anno_rctd --gene_symbol_key _index --species human
```

## 13. 空间关系分析

**squidpy**

```bash
SDAS spatialRelate squidpy -i ../output/cellAnnotation_rctd/sample_anno_rctd.h5ad -o ../output/spatialRelate_squidpy --label_key anno_rctd --bin_size 100 --min_cells_per_type 3 --coord_type grid 
```

## 14. 公共数据验证

**immuneScore**

```bash
SDAS bulkValidate immuneScore --expression ../Test_data/bulkValidate/fpkm.txt --clinical ../Test_data/bulkValidate/clinical.txt -o ../output/bulkValidate_immuneScore --group_col tissue_type.samples --group_type discrete
```

**survivalKM**

```bash
SDAS bulkValidate survivalKM --input ../output/bulkValidate_immuneScore/tme_combine.txt --clinical ../Test_data/bulkValidate/clinical.txt -o ../output/bulkValidate_survivalKM --signature Macrophages_M2_CIBERSORT --project_name survival --time OS.time --status OS.status --time_type day
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mysite.gitbook.io/sdas_manual_cn/readme/03_quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
