run-frma-example.R 854 B

123456789101112131415161718192021222324252627
  1. ## Load packages
  2. library(openxlsx)
  3. library(affy)
  4. library(frma)
  5. ## Load the fRMA data package and then load the data
  6. library(DSalomon.PAX.hthgu133pluspmfrmavecs)
  7. data(DSalomon.PAX.hthgu133pluspmfrmavecs)
  8. ## Get the sample table and list of CEL files
  9. cel.dir <- "Training Data/01 - CTOT08 ABECASSIS PAX Samples"
  10. ## Read the first xlsx file in the directory, which is a spreadsheet
  11. ## containing all of the CEL file names
  12. sample.table <- read.xlsx(list.files(cel.dir, pattern=glob2rx("*.xlsx"), full.names=TRUE)[1])
  13. cel.files <- file.path(cel.dir, sample.table$Filename)
  14. ## Read the data from the CEL files
  15. affy <- ReadAffy(filenames=cel.files, phenoData=sample.table)
  16. ## Apply fRMA
  17. eset <- frma(affy, input.vecs=DSalomon.PAX.hthgu133pluspmfrmavecs)
  18. ## Extract expression matrix
  19. expr <- exprs(eset)
  20. ## Extract sample table
  21. sample.table <- pData(eset)