This works. Sorry I forgot to upvote!
• 0 views
•
link
Hi all
In an analysis framework, I need to calculate average expression of all genes within each chromosomal bin (let say size of each bin is 10kb). Doing this in bash using gff3 file is easy, but genes which overlap the ends of two consecutive bins are difficult to place. Can anyone point me to a tool/perl script that will manage to do this?
Thanks.
One possible workflow:
Something greatly simplified as:
$ gff2bed < annotations.gff | grep -w 'gene' | cut -f1-4 - | paste - expression.txt > genes.bed5
$ bedops --chop 10000 hg19.extents.bed | bedmap --echo --mean --fraction-map 0.51 - genes.bed5 > answer.bed
A 51% threshold ensures that a gene that straddles two disjoint, adjacent bins will be mapped only to one or the other bin, depending on which gene subsegment has the greater overlap.
This works. Sorry I forgot to upvote!
Log in to answer this question.
Do you want bin the genome in to 10kb or bin the gene coordinates ?
I want to bin each chromosome in 10 kb bins and pull all the genes within each bin