Question: TSNE code for dimensionality reduction
gravatar for krushnach80
2.3 years ago by
krushnach80630 wrote:

Im using this code for running t-sne . I want to do the t-sne on my whole data frame So is there way to label my points that are being clustered and as well as label them with different colours to make them visually differentiable .

These are my samples CMP_6792" "CMP_7256" "CMP_7653" "GMP_6792" "GMP_7256" "GMP_7653" "HSC_6792" "HSC_7256" "HSC_7653" "Mono_6792" "Mono_7256" "Mono_7653" "Gran1" "Gran2 I would like to label my points according to the above mentioned sample.

Here is my code

file1<- read.csv('PRIMARY_CELL_EPILIST.csv')
dat <- data.frame(file1)
rownames(file1) <- make.names(file1[,1], unique = TRUE)
data <- file1[,2:15]
tsne1 <- tsne(scale(data), perplexity = 10,max_iter = 300)
plot(tsne1[, 1], tsne1[, 2])

plotdata <- data.frame(tsne_x = tsne1[, 1], tsne_y = tsne1[, 2])
plt1 <- ggplot(plotdata) + geom_point(aes(x = tsne_x, y = tsne_y))

So any help or suggestion as well as improvement over my code would be highly appreciated .

I would like to label like the tsne plot in the link

rna-seq R • 1.5k views
ADD COMMENTlink modified 2.3 years ago • written 2.3 years ago by krushnach80630

You're basically asking how to colour data points in R using ggplot2 (hint: look at the color argument to aes()). This is not an R programming forum. You should try StackOverflow where the question may have already been asked and answered. Also if you include a figure, at least tell us what it is.

ADD REPLYlink written 2.3 years ago by Jean-Karim Heriche21k

well in stackoverflow i dont have enough reputation to post question. Meanwhile the figure is from blood paper where they are defining cell type based on gene expression , they did PCA and t-sne ,t-sne is better when it comes to define the cell type based on expression as compared to PCA. The figure which says tsne1 and tsne2 . I am trying to do something like that...

But i would be glad if anyone can suggest me or else I will try to solve

ADD REPLYlink written 2.3 years ago by krushnach80630
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1253 users visited in the last hour