Skip to content

Instantly share code, notes, and snippets.

@ryamada22
Last active June 2, 2019 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryamada22/98b373192198593ed08515c16364c3a6 to your computer and use it in GitHub Desktop.
Save ryamada22/98b373192198593ed08515c16364c3a6 to your computer and use it in GitHub Desktop.
---
title: "GEOからのデータの取得"
output: html_document
---
### GEOからデータを取ってくる
[GEOから遺伝子発現データを取ってくる](https://qiita.com/motthy/items/468e338c59c7d3dcd0d0)をなぞる形で大規模遺伝子発現データを取ってきてみます
それなりのツールとして提供されていますが、それなりに面倒くさいです。
とはいえ、自分で全部コードを書くよりは速いでしょう。
```{r}
# install.packages(c("Biobase","BiocManager","data.table")c
# BiocManager::install("GEOquery")
```
```{r}
library(Biobase)
library(GEOquery)
library(data.table)
```
```{r}
#gsem <- getGEO("GSE59143",GSEMatrix = T)
#gse <- getGEO("GSE59143",GSEMatrix = F)
```
```{r}
#save(dat,file = "GSE59143.Rdata")
```
すでに時間のかかるダウンロード処理は終えて、.Rdataファイルとして保管してあるので、読み込むだけにしておいた。
そのためのコードライン。
```{r}
load(file = "GSE59143.Rdata")
```
```{r}
x <- pData(phenoData(gsem[[1]]))
y <- gse@gsms
dat <- Table(y[[1]])
dat <- dat[,1:2]
for (i in 2:length(y)){
sub_dat <- Table(y[[i]])
dat <- cbind(dat,sub_dat[,2])
}
dat <- data.frame(dat,row.names = 1)
colnames(dat) <- x$geo_accession
```
```{r}
image(as.matrix(dat))
```
```{r}
cor.mat <- cor(as.matrix(dat))
image(cor.mat)
```
```{r}
d <- dist(t(as.matrix(dat)))
plot(hclust(d))
```
```{r}
#heatmap(as.matrix(dat))
```
```{r}
#save(dat,file = "GSE59143.Rdata")
```
```{r}
#load(file = "GSE59143.Rdata")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment