-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
87 lines (87 loc) · 3.01 KB
/
.Rhistory
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
library(devtools)
usethis::use_github_action("check-standard")
devtools::build()
devtools::build()
devtools::build()
usethis::use_r("identify_empty_drops")
usethis::use_r("identify_damaged_cells")
devtools::build()
devtools::build()
usethis::use_github_action("check-standard")
devtools::build()
usethis::use_news_md()
usethis::use_cran_comments()
packages <- c("cowplot", "devtools", "dplyr", "ggplot2", "Matrix", "png", "Seurat", "SoupX")
for (pkg in packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg)
}
}
install.packages("ks")
library(ks)
install.packages("mclust")
install.packages("mclust")
library(mclust)
install.packages("dplyr")
install.packages("dplyr")
library(dplyr)
# tests
packages <- c("cowplot", "devtools", "dplyr", "ggplot2", "glmGamPoi", "Matrix",
"png", "Seurat", "SoupX", "DoubletFinder",
"miQC", "SingleCellExperiment",
"scuttle", "presto", "valiDrops", "DropletQC")
for (pkg in packages) {
if (!require(pkg, character.only = TRUE)) {
library(pkg)
}
}
remove.packages("limiric")
data("human_annotations", package = "limiric")
data("human_annotations")
annotations <- human_annotations
Get gene annotations for mitochondrial (MT) & ribosomal (RB) genes
# Get gene annotations for mitochondrial (MT) & ribosomal (RB) genes
mt_gene_annotations <- annotations[grep("MT-", annotations$gene_name, perl=TRUE),]
mt_gene_annotations <- mt_gene_annotations[grepl("protein_coding", mt_gene_annotations$gene_biotype, perl=TRUE),]
mt_genes <- mt_gene_annotations %>% pull(gene_name)
# isolate ribosomal genes
rps_genes <- annotations[grep("RPS", annotations$gene_name, perl=TRUE),]
rps_genes <- rps_genes[grepl("protein_coding", rps_genes$gene_biotype, perl=TRUE),]
rps_genes <- rps_genes %>% pull(gene_name)
rpl_genes <- annotations[grep("RPL", annotations$gene_name, perl=TRUE),]
rpl_genes <- rpl_genes[grepl("protein_coding", rpl_genes$gene_biotype, perl=TRUE),]
rpl_genes <- rpl_genes %>% pull(gene_name)
rb_genes <- c(rps_genes, rpl_genes)
# combine mt and rb genes
mt_rb_genes <- c(mt_genes, rb_genes)
mt_rb_genes <- unique(mt_rb_genes)
usethis::use_data(mt_rb_genes)
mt_rb_genes
dim(mt_rb_genes)
length(mt_rb_genes)
data("test_data")
# Load test data
data("test_data", package = "limiric")
# Load test data
data("test_data")
data("mt_rb_genes")
# Create limiric-like Seurat object for testing
limiric <- subset(test_data, features = intersect(mt_rb_genes, rownames(test_data@assays$RNA)))
limiric <- NormalizeData(limiric, verbose = FALSE) %>%
FindVariableFeatures(verbose = FALSE) %>%
ScaleData(verbose = FALSE) %>%
RunPCA(verbose = FALSE) %>%
FindNeighbors(dims = 1:10, verbose = FALSE) %>%
FindClusters(resolution = resolution, verbose = FALSE) %>%
RunTSNE(dims = 1:10, verbose = FALSE, check_duplicates = FALSE)
limiric <- NormalizeData(limiric) %>%
FindVariableFeatures() %>%
ScaleData() %>%
RunPCA() %>%
FindNeighbors(dims = 1:10) %>%
FindClusters(resolution = 0.6) %>%
RunTSNE(dims = 1:10, check_duplicates = FALSE)
data("limiric")
usethis::use_data(limiric)
test_data_reduced <- limiric
usethis::use_data(test_data_reduced)