Author: Geoff Dilly, PhD
ORCID: 0000-0002-6277-9932
Lab: Messing Lab, UT Austin
This repository provides a streamlined pipeline for analyzing 10x Chromium single-cell data using R and Seurat. The pipeline performs QC, clusters cells, identifies marker genes, and generates plots and CSV files in a recommended directory structure. This pipeline is intended for neuroscience research in the Messing Lab at UT Austin, and can be adapted for similar use.
install.sh: Bash script to generate the recommended file structure in a local directory.setup_env.sh: Bash script to make an Anaconda environment with the appropriate dependencies.sc_analysis_env.yaml: YAML containing Anaconda dependencies.R/: R scripts for data processing, clustering, cell identification, visualization, and DGE.run_pipeline.sh: Editable Bash script to run the R scripts in order.sc_experiment_config.yaml: YAML configuration file to set pipeline parameters.sc_sample_metadata.csv: Metadata CSV file for identifying and labeling samples.reference/marker_gene_db.csv: A CSV database of sets of marker genes for cluster analysis.
- Clone the repository:
git clone https://github.com/Geoff-Dilly/GD_scRNA_Pipeline cd <repo directory>
- Install file structure:
bash install.sh
- Set up Conda environment:
bash setup_env.sh conda activate sc_analysis_env
- Set up metadata and configuration:
- Edit
sc_experiment_config.yamlandsc_sample_metadata.csvas needed
- Edit
- Run the analysis pipeline:
bash run_pipeline.sh
- Examine outputs: View plots, results, and logs.
| Script | Description |
|---|---|
| install.sh | Generate the recommended file structure |
| setup_env.sh | Set up conda environment for analysis pipeline |
| run_pipeline.sh | Run the R scripts in order |
| Script | Description | Output |
|---|---|---|
| 01_load_data.R | Load sample data, metadata, run SoupX, and basic QC | Sample-level Seurat object |
| 02_doubletfinder.R | Run DoubletFinder on each sample | Sample-level Seurat object |
| 03_normalize_and_integrate.R | Integrate samples and normalize with scTransform | Experiment-level Seurat objects |
| 04_cluster_cells.R | Perform dimensional reduction and clustering analysis | Experiment-level Seurat object |
| 05_id_marker_genes.R | Identify marker genes by cluster | CSVs |
| 05b_rename_clusters.R | Optional: Add cell type names to metadata | Experiment-level Seurat object |
| 06_make_plots.R | Makes various plots | PDF plots |
| 07_dge_1var.R | Differential gene expression analysis (1 variable: Treatment) | CSVs and PDF plots |
raw_data/— Raw input files (10x count matrices)r_data/— RDS files of Seurat objectsplots/— Output figures and QC plotscsv_results/- CSVs of cell counts, markers, and DGE resultslogs/— Run logs and script backupsR/— R scripts
- Metadata is a CSV that must contain four required columns: Sample_name, Sex, Treatment, Raw_data_dir
- Raw_data_dir should direct to the Cell Ranger
outs/folder containingfiltered_feature_bc_matrix/ - Additional columns are automatically read into the Seurat object as sample-level metadata
Example:
| Sample_name | Sex | Treatment | Age | Raw_data_dir |
|---|---|---|---|---|
| Subject_1 | M | Drug | 24 | "raw_data/Subject_1/outs" |
| Subject_2 | F | Ctrl | 27 | "raw_data/Subject_2/outs" |
| Subject_3 | M | Ctrl | 27 | "raw_data/Subject_3/outs" |
| Subject_4 | F | Drug | 26 | "raw_data/Subject_4/outs" |
Saved as a CSV:
Sample_name,Sex,Treatment,Age,Raw_data_dir
Subject_1,M,Drug,24,"raw_data/Subject_1/outs"
Subject_2,F,Ctrl,27,"raw_data/Subject_2/outs"
Subject_3,M,Ctrl,27,"raw_data/Subject_3/outs"
Subject_4,F,Drug,26,"raw_data/Subject_4/outs"
- Marker genes can be stored in a CSV database in
references/marker_gene_db.csv - A reference from this database will be used for cell-identification plots
- Default marker genes (major brain cell types) come from Dilly et al. (2022)
- Custom references can be added
- The reference that will be plotted can be set with
scConfig$marker_gene_reference
Example:
| gene | cell_type | cell_class | brain_region | tissue | species | reference |
|---|---|---|---|---|---|---|
| Mbp | Oligodendrocytes | NonNeuronal | CeA | Brain | Rat | Dilly_et_al_2022 |
| Mobp | Oligodendrocytes | NonNeuronal | CeA | Brain | Rat | Dilly_et_al_2022 |
| Plp1 | Oligodendrocytes | NonNeuronal | CeA | Brain | Rat | Dilly_et_al_2022 |
| Gad1 | GABA_Neurons | Neuronal | CeA | Brain | Rat | Dilly_et_al_2022 |
| Gad2 | Oligodendrocytes | Neuronal | CeA | Brain | Rat | Dilly_et_al_2022 |
- R = 4.3.3
- Seurat ≥ 5.0
- Anaconda
- See
sc_analysis_env.yamlfor dependencies
This repository is maintained for experiments in the Messing Lab at UT Austin.