This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.
load teh data and packs
library(conos) require(pagoda2) library(fuck) library(pheatmap) panel <- readRDS(file.path('/home/larsc/pancreas_smart_seq_cms.rds')) annot <- readRDS(file.path('/home/larsc/pancreas_smart_seq_design_info.rds'))
panel.preprocessed <- lapply(panel, basicP2proc, n.cores=25, min.cells.per.gene=0, n.odgenes=2e3, get.largevis=FALSE, make.geneknn=FALSE)
make conos object
con <- Conos$new(panel.preprocessed, n.cores=1)
con$plotPanel(clustering="multilevel", use.local.clusters=T, title.size=6)
con$buildGraph(k=15, k.self=10, k.self.weight=0.1, space='PCA', ncomps=50, n.odgenes=2000, matching.method='mNN', metric='angular', verbose=TRUE)
con$findCommunities(method=multilevel.community, min.group.size=0) con$plotPanel(font.size=4)
Plotting with annotation just because
cellannot=as.data.frame(annot[,c(1,8)]) cellannot <- setNames(cellannot[,2],cellannot[,1]) con$plotPanel(groups = cellannot,font.size=3)
disannot=as.data.frame(annot[,c(1,9)]) disannot_names <- setNames(disannot[,2],disannot[,1]) con$plotPanel(groups = disannot_names,font.size=2)
con$plotGraph(groups=disannot_names)
DE
samplegroups=fuck::CreateSampleGroups(annot, 9, 6) de.multilevel <- getPerCellTypeDE(con, groups=as.factor(cellannot),sample.groups = samplegroups, ref.level='normal', n.cores=1)
head(de.multilevel$`acinar cell`$res)
mostvar = GetMostvar(de.multilevel, 15)
heatmap
con$plotGraph(groups=cellannot) con$plotGraph(gene = "PRSS1")
filter annotation
annot_filter <- fuck::FilterAnnot(con, annot, 1)
subtype_exps <- fuck::GetSubtypeExp(con, mostvar, annot_filter, 8, 1) pheatmap(mat = subtype_exps,clustering_distance_cols = 'euclidean', clustering_distance_rows = 'euclidean')
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).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.