This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Cytogenic Location To Genome Coordinates In R

Hey,

I often see cytogenic coordinates written as e.g.

3q26

If I put this into the UCSC genome browser I see this region corresponds to:

chr3:160,700,001-182,700,000

My question: Is there an easy was to jump between the two using R? Or a simple way to calculate one from the other I could implement?

Thanks!

r genome coordinates

3 answers

You can use your favorite mysql wrapper in R.

From location to cytoband using the commandline:

mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19  -e 
"select name from cytoBand where chrom = 'chr3' AND chromStart <= 182700000
and chromEnd >= 160700001"

from cytoband to location:

mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19  -e 
"select chrom, min(chromStart), max(chromEnd) from cytoBand where 
name like 'q36%' group by chrom;"

Thanks! Although this can't be an uncommon task, if I can get it to work I might stick something on R-forge/CRAN

A note about the 'location to cytoband using the commandline' section. If you don't have a point, but an interval, you'll need to check for overlap.

In this case, check http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap for the most efficient way to do this.

So, something like this (for finding gene names)

SELECT name2 FROM refGene WHERE chrom=$chr AND ( txStart<=$end AND txEND>=$start)";

or this (for finding cytoBands)

SELECT name FROM cytoBand WHERE chrom=$chr AND (chromStart <= $end and chromEnd >= $start)";

the SQL as written in the answer does check for overlap in location to cytoband

You could also directly download the coordinates of the cytoBands:

http://hgdownload.cse.ucsc.edu/goldenPath/hg19/database/cytoBand.txt.gz

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

Log in to answer this question.