快速评估损坏的 Affymetrix CEL 文件

发布于 2024-08-12 10:24:51 字数 289 浏览 4 评论 0原文

我正在尝试使用 R 规范化大量 Affymetrix CEL 文件。但是,其中一些文件似乎被截断,因此在读取它们时我收到错误

Cel file xxx does not seem to have the correct dimensions

并且规范化停止。每次手动删除损坏的文件并重新启动将花费很长时间。您知道是否有一种快速方法(在 R 中或使用工具)来检测损坏的文件?

PS 我 99.99% 确定我正在将来自同一平台的 CEL 标准化在一起,它实际上只是被截断的文件:-)

I'm trying to normalize a big amount of Affymetrix CEL files using R. However, some of them appear to be truncated, so when reading them i get the error

Cel file xxx does not seem to have the correct dimensions

And the normalization stops. Manually removing the corrupted files and restart every time will take very long. Do you know if there is a fast way (in R or with a tool) to detect corrupted files?

PS I'm 99.99% sure I'm normalizing together CELs from the same platform, it's really just truncated files :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三岁铭 2024-08-19 10:24:51

一个简单的建议:

您可以在 read.table (或您正在使用的任何读取命令)周围使用 tryCatch 块吗?如果您收到该错误消息,则只需跳过一个文件即可。您还可以在 catch 块中编译损坏文件的列表(我建议这样做,以便您在运行这样的大批处理过程时跟踪损坏的文件以供将来参考)。这是伪代码:

corrupted.files <- data.frame()
for(i in 1:nrow(files)) {
    x <- tryCatch(read.table(file=files[i]), error = function(e) 
         if(e=="something") { corrupted.files <- rbind(corrupted.files, files[i]) } 
         else { stop(e) }, 
       finally=print(paste("finished with", files[i], "at", Sys.time())))
    if(nrow(x)) # do something with the uncorrupted data            
}

One simple suggestion:

Can you just use a tryCatch block around your read.table (or whichever read command you're using)? Then just skip a file if you get that error message. You can also compile a list of corrupted files within the catch block (I recommend doing that so that you are tracking corrupted files for future reference when running a big batch process like this). Here's the pseudo code:

corrupted.files <- data.frame()
for(i in 1:nrow(files)) {
    x <- tryCatch(read.table(file=files[i]), error = function(e) 
         if(e=="something") { corrupted.files <- rbind(corrupted.files, files[i]) } 
         else { stop(e) }, 
       finally=print(paste("finished with", files[i], "at", Sys.time())))
    if(nrow(x)) # do something with the uncorrupted data            
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文