GangCaoLab / CoolBox

Jupyter notebook based genomic data visualization toolkit.
https://gangcaolab.github.io/CoolBox/index.html
GNU General Public License v3.0
224 stars 37 forks source link

Squish bed file visualization #62

Closed perinom closed 2 years ago

perinom commented 2 years ago

Great tool, thanks!

I'm playing around, and I noticed my bed files are always plotted as stacked. I noticed in the properties dictionary there's a display slot with default value stacked

bed = BED( f"{DIR}/myfile.bed")
bed.properties
{'height': 2,
 'color': 'bed_rgb',
 'name': 'BED.58',
 'title': '',
 'style': 'gene',
 'gene_style': 'flybase',
 'display': 'stacked',
 'border_color': '#1f78b4',
 'fontsize': 12,
 'interval_height': 100,
 'num_rows': None,
 'labels': 'on',
 'min_score': -inf,
 'max_score': inf,
 'bed_type': None,
 'border_style': '--',
 'border_width': 2.0,
 'show_score': 'no',
 'score_font_size': 'auto',
 'score_font_color': '#000000',
 'score_height_ratio': 0.4,
 'border_only': 'no',
 'file': '/my/file.bed'}

I'd need something like the stacked version of UCSC as I have many bed region per window and the plot size explodes quickly, so I tried to change it with bed = BED( f"{DIR}/myfile.bed", display= "stacked"). It succeeded in changing the key value but has no impact on plotting. I tried variations like squish and the like instead of squished but same result.

Is it working with controlled vocabulary and ignoring anything unknown? In case, is there a list of accepted terms somewhere? Or, more generally, what is the correct way to edit the track properties to get them reflected in the plotting?

On the same line, how do I set the bed type to bed12 (similar to #53 )

perinom commented 2 years ago

Ok, found them in the base.py script.

However, the layout seems to go off, the height of each block depends on how rows have been collapsed together, see image below. It would be great if the height of the feature could stay the same, regardless of the display setting

bed_display

Nanguage commented 2 years ago

Now, bed file support 'auto' height. It can increase the height according to the number of rows in view and height of the feature could stay the same.

https://gangcaolab.github.io/CoolBox/_gallery/dna_features.html#layout