ReadAgilent.R

From Organic Design wiki
Revision as of 04:33, 18 January 2006 by Sven (talk | contribs) (new article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

library(limma)

  1. 0) Set up directories

auxillaryDir <- "/Volumes/HD2/Data/Nutrigenomics/MultipleScans/Auxillary" dataDir <- "/Volumes/HD2/Data/Nutrigenomics/MultipleScans/Agilent" plotDir <- "AgilentDiagnosticImages"

  1. 1) Read in data using limma

targets <- readTargets(dir(auxillaryDir, pattern="Agilent"), path=auxillaryDir) RGsub <- read.maimages(targets$Filename, path = dataDir, source="agilent", name=targets$Filetype)

  1. 2) Find Agilent indices from x ,y coords

getInd <- function(x,y, nx, byrow=T) {

 return( (x-1)* nx + y)

}

ind <- getInd(RGsub$genes$Row, RGsub$genes$Col, nx=215) length(ind) max(ind)

oldind <- as.numeric(rownames(RGsub$genes)) length(oldind) max(oldind)

  1. 3) Construct complete RGList

RGfull <- new("RGList") RGfull$R <-RGfull$G <-RGfull$Rb <-RGfull$Gb <- matrix(NA, nc=ncol(RGsub), nr=max(ind)) RGfull$genes <- data.frame(matrix(NA, nc=7, nr=max(ind), dimnames = list(NULL, names(RGsub$genes))))

matrixNames <- dimnames(RGsub$R)

  1. 4) Populate complete list

RGfull$R[ind,] <- RGsub$R RGfull$Rb[ind,] <- RGsub$Rb RGfull$G[ind,] <- RGsub$G RGfull$Gb[ind,] <- RGsub$Gb RGfull$genes[ind,] <- RGsub$genes RGfull$targets <- RGsub$targets

dimnames(RGfull$R) <- dimnames(RGfull$Rb) <- dimnames(RGfull$G) <- dimnames(RGfull$Gb) <- matrixNames

  1. Checking the rows that needed padding

rowstopad <- as.numeric(rownames(RGsub$genes) [ !(rownames(RGsub$genes) %in% ind) ]) rowstopad

  1. Indexing looks ok

RGfull[rowstopad,]

RGfull$printer <- structure(list(ngrid.r=1, ngrid.c=1, nspot.r=105, nspot.c=215), class = "PrintLayout") rm(RGsub)