TCGAbiolinks icon indicating copy to clipboard operation
TCGAbiolinks copied to clipboard

How to use Rtsne() to make 3D-Tsne for TCGA methylation data

Open biobug16 opened this issue 4 years ago • 0 comments

Hi @tiagochst and All, I am new with TCGA data and interested to plot 3D-Tsne using methylation data from TCGA. Below is my snippet for 2D Tsne plot. Can you please guide how can I improvise my script for using Rtsne() to make 3D Tsne plot?

library(TCGAbiolinks)
library(ggplot2)
library(SummarizedExperiment)
library(modelTsne)
set.seed(7)

kirc=assay(readRDS("TCGA-KIRC.RDS"))
kirp=assay(readRDS("TCGA-KIRP.RDS"))
kich=assay(readRDS("TCGA-KICH.RDS"))

data=cbind(kirc, kirp, kich)
mydata <- na.omit(data)

group<-c(rep("KIRC",485),rep("KIRP",321),rep("KICH",66))
meth<-selectVariables(data=mydata, method="IQR", no.variables=20000)
tsne<-modelTsne(data=meth, perplexity=30, group=group)
tsne_plot <- data.frame(x = tsne$df.tsne$tsne.dim1,y=tsne$df.tsne$tsne.dim2, col = group)
ggplot(tsne_plot) + geom_point(aes(x=x, y=y, color=col))
dev.off()


Thanks

biobug16 avatar Jun 25 '20 16:06 biobug16