R/TcgaDccData.findDataSets.R

setMethodS3("findDataSets", "TcgaDccData", function(static, ..., paths=c("anonymous", "tcga4yeo"), rootPath="tcgaData") {
 # Argument 'rootPath':
 rootPath <- Arguments$getReadablePath(rootPath, mustExist=TRUE);

 # Argument 'paths':
 paths <- Arguments$getCharacters(paths);


 # Expand paths to search
 paths <- file.path(rootPath, paths);
 paths <- sapply(paths, FUN=function(path) {
   Arguments$getReadablePath(path);
 });

 # Drop non-existing paths
 paths <- paths[sapply(paths, FUN=isDirectory)];

 # The name pattern of directories to find
 pattern <- TcgaDccData$getDataSetPatterns(...)$dataset;
 pattern <- sprintf("%s$", pattern);

 dirnames <- NULL;
 for (pp in seq(along=paths)) {
   path <- paths[pp];

   # Scan for subdirectories
   dirs <- listDirectory(path=path, pattern=pattern, recursive=TRUE);
   dirs <- file.path(path, dirs);

   dirnames <- c(dirnames, dirs);
 } # for (pp ...)

 dirnames;
}, static=TRUE) # findDataSets()
 

############################################################################
# HISTORY:
# 2010-01-17
# o Now arguments '...' are passed down.
# 2009-10-20
# o Created.
############################################################################
HenrikBengtsson/aroma.tcga documentation built on May 7, 2019, 2:51 a.m.