create_seurat_object: Create Seurat object based on sample metadata.

View source: R/utils.R

create_seurat_objectR Documentation

Create Seurat object based on sample metadata.

Description

This function creates Seurat object for each sample in the metadata file. It also allows the user to perform SoupX (ambient RNA removal) and Scrublet (doublet detection) analysis.

Usage

create_seurat_object(
  data_dir,
  sample_meta = NULL,
  sample_meta_filename = NULL,
  meta_colnames = c("donor", "condition", "pass_qc"),
  plot_dir = NULL,
  use_scrublet = TRUE,
  use_soupx = FALSE,
  tenx_dir = "premrna_outs",
  tenx_counts_dir = "filtered_feature_bc_matrix",
  expected_doublet_rate = 0.06,
  min.cells = 10,
  min.features = 200,
  ...
)

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'.

meta_colnames

Sample metadata column names to store in Seurat metadata.

plot_dir

Directory for storing QC plots. Used if use_soupx = TRUE.

use_scrublet

Logical, wether to use Scrublet for doublet detection.

use_soupx

Logical, wether to use SoupX for ambient RNA removal.

tenx_dir

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

tenx_counts_dir

Name of 10x directory where count matrices are stored. Default 'filtered_feature_bc_matrix'

expected_doublet_rate

The expected fraction of transcriptomes that are doublets, typically 0.05 - 0.1

min.cells

Include features/genes detected in at least this many cells.

min.features

Include cells where at least this many features/genes are detected.

...

Additional named parameters passed to Seurat, Scrublet or SoupX.

Value

List of Seurat objects equal the number of samples in the sample metadata file. If a single sample, returns a Seurat object.

Author(s)

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


andreaskapou/SeuratPipe documentation built on Nov. 22, 2022, 4:16 p.m.