library(tidyverse)
Registered S3 methods overwritten by 'dbplyr':
method from
print.tbl_lazy
print.tbl_sql
[30m── [1mAttaching packages[22m ──────── tidyverse 1.3.0 ──[39m
[30m[32m✓[30m [34mtibble [30m 3.0.6 [32m✓[30m [34mpurrr [30m 0.3.4
[32m✓[30m [34mtidyr [30m 1.1.2 [32m✓[30m [34mstringr[30m 1.4.0
[32m✓[30m [34mreadr [30m 1.4.0 [32m✓[30m [34mforcats[30m 0.5.1[39m
[30m── [1mConflicts[22m ─────────── tidyverse_conflicts() ──
[31mx[30m [34mpurrr[30m::[32m%@%()[30m masks [34mrlang[30m::%@%()
[31mx[30m [34mpurrr[30m::[32mas_function()[30m masks [34mrlang[30m::as_function()
[31mx[30m [34mdplyr[30m::[32mcollapse()[30m masks [34mIRanges[30m::collapse()
[31mx[30m [34mdplyr[30m::[32mcombine()[30m masks [34mBiobase[30m::combine(), [34mBiocGenerics[30m::combine()
[31mx[30m [34mdplyr[30m::[32mcount()[30m masks [34mmatrixStats[30m::count()
[31mx[30m [34mdplyr[30m::[32mdesc()[30m masks [34mIRanges[30m::desc()
[31mx[30m [34mtidyr[30m::[32mexpand()[30m masks [34mS4Vectors[30m::expand()
[31mx[30m [34mrlang[30m::[32mexprs()[30m masks [34mBiobase[30m::exprs()
[31mx[30m [34mdplyr[30m::[32mfilter()[30m masks [34mstats[30m::filter()
[31mx[30m [34mdplyr[30m::[32mfirst()[30m masks [34mS4Vectors[30m::first()
[31mx[30m [34mpurrr[30m::[32mflatten()[30m masks [34mrlang[30m::flatten()
[31mx[30m [34mpurrr[30m::[32mflatten_chr()[30m masks [34mrlang[30m::flatten_chr()
[31mx[30m [34mpurrr[30m::[32mflatten_dbl()[30m masks [34mrlang[30m::flatten_dbl()
[31mx[30m [34mpurrr[30m::[32mflatten_int()[30m masks [34mrlang[30m::flatten_int()
[31mx[30m [34mpurrr[30m::[32mflatten_lgl()[30m masks [34mrlang[30m::flatten_lgl()
[31mx[30m [34mpurrr[30m::[32mflatten_raw()[30m masks [34mrlang[30m::flatten_raw()
[31mx[30m [34mpurrr[30m::[32minvoke()[30m masks [34mrlang[30m::invoke()
[31mx[30m [34mdplyr[30m::[32mlag()[30m masks [34mstats[30m::lag()
[31mx[30m [34mpurrr[30m::[32mlist_along()[30m masks [34mrlang[30m::list_along()
[31mx[30m [34mpurrr[30m::[32mmodify()[30m masks [34mrlang[30m::modify()
[31mx[30m [34mggplot2[30m::[32mPosition()[30m masks [34mBiocGenerics[30m::Position(), [34mbase[30m::Position()
[31mx[30m [34mpurrr[30m::[32mprepend()[30m masks [34mrlang[30m::prepend()
[31mx[30m [34mpurrr[30m::[32mreduce()[30m masks [34mGenomicRanges[30m::reduce(), [34mIRanges[30m::reduce()
[31mx[30m [34mdplyr[30m::[32mrename()[30m masks [34mS4Vectors[30m::rename()
[31mx[30m [34mpurrr[30m::[32msimplify()[30m masks [34mDelayedArray[30m::simplify()
[31mx[30m [34mdplyr[30m::[32mslice()[30m masks [34mIRanges[30m::slice()
[31mx[30m [34mpurrr[30m::[32msplice()[30m masks [34mrlang[30m::splice()[39m
PrctCellExpringGene <- function(object, genes, group.by = "all"){
if(group.by == "all"){
prct = unlist(lapply(genes,calc_helper, object=object))
result = data.frame(Markers = genes, Cell_proportion = prct)
return(result)
}
else{
list = SplitObject(object, group.by)
factors = names(list)
results = lapply(list, PrctCellExpringGene, genes=genes)
for(i in 1:length(factors)){
results[[i]]$Feature = factors[i]
}
combined = do.call("rbind", results)
return(combined)
}
}
calc_helper <- function(object,genes){
counts = object[['RNA']]@counts
ncells = ncol(counts)
if(genes %in% row.names(counts)){
sum(counts[genes,]>0)/ncells
}else{return(NA)}
}
genes_10 <- genes_10prct$Markers
Error: object 'genes_10prct' not found
tryp_subset <- subset(tryp, subset = cluster == c("LS A", "LS B"))
longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length
tryp_subset <- subset(tryp, subset = cluster == c("LS A", "LS B"))
longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length
tryp_subset <- RunUMAP(tryp_subset, dims = 1:8, reduction = "pca", min.dist = 0.1)
12:55:33 UMAP embedding parameters a = 1.577 b = 0.8951
12:55:33 Read 996 rows and found 8 numeric columns
12:55:33 Using Annoy for neighbor search, n_neighbors = 30
12:55:33 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
12:55:33 Writing NN index file to temp file /var/folders/rd/tjq29jm572b7j_j3fg5k_s340000gn/T//RtmpyjyWIo/file14b5387342dd
12:55:33 Searching Annoy index using 1 thread, search_k = 3000
12:55:33 Annoy recall = 100%
12:55:34 Commencing smooth kNN distance calibration using 1 thread
12:55:36 Initializing from normalized Laplacian + noise
12:55:36 Commencing optimization for 500 epochs, with 40024 positive edges
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
12:55:38 Optimization finished
tryp_subset <- subset(tryp, subset = cluster == c("LS A", "LS B"))
longer object length is not a multiple of shorter object lengthlonger object length is not a multiple of shorter object length
tryp_subset <- RunUMAP(tryp_subset, dims = 1:8, reduction = "pca", min.dist = 0.1)
12:55:39 UMAP embedding parameters a = 1.577 b = 0.8951
12:55:39 Read 996 rows and found 8 numeric columns
12:55:39 Using Annoy for neighbor search, n_neighbors = 30
12:55:39 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
12:55:39 Writing NN index file to temp file /var/folders/rd/tjq29jm572b7j_j3fg5k_s340000gn/T//RtmpyjyWIo/file14b5172ad81f
12:55:39 Searching Annoy index using 1 thread, search_k = 3000
12:55:39 Annoy recall = 100%
12:55:40 Commencing smooth kNN distance calibration using 1 thread
12:55:42 Initializing from normalized Laplacian + noise
12:55:42 Commencing optimization for 500 epochs, with 40024 positive edges
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
12:55:45 Optimization finished
DimPlot(tryp_subset, reduction = "umap", label = FALSE,
label.size = 4,
pt.size = 0.5, group.by = "Phase", cols = mycolours) + UMAP_theme
Error: Insufficient values in manual scale. 5 needed but only 4 provided.
[90mRun `rlang::last_error()` to see where the error occurred.[39m
lines(SlingshotDataSet(sce), col = "black", lwd = 2)
Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet
PART THREE
plot(rd, pch=16, col = mycolours[as.factor(tryp_subset$Phase)] ) +
theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"), panel.background = element_blank(),
plot.title = element_text(size = 10, face = "bold"), axis.text.x = element_text(size = 8), axis.title.x = element_text(size = 9), axis.title.y = element_text(size = 9), axis.text.y = element_text(size = 8))
NULL
plot(rd, pch=16, col = mycolours[as.factor(tryp_subset$Phase)] ) + theme(panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.line = element_line(colour = “black”), panel.background = element_blank(), plot.title = element_text(size = 10, face = “bold”), axis.text.x = element_text(size = 8), axis.title.x = element_text(size = 9), axis.title.y = element_text(size = 9), axis.text.y = element_text(size = 8))
lines(x=pcc\(s[order(pcc\)lambda),1], y=pcc\(s[order(pcc\)lambda),2], col=“black”, lwd=2)
gamList <- fitGAM(counts, pseudotime=pseudoT, cellWeights=cWeights, nknots=5)
| | 0 % ~calculating
|+ | 1 % ~39m 14s
|+ | 2 % ~28m 37s
|++ | 3 % ~21m 54s
|++ | 4 % ~18m 55s
|+++ | 5 % ~17m 16s
|+++ | 6 % ~15m 28s
|++++ | 7 % ~14m 47s
|++++ | 8 % ~14m 19s
|+++++ | 9 % ~13m 23s
|+++++ | 10% ~12m 41s
|++++++ | 11% ~12m 05s
|++++++ | 12% ~11m 28s
|+++++++ | 13% ~11m 19s
|+++++++ | 14% ~10m 58s
|++++++++ | 15% ~10m 36s
|++++++++ | 16% ~10m 19s
|+++++++++ | 17% ~10m 21s
|+++++++++ | 18% ~10m 01s
|++++++++++ | 19% ~10m 53s
|++++++++++ | 20% ~10m 40s
|+++++++++++ | 21% ~10m 23s
|+++++++++++ | 22% ~10m 10s
|++++++++++++ | 23% ~09m 55s
|++++++++++++ | 24% ~10m 22s
|+++++++++++++ | 25% ~10m 22s
|+++++++++++++ | 26% ~10m 03s
|++++++++++++++ | 27% ~09m 49s
|++++++++++++++ | 28% ~09m 31s
|+++++++++++++++ | 29% ~09m 20s
|+++++++++++++++ | 30% ~09m 04s
|++++++++++++++++ | 31% ~08m 50s
|++++++++++++++++ | 32% ~08m 38s
|+++++++++++++++++ | 33% ~08m 24s
|+++++++++++++++++ | 34% ~08m 16s
|++++++++++++++++++ | 35% ~08m 03s
|++++++++++++++++++ | 36% ~07m 52s
|+++++++++++++++++++ | 37% ~07m 46s
|+++++++++++++++++++ | 38% ~07m 34s
|++++++++++++++++++++ | 39% ~07m 23s
|++++++++++++++++++++ | 40% ~07m 11s
|+++++++++++++++++++++ | 41% ~07m 00s
|+++++++++++++++++++++ | 42% ~06m 49s
|++++++++++++++++++++++ | 43% ~06m 39s
|++++++++++++++++++++++ | 44% ~06m 29s
|+++++++++++++++++++++++ | 45% ~06m 27s
|+++++++++++++++++++++++ | 46% ~06m 28s
|++++++++++++++++++++++++ | 47% ~06m 20s
|++++++++++++++++++++++++ | 48% ~06m 10s
|+++++++++++++++++++++++++ | 49% ~05m 60s
|+++++++++++++++++++++++++ | 50% ~05m 51s
|++++++++++++++++++++++++++ | 51% ~05m 41s
|++++++++++++++++++++++++++ | 52% ~05m 32s
|+++++++++++++++++++++++++++ | 53% ~05m 23s
|+++++++++++++++++++++++++++ | 54% ~05m 15s
|++++++++++++++++++++++++++++ | 55% ~05m 33s
|++++++++++++++++++++++++++++ | 56% ~05m 23s
|+++++++++++++++++++++++++++++ | 57% ~05m 17s
|+++++++++++++++++++++++++++++ | 58% ~05m 09s
|++++++++++++++++++++++++++++++ | 59% ~05m 01s
|++++++++++++++++++++++++++++++ | 60% ~04m 52s
|+++++++++++++++++++++++++++++++ | 61% ~04m 44s
|+++++++++++++++++++++++++++++++ | 62% ~04m 41s
|++++++++++++++++++++++++++++++++ | 63% ~04m 35s
|++++++++++++++++++++++++++++++++ | 64% ~04m 26s
|+++++++++++++++++++++++++++++++++ | 65% ~04m 18s
|+++++++++++++++++++++++++++++++++ | 66% ~04m 10s
|++++++++++++++++++++++++++++++++++ | 67% ~04m 02s
|++++++++++++++++++++++++++++++++++ | 68% ~03m 53s
|+++++++++++++++++++++++++++++++++++ | 69% ~03m 45s
|+++++++++++++++++++++++++++++++++++ | 70% ~03m 39s
|++++++++++++++++++++++++++++++++++++ | 71% ~03m 31s
|++++++++++++++++++++++++++++++++++++ | 72% ~03m 29s
|+++++++++++++++++++++++++++++++++++++ | 73% ~03m 28s
|+++++++++++++++++++++++++++++++++++++ | 74% ~03m 26s
|++++++++++++++++++++++++++++++++++++++ | 75% ~03m 23s
|++++++++++++++++++++++++++++++++++++++ | 76% ~03m 19s
|+++++++++++++++++++++++++++++++++++++++ | 77% ~03m 18s
|+++++++++++++++++++++++++++++++++++++++ | 78% ~03m 15s
|++++++++++++++++++++++++++++++++++++++++ | 79% ~03m 05s
|++++++++++++++++++++++++++++++++++++++++ | 80% ~02m 57s
|+++++++++++++++++++++++++++++++++++++++++ | 81% ~02m 47s
|+++++++++++++++++++++++++++++++++++++++++ | 82% ~02m 37s
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~02m 28s
|++++++++++++++++++++++++++++++++++++++++++ | 84% ~02m 18s
|+++++++++++++++++++++++++++++++++++++++++++ | 85% ~02m 09s
|+++++++++++++++++++++++++++++++++++++++++++ | 86% ~01m 60s
|++++++++++++++++++++++++++++++++++++++++++++ | 87% ~01m 51s
|++++++++++++++++++++++++++++++++++++++++++++ | 88% ~01m 42s
|+++++++++++++++++++++++++++++++++++++++++++++ | 89% ~01m 33s
|+++++++++++++++++++++++++++++++++++++++++++++ | 90% ~01m 24s
|++++++++++++++++++++++++++++++++++++++++++++++ | 91% ~01m 15s
|++++++++++++++++++++++++++++++++++++++++++++++ | 92% ~01m 07s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 93% ~58s
|+++++++++++++++++++++++++++++++++++++++++++++++ | 94% ~50s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 95% ~41s
|++++++++++++++++++++++++++++++++++++++++++++++++ | 96% ~33s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 97% ~25s
|+++++++++++++++++++++++++++++++++++++++++++++++++ | 98% ~17s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 99% ~09s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=15m 09s
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.