25
25
## Dec 12, 2006 - added checkCelFiles() to ensure all filenames are celfiles so unintended
26
26
## arguments don't get passed in via ...
27
27
## Apr 19, 2013 - JWM: added warning and error messages for Gene ST and Exon ST arrays
28
## Sept 26, 2013 - naked .Call() to affyio replaced
29
30
#############################################################
79
80
warning(paste0("\n\nThe affy package can process data from the Gene ST 1.x series of arrays,\n",
80
81
"but you should consider using either the oligo or xps packages, which are specifically\n",
81
82
"designed for these arrays.\n\n"), call. = FALSE)
82
if(length(grep("gene2[01]st|ex[1-2][0-1]st", cleancdfname(ref.cdfName))) == 1)
83
if(length(grep("gene2[01]st|ex[1-2][0-1]st|hta20", cleancdfname(ref.cdfName))) == 1)
83
84
stop(paste0("\n\nThe affy package is not designed for this array type.\n",
84
"Please use either the oligo or xps package.\n\n"), .call = FALSE)
85
"Please use either the oligo or xps package.\n\n"), call. = FALSE)
108
109
## Change sampleNames to be consistent with row.names of phenoData
111
exprs <- .Call("read_abatch",filenames, rm.mask,
112
exprs <- affyio::read_abatch(filenames, rm.mask,
112
113
rm.outliers, rm.extra, ref.cdfName,
113
dim.intensity[c(1,2)],verbose, PACKAGE="affyio")
114
dim.intensity[c(1,2)],verbose)
114
115
colnames(exprs) <- samplenames
116
117
#### this is where the code changes from the original read.affybatch.
131
132
return(new("AffyBatch",
133
se.exprs = .Call("read_abatch_stddev",filenames, rm.mask,
134
rm.outliers, rm.extra, ref.cdfName,
135
dim.intensity,verbose, PACKAGE="affyio"),
134
se.exprs = affyio::read_abatch_stddev(filenames, rm.mask,
135
rm.outliers, rm.extra, ref.cdfName,
136
dim.intensity[c(1,2)],verbose),
136
137
cdfName = cdfname, ##cel@cdfName,
137
138
phenoData = phenoData,
138
139
nrow = dim.intensity[2],##["Rows"],
235
chkSn <- function(filenames, samplenames){
236
fntest <- sub("^/?([^/]*/)*", "", filenames)
237
if(all(fntest %in% samplenames)){
238
filenames <<- filenames[match(samplenames, fntest)]
240
warning(paste0("Mismatched phenoData and celfile names!\n\n",
241
"Please note that the row.names of your phenoData ",
242
"object should be identical to what you get from ",
243
"list.celfiles()!\nOtherwise you are responsible for ",
244
"ensuring that the ordering of your phenoData object ",
245
"conforms to the ordering of the celfiles as they are ",
246
"read into the AffyBatch!\nIf not, errors may ",
247
"result from using the phenoData for subsetting or ",
248
"creating linear models, etc.\n\n"),
234
253
if(is.character(phenoData)) {
235
254
## if character, read file
236
255
if(length(phenoData)!=1) stop(sprintf("'phenoData' must be of length 1, but is %d.", length(phenoData)))
237
256
phenoData <- read.AnnotatedDataFrame(filename=phenoData)
238
257
sampleNames <- sampleNames(phenoData)
258
chkSn(filenames, sampleNames)
239
259
} else if(is.data.frame(phenoData)) {
240
260
## if data.frame, coerce
241
261
phenoData <- as(phenoData, "AnnotatedDataFrame")
262
sampleNames <- sampleNames(phenoData)
263
chkSn(filenames, sampleNames)
242
264
} else if(is.null(phenoData)) {
243
265
phenoData <- new("AnnotatedDataFrame",
244
266
data = data.frame(sample=seq_along(sampleNames),