Entering edit mode
Ben Ganzfried
▴
30
@ben-ganzfried-4902
Last seen 9.6 years ago
Hi,
I'm a research assistant in a cancer lab and I'm trying to make a
single
object that will link our expression data with its associated
phenotype
data. I want to use the pdata() function and I have all the phenotype
data
available as csv files. I'm a little confused about the best approach
to
make this single object and would greatly appreciate any advice you
may
have. Here is the script generating expression values that I want to
add
the code to:
library(affy)
library(arrayQualityMetrics)
inputargs <- commandArgs(TRUE)
print(inputargs)
sessionInfo()
strInputAccession <- inputargs[1]
strBaseDir <- inputargs[2]
processedDir <-
paste(strBaseDir,strInputAccession,"PROCESSED/DEFAULT",sep="/")
qcDir <- paste(strBaseDir,strInputAccession,"QC",sep="/")
sampleFile <-
paste(processedDir,"/",strInputAccession,"_RAWfilenames.txt",sep="")
defaultExprs <-
paste(processedDir,"/",strInputAccession,"_default_exprs.csv",sep="")
if(file.exists(sampleFile)){
affyobj <- try(ReadAffy(filenames=read.table(sampleFile,as.is
=T,header=FALSE)[,1]))
if(class(affyobj)=="try-error"){
rm(affyobj)
}else{
sampleNames(affyobj) <- sub("\\..*","",sampleNames(affyobj)) #get
rid
of .CEL etc extension, just keep GSM
}
}
if(!exists("affyobj")){
mdExprs <- as.matrix(read.csv(defaultExprs,row.names=1))
if( min( mdExprs, na.rm = TRUE ) >= 0 & max( mdExprs, na.rm = TRUE )
>= 50
) {
mdExprs <- log(mdExprs, base = 2) }
affyobj <- new("ExpressionSet",exprs=mdExprs)
}
#I'd like to make one single object with phenotype and expression data
here
x <- arrayQualityMetrics(expressionset = affyobj,
outdir=qcDir,
force = TRUE,
spatial=FALSE)
[[alternative HTML version deleted]]