This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Obtain Chromosome Locus From Coordinates

I have chromosome start and end coordinates for a given chromosome. I need to translate these to locus - something like this

"11q1.4-q2.1", meaning it is on the long arm of chromosome 11, somewhere in the range from sub-band 4 of band 1, and sub-band 1 of band 2.
from wikipedia http://en.wikipedia.org/wiki/Locus_%28genetics%29

chromosome coordinates

4 answers

You can download the coordinates of the cytobands from the UCSC here.

curl -s "http://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/cytoBand.txt.gz" | gunzip  -c 
chr1    0       2300000 p36.33  gneg
chr1    2300000 5300000 p36.32  gpos25
chr1    5300000 7100000 p36.31  gneg
chr1    7100000 9200000 p36.23  gpos25
chr1    9200000 12600000        p36.22  gneg
chr1    12600000        16100000        p36.21  gpos50
chr1    16100000        20300000        p36.13  gneg
chr1    20300000        23800000        p36.12  gpos25
chr1    23800000        27800000        p36.11  gneg
chr1    27800000        30000000        p35.3   gpos25
(...)

even better - thanks.

but how to plot chromosome from cytoBand.txt.gz

You can use the UCSC cytoband table for this information. Just click get output and it will show you all of them and their chromosomal coordinates. Just make sure you are using the right genome builkd.

that helps - thanks.

Hi all.

Based on the hints given here, I created a script to do that.

https://github.com/lelimat/bioinfo/blob/master/region_to_cytoband.sh

The usage is

bash region_to_cytoband.sh chrom:start-end

or

bash region_to_cytoband.sh chrom  start  end

Please feel free to improve.

Regards,
Leandro

You could also pipe in the region via a standard set operation with Pierre's example, e.g.:

$ curl -s "http://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/cytoBand.txt.gz" | gunzip  -c | bedops -e 1 - <(echo -e "chr1\t10000000\t11000000")
chr1    9200000    12600000    p36.22    gneg

Obviously, if you have a bunch of regions to lookup, it is better to cache the output of curl or wget and do the set operations on that cached file. But less code is often less to go wrong and less to debug.

I have created a website for this: https://cytob.herokuapp.com/

Log in to answer this question.