Browse code

Version: 1.29.2 [2012-05-22] o GENERALIZATION: Now system tests that launch another R process no longer assumes R is on the OS's search path. o ROBUSTNESS/CRAN POLICY: readCel() and readCelUnits() are no longer calling .Internal(qsort(...)).

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

Henrik Bengtsson authored on 22/05/2012 18:22:52
Showing 5 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: affxparser
2 2
 Version: 1.29.2
3
-Date: 2012-05-18
3
+Date: 2012-05-22
4 4
 Title: Affymetrix File Parsing SDK
5 5
 Author: Henrik Bengtsson, James Bullard, Robert Gentleman, Kasper Daniel Hansen, Martin Morgan
6 6
 Maintainer: Kasper Daniel Hansen <[email protected]>
... ...
@@ -10,6 +10,17 @@ readCel <- function(filename,
10 10
                     readMap = NULL, 
11 11
                     verbose = 0,
12 12
                     .checkArgs = TRUE) {
13
+    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14
+    # Local functions
15
+    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16
+    qsort <- function(x) {
17
+  ##    o0 <- .Internal(qsort(x, TRUE));
18
+  ##    o <- sort.int(x, index.return=TRUE, method="quick");
19
+  ##    stopifnot(identical(o, o0));
20
+      sort.int(x, index.return=TRUE, method="quick");
21
+    } # qsort()
22
+
23
+
13 24
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 25
     # Validate arguments
15 26
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
... ...
@@ -77,10 +88,12 @@ readCel <- function(filename,
77 88
     # jumping around in the file.
78 89
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79 90
     if (reorder) {
80
-      # About 10-15 times faster than using order()!
81
-      o <- .Internal(qsort(indices, TRUE));  # From base::sort.int()
91
+      # qsort() is about 10-15 times faster than using order()!
92
+      # WAS: o <- .Internal(qsort(indices, TRUE));  # From base::sort.int()
93
+      o <- qsort(indices);
82 94
       indices <- o$x;
83
-      o <- .Internal(qsort(o$ix, TRUE))$ix;  # From base::sort.int()
95
+      # WAS: o <- .Internal(qsort(o$ix, TRUE))$ix;  # From base::sort.int()
96
+      o <- qsort(o$ix)$ix;
84 97
     }
85 98
 
86 99
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
... ...
@@ -113,6 +126,9 @@ readCel <- function(filename,
113 126
 
114 127
 ############################################################################
115 128
 # HISTORY:
129
+# 2012-05-22 [HB]
130
+# o CRAN POLICY: readCel() and readCelUnits() are no longer calling
131
+#   .Internal(qsort(...)).
116 132
 # 2011-11-18
117 133
 # o ROBUSTNESS: Added sanity check that the native code did not return NULL.
118 134
 # 2007-12-01
... ...
@@ -78,6 +78,17 @@
78 78
 # @keyword "IO"
79 79
 #*/######################################################################### 
80 80
 readCelUnits <- function(filenames, units=NULL, stratifyBy=c("nothing", "pmmm", "pm", "mm"), cdf=NULL, ..., addDimnames=FALSE, dropArrayDim=TRUE, transforms=NULL, readMap=NULL, verbose=FALSE) {
81
+  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
82
+  # Local functions
83
+  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
84
+  qsort <- function(x) {
85
+##    o0 <- .Internal(qsort(x, TRUE));
86
+##    o <- sort.int(x, index.return=TRUE, method="quick");
87
+##    stopifnot(identical(o, o0));
88
+    sort.int(x, index.return=TRUE, method="quick");
89
+  } # qsort()
90
+
91
+
81 92
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
82 93
   # Validate arguments
83 94
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
... ...
@@ -275,10 +286,12 @@ readCelUnits <- function(filenames, units=NULL, stratifyBy=c("nothing", "pmmm",
275 286
   reorder <- TRUE;  # Hardwired from now on.
276 287
   if (reorder) {
277 288
     verbose && enter(verbose, "Reordering cell indices to optimize speed");
278
-    # About 10-15 times faster than using order()!
279
-    o <- .Internal(qsort(indices, TRUE));  # From base::sort.int()
289
+    # qsort() is about 10-15 times faster than using order()!
290
+    # WAS: o <- .Internal(qsort(indices, TRUE));  # From base::sort.int()
291
+    o <- qsort(indices);
280 292
     indices <- o$x;
281
-    o <- .Internal(qsort(o$ix, TRUE))$ix;  # From base::sort.int()
293
+    # WAS: o <- .Internal(qsort(o$ix, TRUE))$ix;  # From base::sort.int()
294
+    o <- qsort(o$ix)$ix;
282 295
     verbose && exit(verbose);
283 296
   }
284 297
 
... ...
@@ -452,6 +465,9 @@ readCelUnits <- function(filenames, units=NULL, stratifyBy=c("nothing", "pmmm",
452 465
 
453 466
 ############################################################################
454 467
 # HISTORY:
468
+# 2012-05-22 [HB]
469
+# o CRAN POLICY: readCel() and readCelUnits() are no longer calling
470
+#   .Internal(qsort(...)).
455 471
 # 2007-12-01 [HB]
456 472
 # o Removed argument 'reorder' from readCelUnits(). Reordering is now always
457 473
 #   done.
... ...
@@ -1,6 +1,13 @@
1 1
 Package: affxparser
2 2
 ===================
3 3
 
4
+Version: 1.29.2 [2012-05-22]
5
+o GENERALIZATION: Now system tests that launch another R process no
6
+  longer assumes R is on the OS's search path.
7
+o ROBUSTNESS/CRAN POLICY: readCel() and readCelUnits() are no longer
8
+  calling .Internal(qsort(...)).
9
+
10
+
4 11
 Version: 1.29.1 [2012-05-18]
5 12
 o Replaced several throw() with stop(), because the former assumes
6 13
   that R.methodsS3 is loaded, which it may not be.
... ...
@@ -1,5 +1,14 @@
1
-R_exe <- file.path(Sys.getenv("R_HOME"), "bin", "R")
2
-out <- system(paste(R_exe, '-e "affxparser:::.testWriteAndReadEmptyCdf()"'), intern=TRUE);
1
+systemR <- function(command="", ..., verbose=FALSE) {
2
+  # Locate the R executable
3
+  Rbin <- file.path(R.home("bin"), "R");
4
+
5
+  cmd <- sprintf('%s %s', Rbin, command);
6
+  if (verbose) cat("Command: ", cmd, "\n", sep="");
7
+  system(cmd, ...);
8
+} # systemR()
9
+
10
+
11
+out <- systemR('-e "affxparser:::.testWriteAndReadEmptyCdf()"', intern=TRUE, verbose=TRUE);
3 12
 cat(out, sep="\n");
4 13
 res <- any(regexpr("COMPLETE", out) != -1);
5 14
 cat("Test result: ", res, "\n", sep="");
... ...
@@ -7,6 +16,10 @@ cat("Test result: ", res, "\n", sep="");
7 16
 
8 17
 ############################################################################
9 18
 # HISTORY:
19
+# 2012-05-22
20
+# o ROBUSTNESS: Now launching R without assuming it is on the search path,
21
+#   cf. R-devel thread 'Best way to locate R executable from within R?'
22
+#   on May 22, 2012.
10 23
 # 2012-05-18
11 24
 # o Added because of the OSX build bug, cf.
12 25
 #   https://groups.google.com/d/topic/aroma-affymetrix/lEfDanThLEA/discussion