This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Help with getting data about the gene size distribution

Hi,

I need to find the gene length distributions for multiple organisms. Can someone suggest me possible ways to get the information.

Ravi

gene size genome ncbi

Do you have annotations available for all the organisms of your interest ?

1 answer

Grab gene annotations for your organism of interest, and get them into BED format with convert2bed. For example, here are recent (GRCh38) human annotations via GENCODE:

$ wget -qO- ftp://ftp.sanger.ac.uk/pub/gencode/Gencode_human/release_21/gencode.v21.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '$3 == "gene"' \
    | convert2bed -i gff - \
    > genes.bed

Then map genes against themselves to get their lengths. For instance, with bedmap:

$ bedmap --exact --bases genes.bed > gene_lengths.txt

Or with awk:

$ awk '{print $3-$2;}' genes.bed > gene_lengths.txt

The file gene_lengths.txt can be brought into R or similar to make a histogram:

$ R
...
> d <- read.table("gene_lengths.txt", col.names=c("lengths"))
> hist(d$lengths)

Log in to answer this question.