---
title: "Importation and representation of parabiosis droplet data"
author: 
    - name: Tram Nguyen
      affiliation: Center for Computational Biomedicine, Harvard Medical School
      email: Tram_Nguyen@hms.harvard.edu
    - name: Kris Holton
      affiliation: Harvard Stem Cell Institute, Harvard Medical School
    - name: Tyrone Lee
      affiliation: Center for Computational Biomedicine, Harvard Medical School
    - name: Nitesh Turaga
      affiliation: Center for Computational Biomedicine, Harvard Medical School
    - name: Ludwig Geistlinger
      affiliation: Center for Computational Biomedicine, Harvard Medical School
    - name: Robert Gentleman
      affiliation: Center for Computational Biomedicine, Harvard Medical School
package: MouseAgingData
output:
    BiocStyle::html_document:
      self_contained: yes 
      toc: true
      toc_float: true
      toc_depth: 2
      code_folding: show
date: "`r doc_date()`"
vignette: >
    %\VignetteIndexEntry{Accessing and Visualizing Parabiosis Droplet Data}
    %\VignetteEncoding{UTF-8}
    %\VignetteEngine{knitr::rmarkdown}
editor_options: 
    markdown: 
      wrap: 80
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>",
    crop = NULL
)
```

# Installation

Install the package using Bioconductor. Start R and enter:

```{r, eval = FALSE}
if(!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
BiocManager::install("MouseAgingData")
```

# Setup

Now, load the package and dependencies used in the vignette.

```{r, message = FALSE}
library(scater)
library(MouseAgingData)
```

# Introduction

Single-cell sequencing technology can reveal intricate details about individual
cells, allowing researchers to interrogate the genetic make up of cells within a
heterogeneous sample. Single-cell sequencing can provide insights into various
aspects of cellular biology, such as characterization of cell populations,
identification of rare cell types, and quantification of expression levels in
cell types across experimental treatments. Given the wide utility, single-cell
sequencing has expanded scientific knowledge in various fields, including cancer
research, immunology, developmental biology, neurobiology, and microbiology.

There are several methods for generating single-cell sequencing data which can
extract information (DNA or RNA) from a cell. These include, but are not limited
to:

1. Droplet-based platforms: such as 10x Genomics Chromium system, inDrop,
Drop-seq, and Seq-Well, which use microfluidic devices to isolate individual
cells into tiny droplets along with unique barcoded beads.

2. Plate or microwell-based methods: such as the Smart-seq2 protocol or the C1
system by Fluidigm, respectively. These platforms employ microfluidic chips or
multi-well arrays to capture and process individual cells. Unlike droplet-based
platforms, these cells are manually or automatically sorted into individual
wells of the plate.

The `MouseAgingData` package provides analysis-ready data from an aging mouse
brain parabiosis single cell study by Ximerakis & Holton et al.,
([2023](https://pubmed.ncbi.nlm.nih.gov/37118429/)) and additional datasets. 
The contents of the package can be accessed by querying ExperimentHub with the 
package name.


# Data

Ximerakis & Holton et al. investigated how heterochronic parabiosis (joining of
the circulatory systems) affects the mouse brain in terms of aging and
rejuvenation. They identified gene signatures attributed to aging in specific
cell-types. They focus especially on brain endothelial cells, which showed
dynamic transcriptional changes that affect vascular structure and function.

The parabiosis single cell RNA-seq (Ximerakis, Holton et al Nature Aging 2023)
includes 105,329 cells, 31 cell types across 8 OX, 8 YX, 7 YY, 9 YO, 7 OO, 11 OY
animals, and 20905 features.

This vignette demonstrates how to access and visualize the droplet data using 
reduced dimensionality coordinates provided by the authors.


# Load the data set from ExperimentHub

```{r}
sce <- parabiosis10x()
```

View the `SingleCellExperiment` data.

```{r}
sce
```

Do some checking to make sure the data loaded correctly and is what we expected.
Here, we are viewing the cell information of the object. We see that there are 
indeed 105329 cells and 20905 features.

```{r, Data check}
head(colData(sce)) 
```


# Visualization

For this dataset, the authors have provided us with their exact UMAP and
tSNE coordinates, as well as their color scheme representing the cell types from
their paper. This can be accessed in the metadata slot of the
`SingleCellExperiment` object with the `metadata()` function. To consistently
recreate their figures, let's plot using their provided reduced dimensionality
coordinates.

```{r, fig.wide=TRUE}
cell.color <- metadata(sce)$cell_color

gg <- plotUMAP(sce, color_by = "cell_type", text_by = "cell_type") 
gg + theme(legend.title=element_blank()) + 
    scale_color_manual(values=c(cell.color))
```
This plot is a recreation of Fig. 2C from Ximerakis & Holton et al. 2023.

<br>

We can also plot a tSNE with their provided coordinates.

```{r, plot provided tSNE, fig.wide=TRUE}
gg <- plotTSNE(sce, color_by = "cell_type", text_by = "cell_type") 
gg + theme(legend.title=element_blank()) + 
    scale_color_manual(values=c(cell.color))
```


# Reference

Ximerakis & Holton et al. (2023) Heterochronic parabiosis reprograms the mouse
brain transcriptome by shifting aging signatures in multiple cell types.
\emph{Nat Aging} 3, 327–345. doi: [https://doi.org/10.1038/s43587-023-00373-6](https://doi.org/10.1038/s43587-023-00373-6).

# Session Info

```{r, sesh info}
sessionInfo()
```
