Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Single-cell and single-nucleus molecular phenotype preprocessing

This mini-protocol performs cell-level snRNA-seq quality control and annotation, then prepares cell-type pseudobulk molecular phenotypes for QTL analysis.

Miniprotocol Timing

This is the total duration for one selected route; module-specific timings appear on their respective pages.

Timing: TBD

Overview

Single-cell and single-nucleus data require two distinct levels of processing. Cell-level processing filters low-quality cells, removes ambient RNA and doublets, and transfers cell-type labels. Pseudobulk processing then aggregates cells within each donor and cell type, harmonizes donor identifiers, adjusts technical covariates, and formats residualized traits for QTL analysis.

The first two steps use snRNAseq_preprocessing.ipynb. The remaining steps use pseudobulk_preprocessing.ipynb. Choose a route from the table rather than running every command automatically.

Steps

Analysis goalCommands to run, in orderInputs
Cell-level QC and reference-based annotation1 → 2input/snrnaseq/protocol_example.snrnaseq.cellranger/
tests/fixtures/snrnaseq_preprocessing/protocol_example.snrnaseq.id_mapping.csv
tests/fixtures/snrnaseq_preprocessing/protocol_example.snrnaseq.seurat_ref_SE.rds
Generate pseudobulk counts for a selected cell type from the annotated object1 → 2 → 3Inputs above
Prepare existing RNA pseudobulk counts for QTL analysis4 → 5 → 6tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.id_map.csv
tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.metadata_MIC.csv
tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.pseudobulk_counts_MIC.csv.gz
tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.tech_vars_MIC.csv
input/reference_data/Homo_sapiens.GRCh38.103.chr.reformatted.collapse_only.gene.ERCC.gtf
Format existing cell-type residuals for QTL analysis6 onlyA residual matrix under a cell-type directory and the gene-annotation GTF

The commands use MIC as the concrete example cell type. For another cell type, replace MIC consistently in the option value and associated input and output filenames.

Step 3 produces pseudobulk counts but not the metadata and technical-variable files required by steps 4 and 5. Continue with 4 → 5 → 6 only after those companion files are available.

1. Cell-level quality control

What it does: Filters cells, removes ambient RNA and doublets, and saves the filtered Seurat object plus a QC table.

2. Cell-type annotation

What it does: Transfers labels from the reference Seurat object to the filtered cells and writes a cell-typed Seurat object.

3. Pseudobulk count aggregation

What it does: Aggregates counts across cells of the selected type within each donor from the annotated Seurat object.

4. Sample-ID harmonization

What it does: Applies the donor-ID map to existing cell-type metadata and count matrices so their sample identifiers agree.

5. Pseudobulk quality control and residualization

What it does: Filters low-information features and samples, adjusts the specified technical variables, and writes cell-type residuals.

6. QTL phenotype formatting

What it does: Adds genomic coordinates to the residualized cell-type traits and writes a bgzipped phenotype BED for association testing.

Output

StepRelative pathContents
1output/snrna_seq/SCTK_results/protocol_example.snrnaseq.filtered_seuratobj.rdsFiltered and corrected Seurat object
1output/snrna_seq/QC_table/protocol_example.snrnaseq.SCTK_QC_table.csvPer-cell QC measurements and calls
2output/snrna_seq/protocol_example.snrnaseq.celltyped_seuratobj.rdsSeurat object with transferred cell-type labels
3output/snrna_seq/protocol_example.pseudobulk_counts_MIC.csv.gzDonor-by-feature cell-type pseudobulk counts
4tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.metadata_MIC.csvMetadata with harmonized donor IDs
4tests/fixtures/pseudobulk_preprocessing/protocol_example.snrnaseq.pseudobulk_counts_MIC.csv.gzCounts with harmonized donor IDs
5output/snrna_seq/protocol_example.MIC.residuals.txtQC-filtered and residualized cell-type traits
6output/snrna_seq/protocol_example.MIC.phenotype.bed.gzGenomically positioned cell-type molecular phenotypes for QTL testing

Anticipated Results

The cell-level route produces a filtered, cell-typed Seurat object suitable for downstream aggregation. The pseudobulk route produces one donor-level molecular phenotype matrix per cell type and, after residualization and coordinate formatting, a bgzipped BED suitable for the phenotype-preprocessing and QTL-association workflows.

Review cell counts, donor representation, QC exclusions, and residual distributions before association testing; pseudobulk estimates can be unstable when a donor contributes too few cells to a cell type.

Command Interface

Inspect all workflows, options, and defaults for the two modules: