[BioC] subsetting an eset object with a defined list

Jenny Drnevich drnevich at uiuc.edu
Thu Oct 5 17:16:14 CEST 2006


Hi all,

>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.

Actually, her first column is probably not a character vector because the 
default for read.table() is to read character data in as factors - this 
tripped me up for a while before I figured it out. So you could change the 
call for read.table:

gene.list <- read.table("list.txt", sep="", as.is=TRUE)

Alternatively, switch to character when you extract it:

gene.vector <- as.character(list[,1])

To double check whether your gene names match those in the Expression Set 
object, you could use:

length(intersect(gene.vector, geneNames(eset))  #should be the same as 
length(gene.vector)

Cheers,
Jenny





Jenny Drnevich, Ph.D.

Functional Genomics Bioinformatics Specialist
W.M. Keck Center for Comparative and Functional Genomics
Roy J. Carver Biotechnology Center
University of Illinois, Urbana-Champaign

330 ERML
1201 W. Gregory Dr.
Urbana, IL 61801
USA

ph: 217-244-7355
fax: 217-265-5066
e-mail: drnevich at uiuc.edu



More information about the Bioconductor mailing list