Last active
November 12, 2015 23:22
-
-
Save dela3499/94a177f88434c537ce78 to your computer and use it in GitHub Desktop.
Using Frozen RMA to normalize microarray CEL files for GPL570
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source("http://bioconductor.org/biocLite.R") | |
library("affy") | |
library("frma") | |
library("hgu133plus2frmavecs") | |
library("parallel") | |
# String -> String | |
change.file.extension <- function(filename, extension){ | |
# Strip file extensions from filename, | |
# and replace with given extension | |
base <- strsplit(filename, ".", fixed = T)[[1]][1] | |
full.name = paste(base, extension, sep = ".") | |
return(full.name) | |
} | |
# String -> SideEffect(FileSystem) | |
parse.and.save <- function(cel.filename){ | |
affy_data <- ReadAffy(filenames = cel.filename) | |
frma_data <- frma(affy_data) | |
exprs <- assayData(frma_data)$exprs | |
save.filename = change.file.extension(cel.filename, 'csv') | |
write.table( | |
exprs, | |
file = save.filename, | |
quote = F, | |
row.names = T, | |
col.names = F) | |
} | |
files = list.celfiles() | |
mclapply(files, parse.and.save, mc.cores = 8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a folder, normalize all CEL files and and save to same folder as frma.csv | |
folder = "/home/data/frma_test" | |
library("affy") | |
library("frma") | |
library("hgu133plus2frmavecs") | |
# String -> SideEffect(FileSystem) | |
parse.and.save <- function(cel.filenames){ | |
affy_data <- ReadAffy(filenames = cel.filenames) | |
frma_data <- frma(affy_data) | |
exprs <- assayData(frma_data)$exprs | |
save.filename = paste(folder, "/frma.csv", sep='') | |
write.csv( | |
exprs, | |
file = save.filename | |
} | |
files <- list.celfiles(folder, full.names = T) | |
parse.and.save(files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mclapply (multi-core left apply) is an R function to map a function over a list in parallel.