Load, prepare, and apply quality control (QC) to single-cell RNA-seq data using Seurat. Performs data loading, QC filtering, normalization, and multi-sample integration...
Load, prepare, and apply quality control (QC) to single-cell RNA-seq data using Seurat. Performs data loading, QC filtering, normalization, and multi-sample integration. This is a core preprocessing process that prepares Seurat objects for downstream clustering and analysis.
LoadingRNAFromSeurat process)SampleInfo metafile (RNAData column)SampleInfo (provides metadata) OR LoadingRNAFromSeurat (provides prepared Seurat object)SeuratClustering, SeuratClusteringOfAllCells, TOrBCellSelection[SeuratPreparing]
cache = true # Enable caching to speed up re-runs
[SeuratPreparing.in]
# metafile is required unless LoadingRNAFromSeurat is used
metafile = ["path/to/sample_info.txt"]
metafile format (tab-delimited):
Sample: Unique sample identifier (required)RNAData: Path to scRNA-seq data (required)Seurat::Read10X_h5()SeuratDisk::LoadLoom()[SeuratPreparing.envs]
# Core processing parameters
ncores = 1 # Parallelization cores
mutaters = {} # Add custom metadata columns
min_cells = 0 # Minimum cells per gene (CreateSeuratObject)
min_features = 0 # Minimum features per cell (CreateSeuratObject)
# Quality control
cell_qc = "" # Cell filtering expression (R syntax)
gene_qc = { min_cells = 0 } # Gene filtering options
# QC plots generation
qc_plots = {} # Visualization configuration
# Normalization method selection
use_sct = false # Use SCTransform instead of NormalizeData pipeline
no_integration = false # Skip sample integration
# Doublet detection
doublet_detector = "none" # Options: none, DoubletFinder, scDblFinder
# Caching
cache = "/tmp" # Cache intermediate results
Standard Workflow (use_sct = false):
NormalizeData - Log-normalization of UMI counts
[SeuratPreparing.envs.NormalizeData]
normalization-method = "LogNormalize" # Options: LogNormalize, CLR, RC
scale-factor = 10000 # Normalization scaling factor
margin = 1 # Normalize across features (1) or cells (2)
verbose = true
FindVariableFeatures - Identify highly variable genes
[SeuratPreparing.envs.FindVariableFeatures]
selection-method = "vst" # Options: vst, mean.var.plot, disp
nfeatures = 2000 # Number of variable features to select
verbose = true
ScaleData - Center and scale gene expression
[SeuratPreparing.envs.ScaleData]
vars.to.regress = [] # Variables to regress out (e.g., ["percent.mt"])
model.use = "linear" # Regression model
verbose = true
RunPCA - Principal component analysis
[SeuratPreparing.envs.RunPCA]
npcs = 50 # Number of principal components
verbose = true
rev.pca = false # Reverse PCA direction
weight.by.var = true # Weight by variance
npcs limited by: number of columns - 1 per sampleSCTransform Workflow (use_sct = true):
5. SCTransform - Variance-stabilizing transformation (replaces standard pipeline)
[SeuratPreparing.envs.SCTransform]
assay = "RNA" # Input assay
new.assay.name = "SCT" # Output assay name
return-only-var-genes = true # Keep only variable genes
min_cells = 3 # Minimum cells per gene (hidden param)
variable.features.n = 3000 # Number of variable features
variable.features.rv.th = 1.3 # Residual variance threshold
vars.to.regress = [] # Variables to regress out
do.correct.umi = true # Correct for UMI counts
ncells = 5000 # Subsample for model fitting
do.scale = false # Scale after transformation
do.center = true # Center after transformation
clip.range = [-10, 10] # Clip residual values
vst.flavor = "v2" # VST algorithm version
conserve.memory = false # Memory-efficient mode
seed.use = 1448145 # Random seed
verbose = true
min_cells = 0 and return-only-var-genes = falseIntegrateLayers - Multi-sample batch correction
[SeuratPreparing.envs.IntegrateLayers]
method = "harmony" # Integration method
orig.reduction = "pca" # Base reduction for correction
assay = null # Assay to integrate (auto-detected)
features = null # Features for integration
layers = null # Layers to integrate
scale.layer = "scale.data" # Scaled layer name
DoubletFinder - Simulation-based doublet detection
[SeuratPreparing.envs.DoubletFinder]
PCs = 10 # Number of PCs to use
doublets = 0.075 # Expected doublet rate (7.5%)
pN = 0.25 # Doublet simulation proportion (25%)
ncores = 1 # Cores for paramSweep (null = use envs.ncores)
pK = 0.005 # Expected doublet rate parameter
reduction = "pca" # Reduction to use
ncores smaller than envs.ncores if memory issues occurscDblFinder - Machine learning-based doublet detection
[SeuratPreparing.envs.scDblFinder]
dbr = 0.075 # Expected doublet rate (7.5%)
ncores = 1 # Cores for scDblFinder (null = use envs.ncores)
dbr.per1k = 0.8 # Doublets per 1000 cells
verbose = true
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
cell_qc = "nFeature_RNA > 200 & percent.mt < 5"
gene_qc = { min_cells = 3 }
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
ncores = 4
use_sct = true
# QC filtering
cell_qc = "nFeature_RNA > 200 & percent.mt < 5"
gene_qc = { min_cells = 3 }
# SCTransform parameters
[SeuratPreparing.envs.SCTransform]
vars.to.regress = ["percent.mt", "percent.ribo"]
variable.features.n = 3000
# Harmony integration
[SeuratPreparing.envs.IntegrateLayers]
method = "harmony"
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
use_sct = false
ncores = 8
# Standard normalization workflow
[SeuratPreparing.envs.NormalizeData]
normalization-method = "LogNormalize"
scale-factor = 10000
[SeuratPreparing.envs.FindVariableFeatures]
selection-method = "vst"
nfeatures = 3000
[SeuratPreparing.envs.ScaleData]
vars.to.regress = ["percent.mt", "S.Score", "G2M.Score"]
# RPCA integration (faster, conservative)
[SeuratPreparing.envs.IntegrateLayers]
method = "rpca"
orig.reduction = "pca"
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
use_sct = true
doublet_detector = "DoubletFinder"
[SeuratPreparing.envs.DoubletFinder]
PCs = 30
doublets = 0.05
pN = 0.25
ncores = 4
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
use_sct = true
doublet_detector = "scDblFinder"
[SeuratPreparing.envs.scDblFinder]
dbr = 0.05
ncores = 4
[SeuratPreparing.envs]
cell_qc = { DEFAULT = "nFeature_RNA > 200 & percent.mt < 5",
Sample1 = "nFeature_RNA > 300 & percent.mt < 10",
Sample2 = "nFeature_RNA > 150 & percent.mt < 5" }
[SeuratPreparing.envs.qc_plots]
# Violin plots for QC metrics
[SeuratPreparing.envs.qc_plots."QC Violin Plots"]
kind = "cell"
plot_type = "violin"
devpars = { res = 100, height = 600, width = 1200 }
# Scatter plots
[SeuratPreparing.envs.qc_plots."QC Scatter Plots"]
kind = "cell"
plot_type = "scatter"
devpars = { res = 100, height = 800, width = 1200 }
# Gene expression distribution
[SeuratPreparing.envs.qc_plots."Gene Expression Distribution"]
kind = "gene"
plot_type = "histogram"
devpars = { res = 100, height = 1200, width = 1200 }
# Use when analyzing one sample or already batch-corrected data
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["single_sample_info.txt"]
[SeuratPreparing.envs]
no_integration = true # Skip integration step
use_sct = true
cell_qc = "nFeature_RNA > 200 & percent.mt < 5"
gene_qc = { min_cells = 3 }
# Use for multi-batch data with complex batch structures
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["multi_sample_info.txt"]
[SeuratPreparing.envs]
use_sct = true
ncores = 8
# Cell QC
cell_qc = "nFeature_RNA > 200 & nCount_RNA > 500 & percent.mt < 10"
gene_qc = { min_cells = 3, excludes = ["MALAT1", "MT-ND3"] }
# SCTransform with regression
[SeuratPreparing.envs.SCTransform]
vars.to.regress = ["percent.mt", "percent.ribo", "S.Score", "G2M.Score"]
variable.features.n = 3000
# Harmony integration
[SeuratPreparing.envs.IntegrateLayers]
method = "harmony"
# Use for large datasets (>100k cells) or same-platform multi-batch
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["large_dataset_info.txt"]
[SeuratPreparing.envs]
use_sct = false # RPCA works better with standard workflow
ncores = 16
# Standard workflow
[SeuratPreparing.envs.NormalizeData]
normalization-method = "LogNormalize"
scale-factor = 10000
[SeuratPreparing.envs.FindVariableFeatures]
selection-method = "vst"
nfeatures = 3000
[SeuratPreparing.envs.ScaleData]
vars.to.regress = ["percent.mt", "percent.ribo"]
[SeuratPreparing.envs.RunPCA]
npcs = 100
# RPCA integration (faster for large data)
[SeuratPreparing.envs.IntegrateLayers]
method = "rpca"
orig.reduction = "pca"
# Use for datasets with high doublet rates (>5%)
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["high_doublet_info.txt"]
[SeuratPreparing.envs]
use_sct = true
doublet_detector = "scDblFinder" # or "DoubletFinder"
[SeuratPreparing.envs.scDblFinder]
dbr = 0.08 # Higher expected doublet rate
ncores = 4
[SeuratPreparing.envs.SCTransform]
vars.to.regress = ["percent.mt", "percent.ribo"]
[SeuratPreparing.envs.IntegrateLayers]
method = "harmony"
# Use when you need to analyze non-variable genes later
[SeuratPreparing]
[SeuratPreparing.in]
metafile = ["sample_info.txt"]
[SeuratPreparing.envs]
use_sct = true
[SeuratPreparing.envs.SCTransform]
min_cells = 0 # Don't filter by expression
return-only-var-genes = false # Keep all genes in RNA assay
use_sct = trueuse_sct = false[SeuratPreparing.in.metafile] is required unless LoadingRNAFromSeurat is in configSample)NormalizeData, FindVariableFeatures, ScaleData, RunPCA (when use_sct = true)use_sct = falseuse_sct = true, IntegrateLayers.normalization-method defaults to "SCT"no_integration = true for single sample or pre-integrated datano_integration = truencores than other processes<signature>.<kind>.RDS files or set cache = falseSymptoms: Low cell count after SeuratPreparing
Solutions:
"nFeature_RNA > 100 & percent.mt < 20"percent.mt calculation: Ensure mitochondrial genes are prefixed correctly (human: MT-, mouse: mt-)nFeature_RNA and nCount_RNA distributions in QC plotsSymptoms: Clusters mix distinct cell types after integration Solutions:
method = "rpca"method = "harmony"no_integration = trueSymptoms: More doublets than expected Solutions:
doublets or dbr parameter matches actual loadingSymptoms: Low number of genes in SCT assay Solutions:
min_cells: [SeuratPreparing.envs.SCTransform.min_cells = 0return-only-var-genes = falsevariable.features.n: Increase to 5000 or highervariable.features.rv.th: Lower threshold (e.g., 1.2)Symptoms: Process killed or out-of-memory errors Solutions:
ncores: Parallelization uses more memoryncells in SCTransform: Subsample for model fittingconserve.memory = true in SCTransformncores: Set to 1-2 coresSymptoms: Process takes >24 hours Solutions:
ncores (with sufficient memory)method = "rpca"ncells in SCTransform: Faster model fittingcache = true for faster re-runsSymptoms: Cells cluster by sample rather than cell type Solutions:
vars.to.regress = ["batch_var"]Symptoms: Assay layer errors, deprecated function warnings Solutions:
install.packages("Seurat")IntegrateLayers instead of FindIntegrationAnchorsobject[["RNA"]] vs object@assays$RNAncores = 1
min_cells = 0
min_features = 0
cell_qc = ""
gene_qc = { min_cells = 0 }
use_sct = false
no_integration = false
doublet_detector = "none"
cache = "/tmp"
# NormalizeData
normalization-method = "LogNormalize"
scale-factor = 10000
# FindVariableFeatures
selection-method = "vst"
nfeatures = 2000
# SCTransform
variable.features.n = 3000
variable.features.rv.th = 1.3
min_cells = 3
return-only-var-genes = true
# IntegrateLayers
method = "harmony"
# DoubletFinder
PCs = 10
doublets = 0.075
pN = 0.25
# scDblFinder
dbr = 0.075
nFeature_RNA: Number of genes detected per cellnCount_RNA: Total UMI counts per cellpercent.mt: Percentage of mitochondrial gene expressionpercent.ribo: Percentage of ribosomal gene expressionpercent.hb: Percentage of hemoglobin gene expressionpercent.plat: Percentage of platelet gene expression| Situation | Recommended Method | Reason |
|---|---|---|
| Strong biological differences | CCA | Captures shared biology despite expression shifts |
| Same platform, large data | RPCA | Faster, conservative, less overcorrection |
| Complex batch structure | Harmony | Handles multiple batch variables |
| Very large datasets (>200k) | RPCA or scVI | Scales well computationally |
| Cross-modality integration | CCA or FastMNN | Designed for different data types |
| Preliminary analysis | Harmony | Fast, good default performance |
RNA (normalized, scaled)SCT (variance-stabilized)integratedSCT (if use_sct = true) or RNA (if use_sct = false)