[BioC] subsetting an eset object with a defined list

Sean Davis sdavis2 at mail.nih.gov
Thu Oct 5 13:23:26 CEST 2006


On Thursday 05 October 2006 07:00, Celine Carret wrote:
> Sure, sorry:
> thank you
> C.
>
>  >list <- read.table("list.txt", sep="")
>  > class(list)
>
> [1] "data.frame"
>
>  >list <- as.matrix(list)
>  > intersect(exprs(eset), list)
>
> character(0)
>
>  >intersect(exprs(eset), as.character(list))
>
> character(0)
>
>  >exprs(eset)[list]

exprs(eset)[as.character(list[,1]),]

> [1] NA   NA   NA   NA   ....
> ...
> [901] NA   NA   NA   NA
>
>  >dim(list)
>
> [1] 904 1
>
>  > exprs(eset)[as.character(list)]
>
> [1] NA   NA   NA   NA   ....
> ...
> [901] NA   NA   NA   NA
>
>  >head(list)
>
>     V1
> 1 "PF11_0211"
> 2 "PF14_0749"
> 3 "PF10_0015"
> 4 "PFB0695c"
> 5 "PF14_0316"
> 6 "PF11_0039"

These are not affy IDs, are they?  If not, you will need to map these gene 
names back to affy IDs before you can use them for subsetting.

It is probably worthwhile reading a bit of the Intro to R manual and, if you 
don't have it, consider getting a copy of the Bioconductor book.

Sean



More information about the Bioconductor mailing list