Question: Find closest gene to chromosome location
0
gravatar for D H
4.0 years ago by
D H0
United States
D H0 wrote:

Hello!

I started a gene enrichment analysis (I haven't done this before), and I have a dataset that contains the gene expression data. This data set has a column with the gene names.
However, there are some entries in that columns, which represent chromosome locations instead of gene names. I want to find the gene closest to these chromosomes locations.
I'm using R 2.15.2 (if that helps).

What are my options? 

 

Thank you in advance!

R gene • 2.1k views
ADD COMMENTlink modified 4.0 years ago by igor8.9k • written 4.0 years ago by D H0
1
gravatar for Nicolas Rosewick
4.0 years ago by
Belgium, Brussels
Nicolas Rosewick8.5k wrote:

bedops closest-features: http://bedops.readthedocs.org/en/latest/content/reference/set-operations/closest-features.html

ADD COMMENTlink modified 3 days ago by RamRS25k • written 4.0 years ago by Nicolas Rosewick8.5k

I see that this utility takes as an input a BED file. I only have a csv file though.

Is it possible to convert csv to BED?

(I'm sorry for the questions but I'm very new to this)

ADD REPLYlink modified 3 days ago by RamRS25k • written 4.0 years ago by D H0
1

The most simple version of a BED file is three tab-separated columns (chr, start pos, end pos). You can use Excel to extract those three columns and save as tab-delimited text file.

ADD REPLYlink written 4.0 years ago by igor8.9k
1

[Disparaging comment about Excel deleted]

ADD REPLYlink modified 4.0 years ago • written 4.0 years ago by harold.smith.tarheel4.5k

If you use Excel, be sure to clean it up. It can save tab-delimited text files, but with non-Linux line endings.

You can do the following fix, in the case of exporting from Excel on Mac:

$ tr '\r' '\n' < input.fromExcelForMac.txt | sort-bed - > input.fixed.bed

If you exported your data from Excel on Windows, apply this post-save fix:

$ tr -d '\r' < input.fromExcelForWindows.txt | sort-bed - > input.fixed.bed

Then run closest-features to query features of interest:

$ closest-features --closest input.fixed.bed features.bed > answer.bed
ADD REPLYlink modified 3 days ago by RamRS25k • written 4.0 years ago by Alex Reynolds29k
1
gravatar for igor
4.0 years ago by
igor8.9k
United States
igor8.9k wrote:

bedtools closest

ADD COMMENTlink modified 3 days ago by RamRS25k • written 4.0 years ago by igor8.9k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1975 users visited in the last hour