Question: Find closest gene to chromosome location
0
gravatar for D H
3.3 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 • 1.8k views
ADD COMMENTlink modified 3.3 years ago by igor7.4k • written 3.3 years ago by D H0
1
gravatar for Nicolas Rosewick
3.3 years ago by
Belgium, Brussels
Nicolas Rosewick7.4k wrote:

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

ADD COMMENTlink written 3.3 years ago by Nicolas Rosewick7.4k

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 written 3.3 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 3.3 years ago by igor7.4k
1

[Disparaging comment about Excel deleted]

ADD REPLYlink modified 3.3 years ago • written 3.3 years ago by harold.smith.tarheel4.3k

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.3 years ago • written 3.3 years ago by Alex Reynolds27k
1
gravatar for igor
3.3 years ago by
igor7.4k
United States
igor7.4k wrote:

bedtools closest:

http://bedtools.readthedocs.org/en/latest/content/tools/closest.html

 

ADD COMMENTlink written 3.3 years ago by igor7.4k
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: 1351 users visited in the last hour