更新 RNA-arry.R
This commit is contained in:
parent
d8fdaa0208
commit
2f3e8397e9
10
RNA-arry.R
10
RNA-arry.R
@ -1,5 +1,5 @@
|
|||||||
## Written By LiShang
|
## Written By LiShang
|
||||||
## Notice:适用于基因芯片平台
|
## Notice: 适用于基因芯片平台
|
||||||
|
|
||||||
#加载依赖包
|
#加载依赖包
|
||||||
library(GEOquery)
|
library(GEOquery)
|
||||||
@ -19,11 +19,11 @@ exp <- exprs(gse)
|
|||||||
grp <- pData(gse)
|
grp <- pData(gse)
|
||||||
|
|
||||||
###表达矩阵数据前处理
|
###表达矩阵数据前处理
|
||||||
#将表达矩阵的行名(探针ID)转换为Gene Symbol
|
#将表达矩阵的行名(探针ID)转换为Gene Symbol
|
||||||
#方法一:直接从GEO拿数据,好处是方便快捷,通用性高
|
#方法一: 直接从GEO拿数据, 好处是方便快捷, 通用性高
|
||||||
gene_symbols <- fData(gse)[,c("ID","Gene Symbol")]
|
gene_symbols <- fData(gse)[,c("ID","Gene Symbol")]
|
||||||
gene_symbols <- setNames(gene_symbols$`Gene Symbol`,gene_symbols$ID)[rownames(exp)]
|
gene_symbols <- setNames(gene_symbols$`Gene Symbol`,gene_symbols$ID)[rownames(exp)]
|
||||||
#方法二:通过芯片提供的R包拿数据,数据不如GEO的全,好处是基因名短
|
#方法二: 通过芯片提供的R包拿数据, 数据不如GEO的全, 好处是基因名短
|
||||||
#install.packages("hgu133a.db")
|
#install.packages("hgu133a.db")
|
||||||
library(hgu133a.db)
|
library(hgu133a.db)
|
||||||
gene_symbols <- toTable(hgu133aSYMBOL)[,c("probe_id","symbol")]
|
gene_symbols <- toTable(hgu133aSYMBOL)[,c("probe_id","symbol")]
|
||||||
@ -35,7 +35,7 @@ rownames(exp) <- exp$Group.1
|
|||||||
exp <- exp[, -1]
|
exp <- exp[, -1]
|
||||||
|
|
||||||
###样本分组数据前处理
|
###样本分组数据前处理
|
||||||
#将样本按pData$title分为normal组和cancer组,并转换为factor
|
#将样本按pData$title分为normal组和cancer组, 并转换为factor
|
||||||
grp <- grp[colnames(exp),]
|
grp <- grp[colnames(exp),]
|
||||||
grp <- ifelse(str_detect(grp$title,"Normal"),"normal","cancer") %>%
|
grp <- ifelse(str_detect(grp$title,"Normal"),"normal","cancer") %>%
|
||||||
factor(c("normal","cancer"))
|
factor(c("normal","cancer"))
|
||||||
|
Loading…
Reference in New Issue
Block a user