This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Chromosomal Gene Density Calculation And Visualization

I am looking for a tool/package/script that would be able to calculate chromosomal region gene density and maybe visualize it.

TIA

human chromosome gene

Yep, but the visualization part here is secondary, the gene density per region is the main question.

OK, Paulo I will remove the visualization tag.

Let's make a code-golf out of this. Can you define a format how chrom. regions are defined.

2 answers

Something like this, using mysql 'group by' ?

> mysql -h  genome-mysql.cse.ucsc.edu -A -u genome -D hg18 -e 'select chrom,1000000*ceil(txStart/1000000) as 'start', count(*) from knownGene group by 1,2' 
chrom   start   count(*)
chr1    1000000 88
chr1    2000000 180
chr1    3000000 48
chr1    4000000 38
chr1    5000000 6
chr1    6000000 8
chr1    7000000 74
chr1    8000000 21
chr1    9000000 19
(...)

Can you explain the 1000000*ceil(txStart/1000000) part of the query?

it's just for "binning' the genome with a window of 1000000pb. I group the transcription start in the same window by dividing it by the window size.

The only thing here is that I get more than 60000 genes.

If your organism is in the UCSC Genome database, try GenomeGraphs for visualization:

Log in to answer this question.