Skip to content

Instantly share code, notes, and snippets.

@seandavi
Last active June 8, 2022 17:15
Show Gist options
  • Save seandavi/21aba76ff7732c3c253ccb987266dd3c to your computer and use it in GitHub Desktop.
Save seandavi/21aba76ff7732c3c253ccb987266dd3c to your computer and use it in GitHub Desktop.
GEOquery play
## -----------------------------------------------------------------------------
## GEOquery
## -----------------------------------------------------------------------------
library(GEOquery)
gse = getGEO("GSE103512")[[1]]
## -----------------------------------------------------------------------------
library(SummarizedExperiment)
se = as(gse, "SummarizedExperiment")
## ----geoquery20,echo=TRUE,cache=TRUE------------------------------------------
with(colData(se),table(`cancer.type.ch1`,`normal.ch1`))
## ----sds,cache=TRUE,echo=TRUE-------------------------------------------------
sds = apply(assay(se, 'exprs'),1,sd)
dat = assay(se, 'exprs')[order(sds,decreasing = TRUE)[1:500],]
## ----mds,echo=TRUE,cache=TRUE-------------------------------------------------
mdsvals = cmdscale(dist(t(dat)))
mdsvals = as.data.frame(mdsvals)
mdsvals$Type=factor(colData(se)[,'cancer.type.ch1'])
mdsvals$Normal = factor(colData(se)[,'normal.ch1'])
## ----mdsplot,echo=TRUE,fig.align='center'-------------------------------------
library(ggplot2)
ggplot(mdsvals, aes(x=V1,y=V2,shape=Normal,color=Type)) +
geom_point( alpha=0.6) + theme(text=element_text(size = 18))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment