Ben Ganzfried
2011-Oct-07 16:52 UTC
[R] Creating One Single Object Linking Multiple Datapoints
Thanks, Martin. Based on my previous post, I thought of a more general formulation of my question that I think would be helpful to ask here. What's the best way to build an R object that links multiple datapoints about different people? I mean, I happen to have datasets that have individual gene expression data tied to individual patient characteristics (how long they survived, age, gender, and other things). But if I were a baseball statistician wanting to link individual batting data to individual baseball player characteristics (age, height, weight, etc), the idea would be the same, I think. I could do this in Python but I'm not really sure how it would work in R and would greatly appreciate any advice about how to implement this. Thanks! Ben On Fri, Oct 7, 2011 at 10:50 AM, Martin Morgan <mtmorgan@fhcrc.org> wrote:> Hey Ben -- this is a bioconductor question so please ask on the > Bioconductor mailing list. Good news, you don't have to subscribe to post > > http://bioconductor.org/help/**mailing-list/<http://bioconductor.org/help/mailing-list/> > > Martin > > > On 10/07/2011 07:27 AM, Ben Ganzfried wrote: > >> Hey, >> >> I have code that can check the quality of a data set we're working with >> (expression data), and I'm having some trouble writing code that would >> make >> the expression data we have tie to other data we want to link it to >> (called >> phenotype data). Does anyone have any advice on how I could make a single >> object that would do this? Other relevant info: I want to use the pdata() >> function, and I have all the phenotype data available as csv files. Here >> is >> what I have in regards to the expression data: >> >> 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) >> } >> >> x<- arrayQualityMetrics(**expressionset = affyobj, >> outdir=qcDir, >> force = TRUE, >> spatial=FALSE) >> >> [[alternative HTML version deleted]] >> >> ______________________________**________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide http://www.R-project.org/** >> posting-guide.html <http://www.R-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. >> > > > -- > Computational Biology > Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 > > Location: M1-B861 > Telephone: 206 667-2793 >[[alternative HTML version deleted]]
Seemingly Similar Threads
- Creating One Single Object with Phenotype and Expression Data
- libpng warning: Application built with libpng-1.2.26 but running with 1.5.2
- Filling Wx::ListCtrl with contents
- Datapoints underneath datapoints Problem
- geeglm crashes if there are no datapoints in predictor's first level (PR#13266)