Browse code

# Will postpone bumping to v1.11.5 for a few days: # # Version: 1.11.5 [2008-02-21] # o BUG FIX: The code in findFiles() for testing if R.utils is loaded # or not was not correct making it fail to detect R.utils. # # Version: 1.11.4 [2008-02-20] # o Now findFiles() and hence findCdf() is only utilizing the R.utils # package if it is already loaded. It will no longer try to load # R.utils. # o Added argument 'allFiles=TRUE' to findFiles(). # o Updated readCcg() according to the newer file format specifications. # Now it is possible to do low-level reading of copy-number CNCHP # files generated by the Affymetrix Genotype Console v2.

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

Henrik Bengtsson authored on 21/02/2008 22:09:02
Showing 4 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: affxparser
2 2
 Version: 1.11.4
3
-Date: 2007-12-01
3
+Date: 2008-01-13
4 4
 Title: Affymetrix File Parsing SDK
5 5
 Author: Henrik Bengtsson, James Bullard, Kasper Daniel Hansen
6 6
 Maintainer: Kasper Daniel Hansen <[email protected]>
... ...
@@ -16,6 +16,8 @@
16 16
 #    breath-first, in lexicographic order.}
17 17
 #  \item{firstOnly}{If @TRUE, the method returns as soon as a matching
18 18
 #    file is found, otherwise not.}
19
+#  \item{allFiles}{If @FALSE, files and directories starting with
20
+#    a period will be skipped, otherwise not.}
19 21
 #  \item{...}{Arguments passed to @see "base::list.files".}
20 22
 # }
21 23
 #
... ...
@@ -41,7 +43,7 @@
41 43
 # @keyword IO
42 44
 # @keyword internal
43 45
 #**/#######################################################################
44
-findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE, ...) {
46
+findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE, allFiles=TRUE, ...) {
45 47
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 48
   # Local functions
47 49
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
... ...
@@ -55,9 +57,22 @@ findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE,
55 57
     if (length(paths) == 0)
56 58
       return(NULL);
57 59
     paths;
58
-  }
60
+  } # splitPaths()
61
+
59 62
 
63
+  # Checks if a package is loaded or not (should be in the 'base' package)
64
+  isLoaded <- function(package, version=NULL, ...) {
65
+    s <- search();
66
+    if (is.null(version)) {
67
+      s <- sub("_[0-9.-]*", "", s);
68
+    } else {
69
+      package <- manglePackageName(package, version);
70
+    }
71
+    pattern <- sprintf("^package:%s$", package);
72
+    (length(grep(pattern, s)) > 0);
73
+  } # isLoaded()
60 74
 
75
+  
61 76
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62 77
   # Validate arguments
63 78
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
... ...
@@ -80,7 +95,7 @@ findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE,
80 95
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
81 96
   # Prepare list of paths to be scanned
82 97
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83
-  hasRutilsLoaded <- "R.utils:package" %in% sub("_[0-9.-]*", "", search())
98
+  hasRutilsLoaded <- isLoaded("R.utils");
84 99
   ## hasRutils <- suppressWarnings(require(R.utils, quietly=TRUE));
85 100
 
86 101
   # Don't search the same path twice
... ...
@@ -116,7 +131,7 @@ findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE,
116 131
   # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117 132
   pathnames <- c();
118 133
   for (path in paths) {
119
-    files <- list.files(path, all.files=TRUE, full.names=TRUE);
134
+    files <- list.files(path, all.files=allFiles, full.names=TRUE);
120 135
 
121 136
     # Exclude listings that are neither files nor directories
122 137
     files <- gsub("^[.][/\\]", "", files);
... ...
@@ -210,6 +225,12 @@ findFiles <- function(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE,
210 225
 
211 226
 ############################################################################
212 227
 # HISTORY:
228
+# 2008-02-21 [HB]
229
+# o Added an internal generic isLoaded() function.
230
+# 2008-02-20 [KH]
231
+# o Replaced require("R.utils") with a "isLoaded()" feature.
232
+# 2008-02-14
233
+# o Added argument 'allFiles=TRUE' to findFiles().
213 234
 # 2007-09-17
214 235
 # o ROBUSTNESS: Now findFiles() are robust against broken Unix links.
215 236
 # 2007-08-30
... ...
@@ -1,6 +1,21 @@
1 1
 Package: affxparser
2 2
 ===================
3 3
 
4
+Version: 1.11.5 [2008-02-21x]
5
+o BUG FIX: The code in findFiles() for testing if R.utils is loaded 
6
+  or not was not correct making it fail to detect R.utils.
7
+
8
+
9
+Version: 1.11.4 [2008-02-20]
10
+o Now findFiles() and hence findCdf() is only utilizing the R.utils
11
+  package if it is already loaded.  It will no longer try to load
12
+  R.utils.
13
+o Added argument 'allFiles=TRUE' to findFiles().
14
+o Updated readCcg() according to the newer file format specifications.
15
+  Now it is possible to do low-level reading of copy-number CNCHP 
16
+  files generated by the Affymetrix Genotype Console v2.
17
+
18
+
4 19
 Version: 1.11.3 [2007-12-01]
5 20
 o Removed argument 'reorder' from readCel() and  readCelUnits()
6 21
   since its name was misleading (the returned value was identical 
... ...
@@ -3,6 +3,8 @@
3 3
 % 
4 4
 %  findFiles.R
5 5
 % 
6
+% on Thu Feb 21 14:05:38 2008.
7
+% 
6 8
 % by the Rdoc compiler part of the R.oo package.
7 9
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 10
 
... ...
@@ -16,7 +18,7 @@
16 18
  Finds one or several files in multiple directories.
17 19
 }
18 20
 
19
-\usage{findFiles(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE, ...)}
21
+\usage{findFiles(pattern=NULL, paths=NULL, recursive=FALSE, firstOnly=TRUE, allFiles=TRUE, ...)}
20 22
 
21 23
 \arguments{
22 24
  \item{pattern}{A regular expression file name pattern to match.}
... ...
@@ -25,6 +27,8 @@
25 27
    breath-first, in lexicographic order.}
26 28
  \item{firstOnly}{If \code{\link[base:logical]{TRUE}}, the method returns as soon as a matching
27 29
    file is found, otherwise not.}
30
+ \item{allFiles}{If \code{\link[base:logical]{FALSE}}, files and directories starting with
31
+   a period will be skipped, otherwise not.}
28 32
  \item{...}{Arguments passed to \code{\link[base]{list.files}}().}
29 33
 }
30 34
 
... ...
@@ -39,7 +43,7 @@
39 43
 }
40 44
 
41 45
 \section{Windows Shortcut links}{
42
-  If package \pkg{R.utils} is available and loaded, Windows Shortcut links (*.lnk)
46
+  If package \pkg{R.utils} is available and loaded , Windows Shortcut links (*.lnk)
43 47
   are recognized and can be used to immitate links to directories
44 48
   elsewhere.  For more details, see \code{\link[R.utils]{filePath}}.
45 49
 }