Skip to contents

This function implements all the analysis steps for perfoming QC. These include: 1. reading all sample information from metadata object/file and generating one Seurat object per sample. 2. Performs SoupX (ambient RNA removal) and Scrublet (doublet detection) if user defines the corresponding parameters. 3. Filter Seurat object according to QC criteria 4. Generate correspond QC plots.

Usage

run_spatial_qc_pipeline(
  data_dir,
  sample_meta,
  sample_meta_filename = NULL,
  nfeat_thresh = 500,
  mito_thresh = 5,
  meta_colnames = c("donor", "condition", "pass_qc"),
  out_dir = NULL,
  qc_to_plot = c("nFeature_Spatial", "nCount_Spatial", "percent.mito"),
  alpha = c(0.1, 0.9),
  pt.size.factor = 1.1,
  max.cutoff = "q98",
  min.cutoff = NA,
  spatial_col_pal = "inferno",
  crop = FALSE,
  tenx_dir = "outs",
  obj_filename = "seu_qc",
  ...
)

Arguments

data_dir

Parent directory where all sample 10x files are stored. Think of it as project directory.

sample_meta

Sample metadata information in a Data.frame like object. Columns should at least contain 'sample', 'donor', 'condition' and 'pass_qc'.

sample_meta_filename

Filename of sample metadata information, same as 'meta' parameter above. User should provide one of 'meta' or 'meta_filename'.

nfeat_thresh

Filter cells that have less than 'nfeat_thresh' counts expressed.

mito_thresh

Filter cells with more than 'mito_thresh'% counts.

meta_colnames

Sample metadata column names to store in Seurat metadata.

out_dir

Output directory for storing analysis results.

qc_to_plot

Vector of features in metadata to plot.

alpha

Controls opacity of spots. Provide as a vector specifying the min and max range of values (between 0 and 1).

pt.size.factor

Scale the size of the spots.

max.cutoff

Vector of maximum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

min.cutoff

Vector of minimum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10').

spatial_col_pal

(Spatial) Continuous colour palette to use from viridis package to colour spots on tissue, default "inferno".

crop

(Spatial) Crop the plot in to focus on points plotted. Set to FALSE to show entire background image.

tenx_dir

Name of 10x base directory, e.g. with outputs after running cellranger. Default 'premrna_outs', i.e. assumes single-nuclei RNA-seq.

obj_filename

Filename of the stored Seurat object, default 'seu_qc'.

...

Additional named parameters passed to Seurat, Scrublet or SoupX.

Value

List of Seurat objects as the length of the number of samples in the sample metadata file. If a single sample, return a Seurat object instead of a list.

Author

C.A.Kapourani C.A.Kapourani@ed.ac.uk