Data loading and pre-processing

This is the first note for Mesenchymal Stem Cell project. The Veh and PTH samples are loaded, merged and pre-processed.

Setup Seurat object

library(Seurat)
## Loading required package: ggplot2
## Loading required package: cowplot
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggplot2':
## 
##     ggsave
## Loading required package: Matrix
Veh.data <- Read10X(data.dir = "C:/mz/MSC/MSC_1.5M_2wk_Veh/filtered_gene_bc_matrices/refdata-cellranger-mm10-tomato")
PTH.data <- Read10X(data.dir = "C:/mz/MSC/MSC_1.5M_2wk_PTH/filtered_gene_bc_matrices/refdata-cellranger-mm10-tomato")

Veh <- CreateSeuratObject(raw.data = Veh.data, min.cells = 3, min.genes = 200, 
                          project = "10X_PBMC")
PTH <- CreateSeuratObject(raw.data = PTH.data, min.cells = 3, min.genes = 200, 
                          project = "10X_PBMC")

VehPTH <- AddSamples(object = Veh, new.data = PTH@raw.data, do.normalize = F)
rm(list = c("Veh.data","PTH.data","Veh","PTH"))

Number of Cells

sample1 = grep(pattern = "^Veh.", x = VehPTH@cell.names,value = T)
sample11 = rep("Veh",length = length(sample1))

sample2 = grep(pattern = "^PTH.",x = VehPTH@cell.names,value = T)
sample22 = rep("PTH", length = length(sample2))

sample3 = append(sample1,sample2)
sample33 = append(sample11, sample22)

samples = data.frame(sample33, row.names = sample3)
colnames(samples) = "samples"

VehPTH <- AddMetaData(object = VehPTH, metadata = samples, col.name = "samples")

table(VehPTH@meta.data$samples)
## 
##  PTH  Veh 
## 3949 5744

Overall Quality Information

mito.genes <- grep(pattern = "^mt-", x = rownames(x = VehPTH@data), value = TRUE)
percent.mito <- Matrix::colSums(VehPTH@raw.data[mito.genes, ])/Matrix::colSums(VehPTH@raw.data)

VehPTH <- AddMetaData(object = VehPTH, metadata = percent.mito, col.name = "percent.mito")
VlnPlot(object = VehPTH, features.plot = c("nGene", "nUMI", "percent.mito"), nCol = 3)

Save R object

saveRDS(object = VehPTH,file = "VehPTH.RDS")