r语言 - 如何加载GEO甲基化(450k)数据集没有样品表提供



我从Gene Expression Omnibus (GEO)下载了一些Illumina 450k甲基化数据集

R Bioconductor软件包minfi和ChAMP似乎需要一种叫做"样品表"的东西

大多数GEO上的TAR文件似乎不包含这样的样例表-它们只包含。idat文件

有谁能给点建议吗?我想知道如何运行ChAMP/Minfi管道没有样品表;否则,是否有任何方法从.idat文件生成样例表?

谢谢!

我在一个GEO项目中遇到过类似的问题。我所做的就是下载所有的。idat文件,并把它们放在自己的文件夹里。然后,我使用这段代码解析.idat文件名并创建一个示例表。

它将解析像GSM1855609_9020331147_R02C02_Grn.idat这样的文件名,并将所有内容存储在.csv文件中。然后,您可以将.csv文件读取到R中,添加logger等函数希望看到的标准化列名(c("Sample_Name", "Sentrix_ID", "Sentrix_Position")),然后您就可以了。

希望这对你有帮助!

#!/usr/bin/env python
# Import the OS library
import os
# Get your Current Working Directory
cwd = os.getcwd()
# Get a list of all of the files (and directories, if there are any) in your directory.
# This will be a list of strings.
filenames = os.listdir(cwd)
# Split each one into the chunks that were separated by underscores ("_") and then keep the first three for each name.
# This will be a list of lists.
chunked_names = [filename.split("_")[0:3] for filename in filenames]
# For each name, rejoin the three chunks with commas
# We're back to having a list of strings.
csv_lines = [",".join(chunks) for chunks in chunked_names]
# Join all of those strings with the newline character to get just a long string.
contents = "n".join(csv_lines)
# Print this string to standard output so that it can be redirected to a file.
print(contents)

这就是我如何获得样例表并将数据读取到RGSet对象:

#using pacman to install and load packages
if (!require("pacman")) install.packages("pacman")
pacman::p_load("GEOquery","minfi")
#increase file download timeout
options(timeout = 600)
#download GEO object
gse <- getGEO("GSE12345", GSEMatrix = TRUE)
#get phenotype data - sample sheet
pd = pData(gse[[1]])
#get raw data - idats, processed beta matrix, etc.
getGEOSuppFiles("GSE12345")
#decompress idats
untar("GSE12345/GSE12345_RAW.tar", exdir = "GSE12345/idat")
#list files
head(list.files("GSE12345/idat", pattern = "idat"))
idatFiles <- list.files("GSE12345/idat", pattern = "idat.gz$", full = TRUE)
#decompress individual idat files
sapply(idatFiles, gunzip, overwrite = TRUE)
#read idats and create RGSet
RGSet <- read.metharray.exp("GSE12345/idat")
saveRDS(RGSet, "RGSet_GSE12345.RDS")

如果要读取目录中的所有idat文件,只需使用:

my_450k <- read.450k.exp(base = "path/to/directory", recursive = TRUE)

在某些阶段,您仍然需要通过样本条形码将表型数据与450k数据相匹配。

较新的methylprep python包具有下载GEO数据集的功能。IT适用于大多数系列,尽管其中许多系列的存档中没有相同类型的文件。

methylprep也有一个create sample_sheet命令行选项,如果你需要一个输入到minfi。像这样:

 python -m methylprep -v sample_sheet -d ~/GSE133062/GSE133062 --create

(其中-d指定解压后的。idat文件的路径)

更多的例子在这里:https://readthedocs.com/projects/life-epigenetics-methylprep/

最新更新