edroaldo / cellrouter

Reconstruction of complex single-cell trajectories using CellRouter
45 stars 21 forks source link

Creating a clean featureplot #16

Open beginner984 opened 6 years ago

beginner984 commented 6 years ago

Sorry,

This is not a problem with your nice software rather my own problem.

I noticed by plotDRExpression function we can plot a list of genes very clean because you are using a sort of centring I guess (-2,2).

You please imagine that, I have made 3 clusters of cells (clusters 1, 2 and 3) . I expect if I plot a list of marker genes across these three clusters, only cluster 1 should be lighted up because these marker genes supposed to be specific to cluster 1. Is there any way to use your plotDRExpression function for a list of genes but not each of them individually rather something like mean of expression of them or whatever by which I could have such a nice featureplot showing the expression of these genes?

I tried seurat like below code but my way of centring another clusters also being lighted up that I don't want

mat=seurat_object@data[rownames(seurat_object@data)%in%rownames(gene_list),]   

#I have converted expression matrix to a binary matrix by 2 as a threshold (arbitrarily)

mat[mat < 2] <- 0

mat[mat > 2] <- 1

exp=colSums(mat)

exp=as.matrix(exp)

colnames(exp)="value"

exp=as.data.frame(exp)

cc <- AddMetaData(object = surat_object, metadata = exp)

cc <- SetAllIdent(object = cc, id = "value")

TSNEPlot(object = cc, do.return= TRUE)

ggplot(as.data.frame(cc@meta.data), aes(x = cc@meta.data$CELL, y = cc@meta.data$res.0.7, colour =cc@meta.data$value)) + 
       geom_point(size = 9) +
      scale_colour_gradient(low = "yellow", high = "blue")

Thanks a lot for any help