-
Notifications
You must be signed in to change notification settings - Fork 0
/
scran_analysis.R
32 lines (20 loc) · 1001 Bytes
/
scran_analysis.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
##scran test
library(scran)
library(dplyr)
library(Seurat)
library(reticulate)
library(sctransform)
library("org.Mm.eg.db")
cell_ranger_path
data <- Read10X(data.dir = paste0(cell_ranger_path, "/outs/filtered_feature_bc_matrix"))
data2 <- CreateSeuratObject(counts = data, project = "PROJECT_NAME", min.cells = 3, min.features = 200)
barcodes <- read.delim(paste0(cell_ranger_path, "/outs/filtered_feature_bc_matrix/barcodes.tsv"), header=FALSE)
features <- read.delim(paste0(cell_ranger_path, "/outs/filtered_feature_bc_matrix/features.tsv"), header=FALSE)
matrix_data <- as.matrix(GetAssayData(data2, slot = "counts"))
ensembl <- mapIds(org.Mm.eg.db, keys = rownames(matrix_data), column = "ENSEMBL", keytype="SYMBOL")
rownames(matrix_data) <- unname(ensembl)
sce <- SingleCellExperiment(list(counts=matrix_data))
mm.pairs <- readRDS(system.file("exdata", "mouse_cycle_markers.rds", package="scran"))
assigned <- cyclone(sce, pairs=mm.pairs)
head(assigned$scores)
table(assigned$phases)