This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Genomic coordinates for Cytogenetic bands with R

Hi All,

Does anyone know of a resource in R to obtain the genomic coordinates of cytogenetic bands. I have tried bioMart without success and was hoping to obtain this information through an R interface without resorting to an outside resource.

r ideogram

2 answers

You could probably run the following command-line search via a system() or MySQL library call within R:

$ mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19 -e "SELECT chrom, chromStart, chromEnd, name FROM cytoBand"

For instance:

> result <- system("mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19 -e \"SELECT chrom, chromStart, chromEnd, name FROM cytoBand\"", intern=TRUE)

Or you might run the RMySQL library:

> install.packages("RMySQL", type="source")
> library(RMySQL)
> connection <- dbConnect(MySQL(), user="genome", host="genome-mysql.cse.ucsc.edu", dbname="hg19")
> result <- dbGetQuery(conn=connection, statement="SELECT chrom, chromStart, chromEnd, name FROM cytoBand")

The output from system() may require additional parsing with split() and other functions to build a matrix or data frame.

Thanks Alex,

did not realize R could connect to an SQL database

You can use the getIdeogram function from the biovizBase package which will query UCSC for you. As an example, get the cytobands for the human hg19 genome:

library(biovizBase)
hg19IdeogramCyto <- getIdeogram("hg19", cytobands = TRUE)

This will work for all genomes and species that are provided by UCSC.

Log in to answer this question.