how to do TSNEPlot which differentiate the sample and cluster at the same time in scRNA-seq data?
1
0
Entering edit mode
5.6 years ago
biologo ▴ 40

Dear all,

I am still working on the scRNA-seq data(mixed 5 sets of data), and meet one more problem, after i use the k-means and t-SNE plot function,the figure what i can see the cluster grouped by sample or by by natural color.

TSNEPlot(object = object)
TSNEPlot(object = object,group.by="stim")

i wanna to know is that possible to show that only the sample1 cells(ot all of the sample) in one specific cluster, which like cluster 1 or 2 ?

scRNA-seq • 3.9k views
ADD COMMENT
0
Entering edit mode
5.6 years ago
AB ▴ 360

I'm sorry I don't really understand your question. If you mean highlight one specific cluster in the tsne, you can use the cells.highlight argument. So first select the cells you want to highlight (lets say cluster 1) and then plot it.

cells=names(onject@ident[object@ident==1])
plot=TSNEPlot(object = object, cells.highlight=cells,group.by = "stim")

Keep in mind that your object@ident should be the same as grouping variable "stim". If not, just extract the cell names from the metadata

 cells= rownames(object@meta.data[object@meta.data$cluster==1,]]

If what you mean is just color the tsne plot by sample, then just change the group.by argument to 'sample'. group.by argument in TSNEPlot can take any column name that is in object@meta.data. So if your metadata specifies which cell barcode is which sample, you can color by that. And if you need both sample and cluster, create a new column in the metadata that combines cluster and sample so that you have sample1_cluster1, sample1_cluster2, sample2_cluster1..etc

Hope this helps!

ADD COMMENT

Login before adding your answer.

Traffic: 2838 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6