[BioC] read.table(), then use affycoretools?

James W. MacDonald jmacdon at med.umich.edu
Tue Jan 9 17:05:25 CET 2007


Hmm, yeah. Sorry about that. S4 and stuff ;-D

How about

a <- pData(pd)
row.names(a) <- sub("-",".", row.names(a))
pData(pd) <- a

and then proceed.

Alternatively you can modify the text file before running read.phenoData().

Best,

Jim

Weiyin Zhou wrote:
> Hi James,
> 
> Thanks!
> 
> I get the error message when I try:
> 
>>eset <- new("exprSet", exprs = as.matrix(data), phenoData = pd)
> 
> Error in validObject(.Object) : invalid class "exprSet" object:
> sampleNames different from names of phenoData rows
> 
> So I try below code, but get another error message:
> 
>>row.names(pd) <- sub("-", ".", row.names(pd))
> 
> Error in `rownames<-`(x, value) : attempt to set rownames on object with
> no dimensions
> 
> 
> Here is my seesionInfo:
> 
>>sessionInfo()
> 
> R version 2.4.0 (2006-10-03) 
> i386-pc-mingw32 
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] "splines"   "tools"     "methods"   "stats"     "graphics"
> "grDevices"
> [7] "utils"     "datasets"  "base"     
> 
> other attached packages:
> affycoretools       biomaRt         RCurl           XML       GOstats 
>       "1.6.0"       "1.8.1"       "0.8-0"       "1.4-0"       "2.0.4" 
>      Category    genefilter      survival          KEGG          RBGL 
>       "2.0.3"      "1.12.0"        "2.30"      "1.12.0"      "1.10.0" 
>      annotate            GO         graph         limma          affy 
>      "1.12.0"      "1.14.1"      "1.12.0"       "2.9.1"      "1.12.2" 
>        affyio       Biobase 
>       "1.2.0"      "1.12.2"
> 
> 
> 
> 
> Thanks,
> 
> Weiyin
> 
> 
> 
> -----Original Message-----
> From: James W. MacDonald [mailto:jmacdon at med.umich.edu] 
> Sent: Tuesday, January 09, 2007 10:28 AM
> To: Weiyin Zhou
> Cc: bioconductor at stat.math.ethz.ch
> Subject: Re: [BioC] read.table(), then use affycoretools?
> 
> Hi Weiyin,
> 
> Weiyin Zhou wrote:
> 
>>Hi James,
>>
>> 
>>
>>I use read.table() to read .txt file, which have 7 columns (probeID, 3
>>columns for control, next 3 for ko).  These data have already rma
>>pre-processed.  Here is the first ten lines after I used read.table:
>>
>> 
>>
>>
>>
>>>data <- read.table("Apopt_rma.txt", header=TRUE, row.names="ID")
>>
>>
>>>data[1:10,]
>>
>>
>>                Eurasnet.Apoptosis.CEL Eurasnet.Apoptosis2.CEL
>>
>>AFFX-BioB-3_at                10.16030                 9.75900
>>
>>AFFX-BioB-5_at                 9.56744                 9.07906
>>
>>AFFX-BioB-M_at                10.38530                 9.94925
>>
>>AFFX-BioC-3_at                10.30660                 9.81339
>>
>>AFFX-BioC-5_at                10.97160                10.54450
>>
>>AFFX-BioDn-3_at               12.43740                12.17020
>>
>>AFFX-BioDn-5_at               11.80980                11.45310
>>
>>AFFX-CreX-3_at                13.76850                13.67820
>>
>>AFFX-CreX-5_at                13.59800                13.48740
>>
>>AFFX-DapX-3_at                 7.58850                 8.05139
>>
>>                Eurasnet.Apoptosis3.CEL Eurasnet.Apoptosis4.CEL
>>
>>AFFX-BioB-3_at                  9.61602                 9.43489
>>
>>AFFX-BioB-5_at                  9.02821                 8.83341
>>
>>AFFX-BioB-M_at                  9.85227                 9.69166
>>
>>AFFX-BioC-3_at                  9.75543                 9.62851
>>
>>AFFX-BioC-5_at                 10.42980                10.27400
>>
>>AFFX-BioDn-3_at                12.00490                12.00640
>>
>>AFFX-BioDn-5_at                11.29640                11.35080
>>
>>AFFX-CreX-3_at                 13.48130                13.68150
>>
>>AFFX-CreX-5_at                 13.26550                13.44120
>>
>>AFFX-DapX-3_at                  7.06897                 6.90034
>>
>>                Eurasnet.Apoptosis5.CEL Eurasnet.Apoptosis6.CEL
>>
>>AFFX-BioB-3_at                 10.29660                 9.69907
>>
>>AFFX-BioB-5_at                  9.72952                 9.08717
>>
>>AFFX-BioB-M_at                 10.59420                 9.92486
>>
>>AFFX-BioC-3_at                 10.47480                 9.89643
>>
>>AFFX-BioC-5_at                 11.15980                10.54430
>>
>>AFFX-BioDn-3_at                12.58160                12.18040
>>
>>AFFX-BioDn-5_at                12.12000                11.58860
>>
>>AFFX-CreX-3_at                 13.86080                13.81650
>>
>>AFFX-CreX-5_at                 13.78710                13.67390
>>
>>AFFX-DapX-3_at                  7.07626                 7.12627
>>
>> 
>>
>>My phenoData is;
>>
>>
>>
>>>pd <- read.phenoData("pData.txt", header=TRUE, row.names=1)
>>
>>
>>>show(pData(pd))
>>
>>
>>                        Target
>>
>>Eurasnet-Apoptosis1.CEL     CO
>>
>>Eurasnet-Apoptosis2.CEL     CO
>>
>>Eurasnet-Apoptosis3.CEL     CO
>>
>>Eurasnet-Apoptosis4.CEL     KO
>>
>>Eurasnet-Apoptosis5.CEL     KO
>>
>>Eurasnet-Apoptosis6.CEL     KO
>>
>> 
>>
>>Can I doing some sort of conversion for the data from output of
>>read.table, to make data object look like the eset object you create
>>from affystart(), combine with phenoData info, so I can use it to call
>>lmFit () and other function in limma package.
>>
> 
> 
> For the current BioC release, you can create an exprSet like this:
> 
> eset <- new("exprSet", exprs = as.matrix(Data), phenoData = pd)
> 
> You might get an error because your phenoData row.names are not the same
> 
> as the colnames of your Data object. If so, you might have to change the
> 
> row names first.
> 
> row.names(pd) <- sub("-", ".", row.names(pd))
> 
> Note that this won't work with R-2.5.0/BioC 2.0. In that case you will 
> have to create an ExpressionSet, and your pd object has to be read in 
> using read.AnnotatedDataFrame().
> 
> 
> HTH,
> 
> Jim
> 
> 
> 
> 
> 
>> 
>>
>>Thanks in advance,
>>
>>Regards, 
>>
>>Weiyin Zhou
>>
>>Statistics and Data Analyst
>>
>>ExonHit Therapeutics, Inc.
>>
>>217 Perry Parkway, Building # 5
>>
>>Gaithersburg, MD 20877
>>
>> 
>>
>>email: Weiyin.zhou at exonhit-usa.com
> 
> <mailto:Weiyin.zhou at exonhit-usa.com> 
> 
>>phone: 240.404.0184
>>
>>fax: 240.683.7060
>>
>> 
>>
>> 
>>
>> 
>>
>>
>>	[[alternative HTML version deleted]]
>>
>>_______________________________________________
>>Bioconductor mailing list
>>Bioconductor at stat.math.ethz.ch
>>https://stat.ethz.ch/mailman/listinfo/bioconductor
>>Search the archives:
> 
> http://news.gmane.org/gmane.science.biology.informatics.conductor
> 
> 


-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623


**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list