Difference between revisions of "ReadGPR.R"

From Organic Design wiki
m (dummy edit)
Line 1: Line 1:
library(limma)  
+
readGPR <- function(sourceType="median", dataDir="/Volumes/HD2/Data/Nutrigenomics/MultipleScans/GPR",...) {
sessionInfo()
+
  require(limma)  
 +
# 0) Provide log of session information
 +
  print(sessionInfo())
  
# 0 Set up directories
+
# 1) Read medians or means...
auxillaryDir <- "/Volumes/HD2/Data/Nutrigenomics/MultipleScans/Auxillary"
+
  source.type <- switch(sourceType,
dataDir      <- "/Volumes/HD2/Data/Nutrigenomics/MultipleScans/GPR"
+
                        mean  = "genepix",
plotDir      <- "DiagnosticImages"
+
                        median = "genepix.median"
 
+
                        )
# 1) load targets and data
+
  print(paste("source =",source.type))
targets <- readTargets(dir(auxillaryDir), path=auxillaryDir)
+
  if(exists("targets", inherits=FALSE)) {
 
+
    RG <- read.maimages(targets$Filename, path = dataDir, source=source.type, names=paste(targets$Filetype, targets$Scan), ...)
type <- "median"
+
  } else {
source.type <- switch(type,
+
    RG <- read.maimages(dir(dataDir, pattern=".gpr"), path = dataDir, source=source.type, wt.fun=wtflags(0), ...)
      mean  = "genepix",
+
  }
      median = "genepix.median"
+
    RG$printer <- getLayout(RG$genes)
      )
+
  return(RG)
print(paste("source =",source.type))
+
}
 
 
RG <- read.maimages(targets$Filename, path = dataDir, source=source.type, names=paste(targets$Filetype, targets$Scan),
 
                    wt.fun=wtflags(0))
 
RG$printer <- getLayout(RG$genes)
 

Revision as of 03:30, 23 February 2006

readGPR <- function(sourceType="median", dataDir="/Volumes/HD2/Data/Nutrigenomics/MultipleScans/GPR",...) {

 require(limma) 
  1. 0) Provide log of session information
 print(sessionInfo())
  1. 1) Read medians or means...
 source.type <- switch(sourceType,
                       mean   = "genepix",
                       median = "genepix.median"
                       )
 print(paste("source =",source.type))
 if(exists("targets", inherits=FALSE)) {
   RG <- read.maimages(targets$Filename, path = dataDir, source=source.type, names=paste(targets$Filetype, targets$Scan), ...)
 } else {
   RG <- read.maimages(dir(dataDir, pattern=".gpr"), path = dataDir, source=source.type, wt.fun=wtflags(0), ...)
 }
   RG$printer <- getLayout(RG$genes)
 return(RG)

}