[BioC] Filtering genes using a list

James MacDonald jmacdon at med.umich.edu
Wed Aug 18 18:10:38 CEST 2004


I would use the %in% function. This assumes that your matrix of gene
values has the gene names appended somehow (row.names, or the first
column). Since you are doing affy stuff, the easiest way is to use the
exprSet holding your data.

index <- gene_list.tab[,1] %in% geneNames(eset)
-or-
index <- gene_list.tab[,1] %in% row.names(my.metric)

Then subset using the index.

subset.data <- my.metric[index,]

HTH,

Jim



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

>>> <mcolosim at brandeis.edu> 08/18/04 11:29AM >>>
This probably is a general R question, but I couldn't find anything
useful. I
found all sort of stuff on how to filter using functions based on the
values
within the matrix, but nothing like this.

I have a list of genes in a file that I want to look at, how can I
filter my
matrix of genes to match the ones in the list?

gene_list.tab with 250 genes:
probe{tab}description
affy_blah1{tab}affy gene of interest 1
affy_blah2{tab}affy gene of interest 2
..

dim(my.metric)
[1] 22625    11

mmfun <- function() # to filter
ffun <- filterfun(mmfun)
my.fmetric <- genefilter(my.metric,ffun)
dim(my.fmetric) ## This should give 250 and 11

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch 
https://stat.ethz.ch/mailman/listinfo/bioconductor



More information about the Bioconductor mailing list