knitr::opts_chunk$set(
    eval = FALSE,
    collapse = TRUE,
    comment = "#>",
    dpi = 900,
    fig.path = "man/figures/README-",
    out.width = "100%"
)

seuratTools

This package includes a set of Shiny apps for exploring single cell RNA datasets processed with Seurat

A demo using a human gene transcript dataset from Shayler et al. (link) is available here

There are also convenient functions for:

[!WARNING] seuratTools was designed for full-length smart-seq based single cell data. Default settings may not be appropriate for droplet (10x) data, though most can be adjusted. Keep in mind best practices regarding normalization, dimensional reduction, etc. when using.

Installation

You can install the released version of seuratTools from github with:

Install locally and run in three steps:

You can install seuratTools locally using the following steps:

install.packages("devtools")
devtools::install_github("whtns/seuratTools")
seuratTools::create_project_db()

You can also customize the location of the app using these steps:

devtools::install_github("whtns/seuratTools")
seuratTools::create_project_db(destdir = "/your/path/to/app")

Getting Started

First, load seuratTools and all other packages required

library(seuratTools)
library(Seurat)
library(tidyverse)
library(ggraph)

TLDR

seuratTools provides a single command to:

Run clustering on a single seurat object

By default clustering will be run at ten different resolutions between 0.2 and 2.0. Any resolution can be specified by providing the resolution argument as a numeric vector.

clustered_seu <- clustering_workflow(human_gene_transcript_seu,
    experiment_name = "seurat_hu_trans",
    organism = "human"
)

Get a first look at a processed dataset using an interactive shiny app

minimalSeuratApp(human_gene_transcript_seu)

Set up a seurat object

We start with a gene by cell matrix of count/UMI values and a table of cell metadata

human_count[1:5, 1:5]

head(human_meta)
knitr::kable(human_count[1:5, 1:5])

knitr::kable(head(human_meta))

We can then create a seurat object in the usual manner using CreatSeuratObject function

myseu <- CreateSeuratObject(human_count, assay = "gene", meta.data = human_meta)

Preprocess the seurat object

seuratTools includes a handy function to preprocess the data that handles normalization and scaling required for downstream analysis. If needed, parameters can be specified by the user.

myseu <- seurat_preprocess(myseu)

This single function includes seurat sub-functions that normalizes, identifies highly variable features and scales the data

Perform dimension reduction

seuratTools also implements a standardized dimension reduction step to select variable features at a user-specified threshold and perform PCA, tSNE, and UMAP. The default assay the dimension reduction is being run on is "gene".

myseu <- seurat_reduce_dimensions(myseu, assay = "RNA")

Community detection by clustering

Clustering analysis is performed via Louvain(default) or alternative algorithms available in Seurat. Clustering is performed at a range of resolutions with default value ranging from 0.2 to 2 and pca reduction

seu <- seurat_cluster(seu = Dim_Red_seu, resolution = seq(0.2, 2, by = 0.2))

This function produces clustering analysis via two steps performed using two different sub-functions

Split included dataset based on collection technology

seuratTools includes a function, SplitObject, which is capable of splitting the dataset into subsets based on a single attribute indicated by the split.by argument

split_human <- SplitObject(human_gene_transcript_seu, split.by = "dataset")

In this example the split_human object consists of a list of subsetted objects which are split based on batch

Run seurat batch integration on 'child' projects

When joint analysis of 2 or more datasets is to be performed integration_workflow function can be used, which takes in a list of seurat objects as input and returns an integrated seurat object

integrated_seu <- integration_workflow(split_human)

View analysis details

Misc(integrated_seu, "experiment") %>%
    tibble::enframe() %>%
    knitr::kable()


whtns/seuratTools documentation built on Oct. 28, 2024, 7:18 a.m.