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
Heng Li wrote a generalization of such tool: https://github.com/lh3/misc/blob/master/biodb/batchUCSC.pl
You could also pipe in the region via a standard set operation with Pierre's example, e.g.:
Obviously, if you have a bunch of regions to lookup, it is better to cache the output of
curl
orwget
and do the set operations on that cached file. But less code is often less to go wrong and less to debug.