-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start an updated vignette with DLPFC data
- Loading branch information
Showing
1 changed file
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
--- | ||
title: "Deconvolution_Benchmark_DLPFC" | ||
author: | ||
- name: Louise Huuki-Myers | ||
affiliation: | ||
- &libd Lieber Institute for Brain Development, Johns Hopkins Medical Campus | ||
email: [email protected] | ||
output: | ||
BiocStyle::html_document: | ||
self_contained: yes | ||
toc: true | ||
toc_float: true | ||
toc_depth: 2 | ||
code_folding: show | ||
date: "`r doc_date()`" | ||
package: "`r pkg_ver('DeconvoBuddies')`" | ||
vignette: > | ||
%\VignetteIndexEntry{Deconvolution_Benchmark_DLPFC} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r setup, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>", | ||
crop = NULL ## Related to https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016656.html | ||
) | ||
``` | ||
|
||
|
||
```{r vignetteSetup, echo=FALSE, message=FALSE, warning = FALSE} | ||
## Track time spent on making the vignette | ||
startTime <- Sys.time() | ||
## Bib setup | ||
library("RefManageR") | ||
## Write bibliography information | ||
bib <- c( | ||
R = citation(), | ||
BiocStyle = citation("BiocStyle")[1], | ||
knitr = citation("knitr")[1], | ||
RefManageR = citation("RefManageR")[1], | ||
rmarkdown = citation("rmarkdown")[1], | ||
sessioninfo = citation("sessioninfo")[1], | ||
testthat = citation("testthat")[1], | ||
DeconvoBuddies = citation("DeconvoBuddies")[1] | ||
) | ||
``` | ||
|
||
#Introduction | ||
|
||
## What is Deconvolution? | ||
|
||
**Inferring the composition of different cell types in a bulk RNA-seq data** | ||
|
||
`Bisque` is an R package for preforming reference based deconvolution [github.com/cozygene/bisque](https://github.com/cozygene/bisque). | ||
|
||
## Goals of this Vignette | ||
|
||
We will be demonstrating how to use `DeconvoBuddies` tools when applying | ||
deconvolution with the `Bisque` package. | ||
|
||
1. Install and load required packages | ||
2. Download DLPFC RNA-seq data, and reference snRNA-seq data | ||
3. Find marker genes with `DeconvoBuddies` tools | ||
4. Run deconvolution with `BisqueRNA` | ||
5. Explore deconvolution output and create compostion plots with `DeconvoBuddies` tools | ||
6. Check proportion against RNAScope estimated proportions | ||
|
||
# Basics | ||
|
||
# 1. Install and load required packages | ||
|
||
`R` is an open-source statistical environment which can be easily modified to enhance its functionality via packages. `r Biocpkg("DeconvoBuddies")` is a `R` package available via the [Bioconductor](http://bioconductor.org) repository for packages. `R` can be installed on any operating system from [CRAN](https://cran.r-project.org/) after which you can install `r Biocpkg("DeconvoBuddies")` by using the following commands in your `R` session: | ||
|
||
## Install `DeconvoBuddies` | ||
|
||
```{r "install", eval = FALSE} | ||
if (!requireNamespace("BiocManager", quietly = TRUE)) { | ||
install.packages("BiocManager") | ||
} | ||
BiocManager::install("DeconvoBuddies") | ||
## Check that you have a valid Bioconductor installation | ||
BiocManager::valid() | ||
``` | ||
|
||
## Load Other Packages | ||
|
||
```{r "load_packages", message=FALSE, warning=FALSE} | ||
## install Bisque from cran | ||
# install.packages("BisqueRNA") | ||
library("spatialLIBD") | ||
library("DeconvoBuddies") | ||
library("SummarizedExperiment") | ||
library("SingleCellExperiment") | ||
library("BisqueRNA") | ||
library("dplyr") | ||
library("tidyr") | ||
library("tibble") | ||
``` | ||
|
||
# 2. Download DLPFC RNA-seq data, and reference snRNA-seq data. | ||
|
||
## Bulk RNA-seq data | ||
|
||
Access the 110 sample Human DLPFC bulk RNA-seq dataset for LIBD. These samples | ||
are from 19 tissue blocks, and 10 neurotypical adult donors. Samples were sequenced | ||
with two different `library_types` (polyA and RiboZeroGold), and three different | ||
`RNA_extraction` (Cyto, Total, Nuc), post quality control n=110 samples. | ||
|
||
```{r "load rse_gene"} | ||
## use fetch deconvon data to load rse_gene | ||
rse_gene <- fetch_deconvo_data("rse_gene") | ||
rse_gene | ||
## bulk RNA seq samples were sequenced with different library types, and RNA extractions | ||
table(rse_gene$library_type, rse_gene$library_prep) | ||
``` | ||
|
||
## Refernce snRNA-seq data | ||
|
||
This data is paired with a single nucleus RNA-seq data set from `spatialLIBD`. | ||
This dataset can be accessed with `spatialLIBD::fetch_data()`. | ||
|
||
```{r "load snRNA-seq"} | ||
## Use spatialLIBD to fetch the snRNA-seq dataset | ||
sce_path_zip <- spatialLIBD::fetch_data("spatialDLPFC_snRNAseq") | ||
# sce_path <- unzip(sce_path_zip, exdir = tempdir()) | ||
# | ||
# sce <- HDF5Array::loadHDF5SummarizedExperiment( | ||
# file.path(tempdir(), "sce_DLPFC_annotated") | ||
# ) | ||
``` | ||
|
||
|
||
# 3. Find marker genes with `DeconvoBuddies` tools | ||
# 4. Run deconvolution with `BisqueRNA` | ||
# 5. Explore deconvolution output and create compostion plots with `DeconvoBuddies` tools | ||
# 6. Check proportion against RNAScope estimated proportions | ||
|
||
|
||
# Reproducibility | ||
|
||
The `r Biocpkg("DeconvoBuddies")` package `r Citep(bib[["DeconvoBuddies"]])` was made possible thanks to: | ||
|
||
* R `r Citep(bib[["R"]])` | ||
* `r Biocpkg("BiocStyle")` `r Citep(bib[["BiocStyle"]])` | ||
* `r CRANpkg("knitr")` `r Citep(bib[["knitr"]])` | ||
* `r CRANpkg("RefManageR")` `r Citep(bib[["RefManageR"]])` | ||
* `r CRANpkg("rmarkdown")` `r Citep(bib[["rmarkdown"]])` | ||
* `r CRANpkg("sessioninfo")` `r Citep(bib[["sessioninfo"]])` | ||
* `r CRANpkg("testthat")` `r Citep(bib[["testthat"]])` | ||
|
||
This package was developed using `r BiocStyle::Biocpkg("biocthis")`. | ||
|
||
|
||
Code for creating the vignette | ||
|
||
```{r createVignette, eval=FALSE} | ||
## Create the vignette | ||
library("rmarkdown") | ||
system.time(render("Deconvolution_Benchmark_DLPFC.Rmd", "BiocStyle::html_document")) | ||
## Extract the R code | ||
library("knitr") | ||
knit("Deconvolution_Benchmark_DLPFC.Rmd", tangle = TRUE) | ||
``` | ||
|
||
Date the vignette was generated. | ||
|
||
```{r reproduce1, echo=FALSE} | ||
## Date the vignette was generated | ||
Sys.time() | ||
``` | ||
|
||
Wallclock time spent generating the vignette. | ||
|
||
```{r reproduce2, echo=FALSE} | ||
## Processing time in seconds | ||
totalTime <- diff(c(startTime, Sys.time())) | ||
round(totalTime, digits = 3) | ||
``` | ||
|
||
`R` session information. | ||
|
||
```{r reproduce3, echo=FALSE} | ||
## Session info | ||
library("sessioninfo") | ||
options(width = 120) | ||
session_info() | ||
``` | ||
|
||
|
||
|
||
# Bibliography | ||
|
||
This vignette was generated using `r Biocpkg("BiocStyle")` `r Citep(bib[["BiocStyle"]])` | ||
with `r CRANpkg("knitr")` `r Citep(bib[["knitr"]])` and `r CRANpkg("rmarkdown")` `r Citep(bib[["rmarkdown"]])` running behind the scenes. | ||
|
||
Citations made with `r CRANpkg("RefManageR")` `r Citep(bib[["RefManageR"]])`. | ||
|
||
```{r vignetteBiblio, results = "asis", echo = FALSE, warning = FALSE, message = FALSE} | ||
## Print bibliography | ||
PrintBibliography(bib, .opts = list(hyperlink = "to.doc", style = "html")) | ||
``` |