Demonstration for assigning cell type

Reading in required package and R scripts

source("../R/celltype_assign.R")
atlas_markers = Build.Ref.Markers(path =  "..//data/jay_cell_markers.txt",sep = '\t',splitter = c("[[:punct:]]","[[:space:]]"))
head(atlas_markers)

Reading Seurat Output Used also as ShinyApp interactive session input

seurat.out.neg = readRDS('../ShinyDiff_multi/input/WTKICD45NEG_out.rds')
seurat.out.neg$conserved.markers

Build the experimental marker from conserved marker list of seurat output

# filter only the positive fold change conserve markers with a max_pval threshold of 0.05
exp.markers.neg = seurat.out.neg$conserved.markers %>% filter(wni_avg_logFC > 0 & max_pval <= 0.05)
# rename the first row as gene for the pipeline to run 
colnames(exp.markers.neg)[1] = "gene"

# Insert a column "avg_logFC" as the average of fold change of a marker across 4 different conditions, note that this avg_LogFC field name is necessary for running the pipeline
exp.markers.neg = exp.markers.neg %>% mutate(avg_logFC = (wni_avg_logFC+wti_avg_logFC+kii_avg_logFC+kini_avg_logFC)/4)
head(exp.markers.neg)

# creat a experiemental marker set
exp.markers.neg = Build.Exp.Markers(exp.markers.neg)
head(exp.markers.neg)

Run Assign.Cluster.Type for cell type assignment

celltype.atlas.neg = Assign.Cell.Type(ref.markers = atlas_markers,exp.markers = exp.markers.neg)
head(celltype.atlas.neg)
# save assignment list to a desire directory
write.csv(celltype.atlas.neg,file = "../../MAP3K3/output/190815/CD45NEG_atlas.csv")


steveyu323/SEURATEXT documentation built on Nov. 5, 2019, 9:38 a.m.