Hi all,
In R, I have a data frame with physical position of some genes in bp on the left and intervals (again in bp) on the right. I want to check for each gene, whether it falls in the the interval of the same chromosome.
GeneID Chr Position Interval
x 1 18697251 1:3099740-8804450
y 1 19546617 1:3422930-8804450
z 1 3332236 2:2751757-4502486
a 2 3993537 2:6187995-8804450
b 2 9983384 2:4864334-18271005
c 2 11479025 2:8222941-18271005
For example: Is gene x on chr 1 comprised in one of the 2 intervals displayed for chr 1? I expect TRUE or FALSE.
I managed to do this giving the gene positions one by one, but the list is very big, I'd like this to be automated.
Any help much appreciated!
Thanks to both of you!