100个GEO基因表达芯片或转录组数据处理GSE35570(011)

alt

写在前边

虽然现在是高通量测序的时代,但是GEO、ArrayExpress等数据库储存并公开大量的基因表达芯片数据,还是会有大量的需求去处理芯片数据,并且建模或验证自己所研究基因的表达情况,芯片数据的处理也可能是大部分刚学生信的道友入门R语言数据处理的第一次实战,因此准备更新100个基因表达芯片或转录组高通量数据的处理。

数据信息检索

可以看到GSE35570是基因表达芯片数据,因此可以使用GEOquery包下载数! alt

使用GEOquery包下载数据

using(tidyverse, GEOquery, magrittr, data.table, AnnoProbe, clusterProfiler, org.Hs.eg.db, org.Mm.eg.db)

注:using是我写的函数,有需要可以联系我加入交流群;using作用是一次性加载多个R包,不用写双引号,并且不在屏幕上打印包的加载信息

因为文件太大,在R内下载失败,可通过图片中的方法下载文件,GEOquery::getGEO直接读取本地的文件。

geo_accession <- "GSE35570"
eSet <- getGEO(filename=stringr::str_glue('{geo_accession}_series_matrix.txt.gz'), AnnotGPL = F, getGPL = F)
gpl <- eSet@annotation
alt
alt

处理表型数据

这部分是很关键的,可以筛选一下分组表型信息,只保留自己需要的样本,作为后续分析的样本(根据自己的研究目的筛选符合要求的样本)

geo_accessionage at ptc operation:ch1batch:ch1braf v600e mutation:ch1exposure to chernobyl radiation:ch1region of residence:ch1ret/ptc rearrangements:ch1subtype of ptc...:ch1type of thyroid ...:ch1
GSM87078214.991not presentyesZhytomyrRET/PTC3PTC-FSPTC
GSM87078312.781not presentnoSumyRET/PTC3PTC-SPTC
GSM87078416.441not presentnoZhytomyrnot presentclassicalPTC
GSM87078518.461positivenoKievnot presentclassicalPTC
GSM87078615.591not presentyesZhytomyrnot presentPTC-SPTC
pdata <- pData(eSet)
pdata %<>%
    dplyr::mutate(
        Sample = geo_accession,
        SampleType=ifelse(`type of thyroid tussue (ptc denotes papillary thyroid cancer):ch1`=="PTC","Tumor","Normal"),
        Age=`age at ptc operation:ch1`,
        BRAF_v600e_mutation=`braf v600e mutation:ch1`,
        Radiation=`exposure to chernobyl radiation:ch1`,
        Region_of_Residence=`region of residence:ch1`,
        RET_PTC_Rearrangements=`ret/ptc rearrangements:ch1`,
        SubType=`subtype of ptc (classical denotes classical variant of ptc; ptc-f denotes ptc with dominant pattern of follicular structures; ptc-s denotes ptc with dominant pattern of solid areas; ptc-fs denotes ptc with dominant pattern of folicular and solid areas):ch1`
    ) %>%
    dplyr::select(Sample,SampleType,Age,BRAF_v600e_mutation,Radiation,Region_of_Residence,RET_PTC_Rearrangements,SubType)

处理表达谱数据

数据大小不大于50不需要取log

exprs_mtx <- exprs(eSet)
if(max(exprs_mtx, na.rm = TRUE)<50 | min(exprs_mtx, na.rm = TRUE)<0){
  message("基因表达最大值小于50或者最小值小于0不需要log转化")
}else {
  message("基因表达最大值大于50需要log转化")
  exprs_mtx <- log2(exprs_mtx+1)
}
probe_exprs <- as.data.table(exprs_mtx, keep.rownames = "ProbeID")

探针与基因Symbol对应关系

从AnnoProbe包中获取探针与GeneID对应关系

probe2symbol <- AnnoProbe::idmap(gpl = gpl, type = "soft", mirror = "tencent", destdir = od) %>%
  dplyr::rename(ProbeID = ID, Feature = symbol) # pipe", "bioc", "soft"

ID转换

把表达矩阵中的探针名转换为基因名;transid是我写的一个R函数,有需要可以联系我,加入交流群

fdata <- transid(probe2symbol, probe_exprs)

保存数据

common_samples <- base::intersect(colnames(fdata),pdata$Sample)
fdata %<>% select(all_of(c("Feature",common_samples)))
fwrite(fdata, file = stringr::str_glue("{geo_accession}_{gpl}_fdata.csv.gz"))
pdata %<>% dplyr::filter(Sample %in% common_samples)
fwrite(pdata, file = stringr::str_glue("{geo_accession}_{gpl}_pdata.csv"))

本文由 mdnice 多平台发布

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值