This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Finding out if certain SNP positions fall into certain gene regions

Hi all,

I currently have a certain list of SNPs (chromosome and position). I need to check whether these SNPs fall into another list of gene regions (chr:start_position-end_position) that I have.

I was previously able to find overlaps between positions using findOverlaps in R and I also saw we can do something similar using bedtools intersect. But it seems like those tools are all for finding chr:start-end overlaps, whereas I want to see whether my SNP positions fall into my gene regions of interest.

Any suggestions would be greatly appreciated.

Thank you!

snps gene region r unix

. But it seems like those tools are all for finding chr:start-end overlaps,

I want to see whether my SNP positions fall into my gene regions of interest.

not clear. What is the difference ?

With SNPs, I only have a certain position whereas for the region I have chr:start-end. Do you think findOverlaps would work in this case too?

why don't you convert your positions into 1-base intervals ?

I thought so. You mean for example:

1:169549811-169549811

right?

It would be 1:169549810-169549811, because the BED format is 0-based.

Thanks. If I want to do that in R though, the positions will remain the same..

Yes, the overlap functions from IRanges/GenomicRanges assume 1-based coordinates.

Thanks, my search didn't even fall on that one. It seems I will go with Pierre's suggestion and turn the SNP position into a SNP region having basically the same start and end coordinates. And then do the overlap.

Good description of data. It would help if you can post input data and expected output SGMS

1 answer

$ vcf2bed < snps.vcf > snps.bed
$ gff2bed < genes.gff > genes.bed
$ bedmap --echo --echo-map-id genes.bed snps.bed > answer.bed

The convert2bed binary (vcf2bed and gff2bed) takes care of indexing. You can replace gff2bed with gtf2bed if you have GTF-formatted input.

Log in to answer this question.