-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonocle_start.R
33 lines (23 loc) · 906 Bytes
/
monocle_start.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Running experiment one in Monocle
# http://cole-trapnell-lab.github.io/monocle-release/docs/#getting-started-with-monocle
library(monocle)
mtx <- readMM('./data/filtered_feature_bc_matrix/matrix.mtx')
mtx[1:10,1:10]
dim(mtx)
features <- read.table('./data/filtered_feature_bc_matrix/features.tsv')
colnames(features)[2] <- 'gene_short_name'
head(features)
dim(features)
barcodes <- read.table('./data/filtered_feature_bc_matrix/barcodes.tsv')
head(barcodes)
pd <- new("AnnotatedDataFrame", data = barcodes)
fd <- new("AnnotatedDataFrame", data = features)
library(Matrix)
cds <- newCellDataSet(as(mtx, "sparseMatrix"),
phenoData = pd,
featureData = fd,
lowerDetectionLimit = 0.5,
expressionFamily = negbinomial.size())
cds <- estimateSizeFactors(cds)
cds <- estimateDispersionspDa(cds)
cds <- detectGenes()