---
title: "QC on scRNA-seq white adipocyte data (day-20)"
author: Anushka Gupta
date: March 29 2021
---

```{r setup}
knitr::opts_knit$set(root.dir = '~/Desktop/scRNA-seq_snRNA-seq_adipocyte_lineages/')
```

```{r}
# load libraries
library(Seurat)

# Read cellenone seurat data
load(file = "rdata/seurat.cellenone.RData")
scellenone=seurat_singlet_object
rm(seurat_singlet_object)

# We initially ran the experiment for both white and brown adipocytes
# This Seurat object has brown adipocytes as well. However, doublets and negatives were removed based on the images of cells acquired during spotting.
# Therefore, sub-sample to white cells and extract the count and metadata for white cells
# Then, initiate a new Seurat object 
scellenone=subset(scellenone,Type=="Sub")
count=scellenone@assays$RNA@counts
meta=scellenone@meta.data
scellenone=CreateSeuratObject(counts = count,meta.data = meta)
scellenone=NormalizeData(scellenone)
scellenone=FindVariableFeatures(scellenone)
scellenone=ScaleData(scellenone)
scellenone=RunPCA(scellenone)
ElbowPlot(scellenone)

# Clustering
scellenone=RunUMAP(scellenone,dims = 1:20)
scellenone=FindNeighbors(object = scellenone,dims = 1:20)
scellenone=FindClusters(scellenone,resolution = .6)

save(scellenone,file = "rdata/seurat.cellenone.postQC.RData")
```