Closed ixxmu closed 1 year ago
库引入
dplyr
、AnnotationDbi
、org.Hs.eg.db
和 data.table
。自定义GSE号输入
数据下载
数据读取与处理
data.table::fread
函数读取下载的gzip压缩文件。标识转换
mapIds
函数将Entrez ID转换为Gene Symbols。生成结果
gene_counts
的数据框,其中包含基因名称(Gene Symbols)及其对应的计数数据。library("dplyr")
library("AnnotationDbi")
library("org.Hs.eg.db")
library("data.table")
# 1. 自定义输入GSE号
GSE_number <- "GSE60052"
# 2. 分析得到对应的gene_counts
urld <- "https://www.ncbi.nlm.nih.gov/geo/download/?format=file&type=rnaseq_counts"
path <- paste(urld, paste("acc=", GSE_number, sep=""), paste("file=", GSE_number, "_raw_counts_GRCh38.p13_NCBI.tsv.gz", sep=""), sep="&")
download.file(path, destfile = paste(GSE_number, "_raw_counts_GRCh38.p13_NCBI.tsv.gz", sep=""))
raw_counts <- as.matrix(data.table::fread(paste(GSE_number, "_raw_counts_GRCh38.p13_NCBI.tsv.gz", sep=""), header=T, colClasses="integer"), rownames=1)
rownames(raw_counts) <- mapIds(org.Hs.eg.db, keys = rownames(raw_counts), column = "SYMBOL", keytype = "ENTREZID", multiVals = "first")
raw_counts <- raw_counts %>%
.[!is.na(rownames(.)), ] %>%
as.data.frame()
gene_counts <- cbind(genes = rownames(raw_counts), raw_counts)
## 效果展示
> gene_counts[1:5,1:5]
genes GSM1464282 GSM1464283 GSM1464284 GSM1464285
DDX11L1 DDX11L1 0 9 2 2
WASH7P WASH7P 102 105 110 81
MIR6859.1 MIR6859.1 2 1 8 1
MIR1302.2HG MIR1302.2HG 0 4 0 5
MIR1302.2 MIR1302.2 0 0 1 3
难道要把我的流程改成用counts? 虽然有的GEO确实没有上传counts
这个方法获得的counts与SRA数据获得counts有区别吗?大佬
这个方法获得的counts与SRA数据获得counts有区别吗?大佬
不会有很大区别,除非他没有提供counts,一般直接用他geo提供的即可
非常感谢!!
---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年1月23日 22:02 | | 收件人 | @.> | | 抄送人 | @.> , @.> | | 主题 | Re: [ixxmu/mp_duty] GEO数据库读取官方RNA-seq count矩阵及预处理 (Issue #3702) |
这个方法获得的counts与SRA数据获得counts有区别吗?大佬
不会有很大区别,除非他没有提供counts,一般直接用他geo提供的即可
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
https://mp.weixin.qq.com/s/CIKsm-1L7vk1hGpa1lDBZw