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

# test data
library(dplyr)
library(isoswitch)
seurat <- readRDS("/data/10x_data/10x_5psanger/output/adult50.rds")
switch_markers <- read.table("/data/10x_data/10x_5psanger/d537/output/06-isoswitch_markers_meta.csv", sep=",")

isoswitch

The goal of isoswitch is to facilitate the characterization of isoform expression in long-read single-cell datasets. It includes a set of functions and reports built on top of Seurat, ggplot and rmarkdown that can be used to search, visualize and document isoform expression patterns, and particularly isoform switches between cell identities.

Installation

You can install the development version of isoswitch from GitHub with:

# install.packages("devtools")
devtools::install_github("atienza-ipmc/isoswitch")

General Workflow

  1. Input data setup & pre-processing
  2. Isoform characterization
  3. Isoform switch detection
  4. Gene reports

Below is a short overview of the package functionality:

1 - Input data setup & pre-processing

Isoswitch is designed to work with Seurat objects with gene- and isoform-level counts.

In particular, the ScNaUmi-seq protocol (Lebrigand et al 2020) generates two
count matrices that need to be loaded into respective Seurat assays before starting the analysis, more specifically:

Note
isoswith expects the row names of the isoform count matrix to follow the format "[gene_name]..[transcript_id]", example: "BCS1L..ENST00000359273"

head(rownames(seurat@assays$multi@counts))

After loading up gene and isoform counts on the Seurat object, the method iso_preprocess() prepares the isoform matrix by removing low-expression transcripts as well as removing single-isoform genes which are irrelevant for the isoform switch analysis.

The resulting "multi-isoform" matrix is stored as a new assay on the input Seurat object.

seurat <- iso_preprocess(seurat, assay="ISO", new_assay="multi", filter_threshold=5)

2. Isoform characterization

The method iso_compute_stats() parses the isoform raw count matrix returning a data frame with stats on the expression of each transcript

stats <- iso_compute_stats(seurat@assays$multi@counts) %>% arrange(gene_id)
head(stats, n=4)

The method plot_assay_stats() builds on this data to plot a summary with number of genes, number of transcripts, distribution of isoforms and number of genes per cell type that can be used to describe succintly the isoform distribution in the dataset.

plot_assay_stats(seurat, "isoform")

alt text

3. Isoform switch search

The term “isoform switch” refers to an event where two isoforms of the same gene are considered markers of different clusters.

The marker search is implemented on the method ISO_SWITCH_ALL(). Any extra parameters are passed on to the underlying Seurat's FindMarkers call to fine tune the search space.

clusters <- levels(seurat@active.ident)
switch_markers <- ISO_SWITCH_ALL(seurat, clusters, assay="isoform", 
                                 min.pct=0, logfc.threshold=0.40)

ISO_SWITCH_ALL() returns a data frame of transcripts identified as markers of a given cluster for a given gene, one transcript per row.

To facilitate the graphical interpretation of the results:

pl1 <- plot_marker_matrix(seurat, switch_markers) 
pl2 <- plot_marker_score(adult, switch_markers, facet=FALSE, overlaps=16)
pl1 | pl2 

alt text plot_marker_score() can also plot individual volcano plots for each cluster analyzed with the parameter facet=TRUE

plot_marker_score(adult, switch_markers, facet=TRUE, ncol=3)

alt text

The method compute_switches() and gene_switch_table() compute isoform switchs from a list of markrs and return a data.frame and an html table respectively (only compatible with html output documents such as Rmd reports)

switches <- compute_switches(switch_markers)
gene_switch_table(switch_markers)

4. Gene reports

After identifying genes of interest, twere are two ways of drilling down and producing gene-level reports:

isoswitch_report(seurat, "isoform", gene="HYAL2", marker_list=switch_markers, gtf_df, transcript_metadata) 

alt text



atienza-ipmc/isoswitch documentation built on June 27, 2022, 12:22 p.m.