Browse code

o Now readCelUnits() can handle unit groups for which there are no probes, e.g. then stratifying on PM in a unit containing only MMs. [All of the above was committed to the devel branch too]

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

Henrik Bengtsson authored on 02/02/2007 08:43:14
Showing 2 changed files

... ...
@@ -374,17 +374,26 @@ readCelUnits <- function(filenames, units=NULL, stratifyBy=c("nothing", "pmmm",
374 374
   fields <- vector("list", length(cellValueFields));
375 375
   names(fields) <- cellValueFields;
376 376
 
377
+  # Keep a copy for groups with empty fields
378
+  emptyFields <- fields;
379
+
377 380
   # Add a dimension for the arrays, unless only one array is read
378 381
   # and the array dimension is not wanted.
379 382
   addArrayDim <- (nbrOfArrays >= 2 || !dropArrayDim);
380 383
 
381 384
   seqOfArrays <- list(1:nbrOfArrays);
382 385
   offset <- 0;
386
+  
383 387
   res <- lapply(cdf, FUN=function(u) {
384
-    lapply(u$groups, FUN=function(g) {
388
+    lapply(.subset2(u, "groups"), FUN=function(g) {
385 389
       # Same dimensions of all fields
386 390
       field <- .subset2(g, 1);  # Faster than g[[1]]
387 391
       ncells <- length(field);
392
+
393
+      # Empty unit group?
394
+      if (ncells == 0)
395
+        return(fields <- emptyFields);
396
+
388 397
       idxs <- offset + 1:ncells;
389 398
       offset <<- offset + ncells;
390 399
 
... ...
@@ -445,6 +454,9 @@ readCelUnits <- function(filenames, units=NULL, stratifyBy=c("nothing", "pmmm",
445 454
 
446 455
 ############################################################################
447 456
 # HISTORY:
457
+# 2007-02-01 [KS]
458
+# o Now readCelUnits() can handle unit groups for which there are no probes,
459
+#   e.g. when stratifying on PM in a unit containing only MMs.
448 460
 # 2006-10-04 [HB]
449 461
 # o Made readCelUnits() a bit more clever if a 'cdf' structure with only
450 462
 #   cell indices is passed. Then all fields are just indices and one can
... ...
@@ -2,6 +2,9 @@ Package: affxparser
2 2
 ===================
3 3
 
4 4
 Version: 1.7.3 [2007-02-01]
5
+o Now readCelUnits() can handle unit groups for which there are 
6
+  no probes, e.g. when stratifying on PM in a unit containing 
7
+  only MMs. 
5 8
 o Added writeCdfHeader(), writeCdfQcUnits() and writeCdfUnits(). 
6 9
   These are all used by writeCdf(). They also make it possible
7 10
   to write a CDF in chunks in order to for instance convertCdf()