This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Find genes neighboring to gene of interest

I want to find genes upstream and downstream to gene of my interest based upon the chromosomal co-ordinates. I tried using precede, follow from GRanges package but it does not report the genes which have overlapping co-ordinates (for small genome size, genes are placed very close). How can I get the immediate first neighbor/closest to start and end of my gene.

~Pooja

alignment sequence

2 answers

BEDtool closest

BEDTools closest is same as GRanges findOverlap and it just give overlapping genes but not the preceding/succeeding genes. I want very first neighbor it can be overlapping, preceding and succeeding. Is there any way I can get the nearest.

Hi poojasethiya,

It is not the same. Please read the manual carefully before concluding. In bedtools closest, you can get first gene hit to your reference list by using '-t first'. And for upstream and downstream you can choose '-fu' and '-fd' respectively.

Alternatively you can just reduce all the gene to the transcription start site (or other point of interest) and then use GRanges with the approach you suggest

Log in to answer this question.