Browse code

wrapped readIDAT in a tryCatch

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/crlmm@47129 bc3139a8-67e5-0310-9ffc-ced21a209358

Rob Scharp authored on 25/05/2010 19:20:33
Showing 4 changed files

... ...
@@ -522,3 +522,11 @@ function (which expects ff objects and supports parallel processing)
522 522
 2010-05-25 R. Scharpf committed version 1.7.2
523 523
 ** added example dataset
524 524
 ** fixed vignette: inst/scripts/copynumber.Rnw
525
+
526
+2010-05-25 R. Scharpf committed version 1.7.3
527
+** put back in the following check in readIDAT (from r 45050):
528
+  if(versionNumber<3)
529
+    stop("Older style IDAT files not supported:  consider updating your scanner settings")
530
+
531
+2010-05-25 R. Scharpf committed version 1.7.4
532
+** wrapped readIDAT in a tryCatch()	   
... ...
@@ -1,7 +1,7 @@
1 1
 Package: crlmm
2 2
 Type: Package
3 3
 Title: Genotype Calling (CRLMM) and Copy Number Analysis tool for Affymetrix SNP 5.0 and 6.0 and Illumina arrays.
4
-Version: 1.7.3
4
+Version: 1.7.4
5 5
 Date: 2010-05-25
6 6
 Author: Rafael A Irizarry, Benilton S Carvalho <carvalho@bclab.org>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.edu.au>
7 7
 Maintainer: Benilton S Carvalho <carvalho@bclab.org>, Robert Scharpf <rscharpf@jhsph.edu>, Matt Ritchie <mritchie@wehi.EDU.AU>
... ...
@@ -63,6 +63,7 @@ export(crlmm,
63 63
 ##       ellipse, 
64 64
        genotype, 
65 65
        readIdatFiles, 
66
+       readIdatFiles2,
66 67
        snprma,
67 68
        snprma2,
68 69
        crlmm2,
... ...
@@ -87,7 +87,8 @@ readIdatFiles <- function(sampleSheet=NULL,
87 87
 	       cat("reading", arrayNames[i], "\t")
88 88
 	       idsG = idsR = G = R = NULL
89 89
 	       cat(paste(sep, fileExt$green, sep=""), "\t")
90
-	       G = readIDAT(grnidats[i])
90
+	       err <- tryCatch(G = readIDAT(grnidats[i]), error=function(e) NULL)
91
+	       if(is.null(err)) next()
91 92
 	       idsG = rownames(G$Quants)
92 93
 	       headerInfo$nProbes[i] = G$nSNPsRead
93 94
 	       headerInfo$Barcode[i] = G$Barcode
... ...
@@ -235,11 +236,11 @@ readIdatFiles2 <- function(sampleSheet=NULL,
235 236
 	       stop("Cannot find .idat files")
236 237
        if(length(grnfiles)!=length(redfiles))
237 238
 	       stop("Cannot find matching .idat files")
238
-       if(path[1] != "."){
239
+       if(path[1] != "." & path[1] != ""){
239 240
 	       grnidats = file.path(path, grnfiles)
240 241
 	       redidats = file.path(path, redfiles)
241 242
        }  else {
242
-	       message("path arg not set.  Assuming files are in local directory")
243
+	       message("path arg not set.  Assuming files are in local directory, or that complete path is provided")
243 244
 	       grnidats <- grnfiles
244 245
 	       redidats <- redfiles
245 246
        }
... ...
@@ -257,11 +258,12 @@ readIdatFiles2 <- function(sampleSheet=NULL,
257 258
        dates = list(decode=rep(NA, narrays),
258 259
                     scan=rep(NA, narrays))
259 260
        ## read in the data
260
-       for(i in seq(along=arrayNames)) {
261
+       for(i in seq_along(arrayNames)) {
261 262
 	       cat("reading", arrayNames[i], "\t")
262 263
 	       idsG = idsR = G = R = NULL
263 264
 	       cat(paste(sep, fileExt$green, sep=""), "\t")
264
-	       G = readIDAT(grnidats[i])
265
+	       G <- tryCatch(readIDAT(grnidats[i]), error=function(e) NULL)
266
+	       if(is.null(G)) { cat("\n"); next() }
265 267
 	       idsG = rownames(G$Quants)
266 268
 	       headerInfo$nProbes[i] = G$nSNPsRead
267 269
 	       headerInfo$Barcode[i] = G$Barcode