This project is a Python reimplementation of the gastric cancer single-cell RNA sequencing analysis pipeline based on the GSE163558 dataset, including TCGA data integration.
This is a comprehensive single-cell RNA sequencing analysis pipeline for studying the tumor microenvironment in gastric cancer (STAD - Stomach Adenocarcinoma). The project includes a complete workflow from raw data processing to advanced analysis, encompassing:
- Data quality control and preprocessing
- Batch effect correction (Harmony)
- Cell type annotation
- Malignant cell scoring
- Gene signature analysis
- Pseudotime analysis
- Survival analysis
- CNV (Copy Number Variation) analysis
- T cell subtype annotation
- Cell-cell communication analysis
- scRNA-seq data: GSE163558 (containing 10 samples: PT1-3, NT1, LN1-2, O1, P1, Li1-2)
- TCGA data: TCGA-STAD (gastric cancer bulk RNA-seq data for validation and survival analysis)
├── GSE163558_RAW/ # Raw 10X Genomics data
├── input/ # TCGA input data
├── python_pipeline/ # Python analysis pipeline
│ ├── scripts/ # Analysis step scripts
│ ├── config.py # Configuration parameters
│ ├── preprocessing.py # Data preprocessing
│ ├── clustering.py # Clustering analysis
│ ├── malignant_scoring.py # Malignant cell scoring
│ └── ...
├── python_outputs/ # Analysis results output
├── scRNA_scripts/ # R language auxiliary scripts
├── cache/ # Cache files and temporary data
└── step*.R # R language analysis steps
- Python 3.8+
- R 4.0+
- Conda environment management recommended
Main dependencies are listed in python_pipeline/requirements.txt:
pip install -r python_pipeline/requirements.txtRun install_packages.R to install required R packages.
Ensure raw data is located in the GSE163558_RAW/ directory and TCGA data in the input/ directory.
The project contains 12 main analysis steps that can be run sequentially:
# Navigate to Python pipeline directory
cd python_pipeline
# Step 1-2: Quality control and batch effect correction
python scripts/step01_qc_harmony.py
# Step 3: Cell type annotation
python scripts/step03_celltype.py
# Step 4: Feature visualization
python scripts/step04_featureplots.py
# Step 5: Cell proportion statistics
python scripts/step05_proportions.py
# Step 6: TCGA integration and malignant cell identification
python scripts/step06_tcga_malignant.py
# Step 7: Gene signature analysis
python scripts/step07_signatures.py
# Step 8: Pseudotime analysis
python scripts/step08_pseudotime.py
# Step 9: Survival analysis
python scripts/step09_survival.py
# Step 10: CNV analysis
python scripts/step10_cnv.py
# Step 11: T cell subtype analysis
python scripts/step11_tcells.py
# Step 12: Cell communication analysis
python scripts/step12_cell_communication.pyAll analysis results will be saved in the python_outputs/ directory, organized by step numbers:
1-QC/: Quality control results2-harmony/: Batch-corrected data3-celltype/: Cell type annotation results4-plot/: Visualization plots5-prop/: Cell proportion statistics6-malignant/: Malignant cell analysis7-signatures/: Gene signature analysis8-pseudotime/: Pseudotime analysis9-survival/: Survival analysis10-cnv/: CNV analysis11-tcells/: T cell subtype analysis12-cellchat/: Cell communication analysis
- Load 10X Genomics data
- Filter low-quality cells (genes < 300)
- Filter mitochondrial/ribosomal gene proportions
- Data normalization and HVG selection
- Harmony batch effect correction
- Initial annotation based on known marker genes
- Precise cell type identification using SingleR algorithm
- Comparison with TCGA bulk data
- Malignant cell identification based on gene expression profiles
- Calculation of malignancy scores
- Signatures: Immune, stem cell, cell cycle functional analysis
- Pseudotime: Cell differentiation trajectory reconstruction
- Survival: Prognosis analysis based on cell proportions and signatures
- CNV: Copy number variation detection
- T cell subtypes: Detailed CD4+/CD8+ T cell classification
- Cell communication: Ligand-receptor interaction analysis
*.h5ad: Single-cell data in AnnData format (scanpy standard)*.csv: Statistical results and marker gene lists*.png/*.pdf: Visualization plots and heatmapstimings/*.jsonl: Runtime records for each step
This project is based on the following public datasets and methods:
- GSE163558: Gastric cancer single-cell RNA sequencing data
- TCGA-STAD: Gastric cancer bulk RNA sequencing data
- Seurat/Signac: Original R implementation
- Scanpy: Python single-cell analysis framework
- Harmony: Batch effect correction
- InferCNV: CNV analysis
This project is for academic research purposes only. Please comply with relevant data usage agreements.
Please submit issues on GitHub if you have any questions.