deeptools / pyGenomeTracks

python module to plot beautiful and highly customizable genome browser tracks
GNU General Public License v3.0
758 stars 111 forks source link

label of bed file #446

Closed Simple53 closed 9 months ago

Simple53 commented 1 year ago

I have a bed file containing IDs. How can I plot these regions and display their names at the center inside or below each region? a

lldelisle commented 1 year ago

Hi, Unfortunately this is for the moment not possible but there is a trick that I use for that. You create another bed with the same labels but where you modify the coordinates:

original_bed=my.bed
awk -v OFS="\t" -v shift=10000 '{middle=($2 + $3) / 2; $2 = int(middle - shift); $3=$2 + 1;print}' ${original_bed} > ${original_bed/.bed/_middle.bed}

Then when you create your ini file:

echo "[my bed]
file = $original_bed
labels = false

[my labels]
file = ${original_bed/.bed/_middle.bed}
color = none
border_color = none
color_utr = none
labels = true
" > test.ini
Simple53 commented 1 year ago

Thanks! The trick works.