in-lineage icon indicating copy to clipboard operation
in-lineage copied to clipboard

How I can assignment of precursor cells to adult subtypes after integrating both datasets in Seurat V3?

Open Sophia409 opened this issue 5 years ago • 1 comments

Hello, Recently I have read you paper which called "Developmental diversification of cortical inhibitory interneurons". And I want to follow your pipeline to assign precursor cells to adult subtypes in my data. Since Seurat has updated to V3, IntegrateData has replaced RunCCA-AlignSubspace function. So wondering in this version, how I can assignment of precursor cells to adult subtypes after integrating both datasets? I read your Script 2_cell_assignment.R in github,and try to modify MapCells (as shown below) function to v3 verison. But because I'm a new PhD and a new comer in R language, I have tried my best and still couldn't finish this task. I will be much appreciated if you can show me the updated code to Perform this function. Looking forward to your help Sophia image

# this script performs the following steps:
# 1) assignment of precursor cells to adult subtypes
# 3) visualization of assignment - cardinal types 
# 4) visualization of assignment - subtypes
# related to Fig.4 B-D) lower part and Extended Data Figure 9

library(pbapply)
# assign precursor cells to adult subtypes
MapCells=function(object, timepoint.dev="P10", timepoint.end="P56", num.k=10, thresh.require=0.9,map.col="AdultTypes1",new.col="Map1") {
  [email protected]$RunTSNE$dims.use
  input.dims=GetCellEmbeddings(object,reduction.type = "cca.aligned",dims.use = tsne.dims)
  input.dist=as.matrix(dist(input.dims))
  cells.end=FastWhichCells(object,"DevStage",timepoint.end)
  cells.map=FastWhichCells(object,"DevStage",timepoint.dev)
  map.id=pbsapply(cells.map,function(x)
    names(which(sort(table([email protected][names(sort(input.dist[x,cells.end])[1:num.k]),map.col]),decreasing = T)>=num.k*thresh.require))[1])
  nn.same=pbsapply(cells.map, function(x) length(intersect(names(sort(input.dist[x,])[1:num.k]),cells.map)))
  print(table(map.id))
  map.id[is.na(map.id)]="Unassigned"
  map.id[names(which(nn.same>=num.k*1))]="Unassigned"
  print(table(map.id))
  [email protected][cells.end,new.col][email protected][cells.end,map.col]
  [email protected][cells.map,new.col]=map.id
  return(object)
} 

Sophia409 avatar Sep 14 '19 15:09 Sophia409

Hi Sophia,

May I ask where did you find the "Script 2_cell_assignment.R" and also where did you find the file you take the snipping? I also want to have a look at it.

Thanks!

shux999 avatar Dec 06 '19 22:12 shux999