[BioC] subsetting an eset object with a defined list

Robert Gentleman rgentlem at fhcrc.org
Thu Oct 5 16:22:35 CEST 2006


Hi,
  I suspect that your presumption about IDs is not correct.

You cannot subscript from a list (and that is a really bad name for a 
variable) you can only subscript using vectors (any introductory 
material on R will tell you how to do that). There is no need to use 
as.character as you are doing, if the values are character strings there 
is no other representation possible.  If your variable is a data.frame, 
then extract the first column which will be a character vector and will 
be suitable for subscripting.

try using
exprs(eset)[1:10,]

to see what the row names really are.
You can use grep on the row names (there are other functions like 
featureNames or geneNames that will extract these quantities so you can 
see them).

best wishes
  Robert


Celine Carret wrote:
> Thanks Sean,
> unfortunately, it doesn't work, it says 
> 
>> exprs(eset)[as.character(list[,1]),]
> Error: subscript out of bounds
> 
> as for the affy Ids, it's fine because those IDs replace the affy ID in our custom array, so these are present in the eset as stated.
> 
> any other idea?
> best wishes,
> Celine
> 
> 
> 
> 
>> 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
>>
>>  
>>
> 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
rgentlem at fhcrc.org



More information about the Bioconductor mailing list