[BioC] Is a number within a set of ranges?

James W. MacDonald jmacdon at med.umich.edu
Mon Oct 29 18:22:01 CET 2007


Hi Dan,

Daniel Brewer wrote:
> I have a table with a start and stop column which defines a set of
> ranges.  I have another table with a list of genes with associated
> position.  What I would like to do is subset the gene table so it only
> contains genes whose position is within any of the ranges.  What is the
> best way to do this?  The only way I can think of is to construct a long
> list of conditions linked by ORs but I am sure there must be a better way.

Are you not telling us something here? Because the problem as stated is 
very simple. Say your matrix below is called mat:

index <- mat[,1] < 6 & mat[,2] < 15

Or do you have a whole bunch of ranges to test?

Best,

Jim


> 
> Simple example:
> 
> Start	Stop
> 1	3
> 5	9
> 13	15
> 
> Gene	Position
> 1	14
> 2	4
> 3	10
> 4	6
> 
> I would like to get out:
> Gene	Position
> 1	14
> 4	6
> 
> Any ideas?
> 
> Thanks
> 
> Dan
> 

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



More information about the Bioconductor mailing list