Question: TSNE code for dimensionality reduction
0
gravatar for krushnach80
20 months ago by
krushnach80470
krushnach80470 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')
head(file1)
names(file1)
class(file1)
dat <- data.frame(file1)
rownames(file1) <- make.names(file1[,1], unique = TRUE)
head(file1)
dim(file1)
data <- file1[,2:15]
head(data)
library(tsne)
tsne1 <- tsne(scale(data), perplexity = 10,max_iter = 300)
plot(tsne1[, 1], tsne1[, 2])

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

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.1k views
ADD COMMENTlink modified 20 months ago • written 20 months ago by krushnach80470

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 20 months ago by Jean-Karim Heriche18k

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 20 months ago by krushnach80470
Please log in to add an answer.

Help
Access

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