我从Gene Expression Omnibus (GEO)下载了一些Illumina 450k甲基化数据集
R Bioconductor包minfi和ChAMP似乎需要一种叫做“样本表”的东西。
GEO上的大多数TAR文件似乎都不包含这样的样本表-它们只包含.idat文件
任何仁慈的灵魂会提供一些建议吗?我想知道如何在没有样例工作表的情况下运行ChAMP / Minfi管道;否则,是否有办法从.idat文件生成样例工作表?
谢谢!
发布于 2017-01-25 23:53:04
我在一个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)发布于 2021-03-29 05:38:19
这就是我如何获得样例工作表并将idats读入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")发布于 2015-08-02 19:45:23
如果你想从一个目录中读取所有的idat文件,你可以使用:
my_450k <- read.450k.exp(base = "path/to/directory", recursive = TRUE)在某些阶段,您仍然需要通过样本条形码将表型数据与45万数据进行匹配。
https://stackoverflow.com/questions/31770151
复制相似问题