forked from scfurl/viewmaster
-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start Tutorial
Olivia Waltner edited this page Aug 15, 2022
·
5 revisions
1) load greenleaf MPAL dataset into monocle3
mpal<-readRDS(file ="/Volumes/fh/fast/furlan_s/grp/data/ddata/BM_data/healthy_bone_marrow_greenleaf.rds")
plot_cells(mpal, color_cells_by = "BioClassification", label_cell_groups = F)+scale_color_manual(values = sfc(n = 26))

2) load hca bone marrow seurat object, convert to monocle using viewmaster's helpful function
hca<-readRDS(file = "/Volumes/fh/fast/furlan_s/grp/data/ddata/BM_data/palantir_bm_r1.rds")
hca<-seurat_to_monocle3(hca, seu_rd = "tsne")
plot_cells(hca , color_cells_by = "cell_annotation", label_cell_groups = F)+scale_color_manual(values = sfc(10, scramble = F))
3)
Detect common variant genes between two cell data sets
vg<-common_variant_genes(mpal, hca, top_n = 5000)
4)
Use softmax regression for viewmaster. We will use the Greenleaf lab's MPAL healthy bone marrow cell annotations and transfer them to Human Cell Atals of bone marrow
view<-viewmaster(ref_cds = mpal, query_cds = hca, ref_celldata_col = "BioClassification", selected_genes = vg, verbose=T, FUNC = "softmax_regression", tf_idf = F)
plot_cells(view, color_cells_by = "smr_celltype", label_cell_groups = F)+scale_color_manual(values = sfc(11))

code wrapped from Sam Behjati
hca_seu<-monocle3_to_seurat(hca)
mpal_seu<-monocle3_to_seurat(mpal, mon_rd = "UMAP")
log_mat<-log_reg_matrix(trainDat = mpal_seu, testDat = hca_seu, trainClass = "BioClassification", testClass = "cell_annotation", downsample = 500)
testDat<- loadTrainingData(hca_seu)
clusterPreds = apply(log_mat,2,function(e) sapply(split(e,testDat$mDat[["cell_annotation"]]),mean))
#Convet to percentages
clusterPreds = (1+exp(-clusterPreds))**-1
pheatmap(clusterPreds, cluster_cols=T,cluster_rows = T ,col = ArchR::paletteContinuous("coolwarm", n=10, reverse = F), border_color = "black")
