Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

Circular plasmid text annotation issues #28

Open mmcguffi opened 4 years ago

mmcguffi commented 4 years ago

image

This is a very useful library, thank you for developing it! I am interested in using DnaFeaturesViewer for visualizing plasmids, so I am exclusively using the circular graphic record. I have found that when a plasmid has even a modest amount of annotations, they quickly stack and become illegible. Would it be possible to have alternative layouts for these annotations? Maybe split the annotations into quadrants (top, left, bottom, right) or allow them to be placed inline onto the graphic itself?

Also, support for for Bokeh in circular visualization mode would be amazing! Currently, it just defaults to a linear picture, even while using a circular graphic record.

Thank you again!

Zulko commented 4 years ago

Unfortunately that's the limitation of the circular display, and the improvements you mention are not easy (a middle step would be to have just top and bottom annotations, but even this would be a small project of its own, so I can't give you an estimate of when it will be possible).

In our group we use linear display most of the time, even though we work with plasmids too, as they are much more readable. We use the circular view only with a couple of annotation labels, like highlighted restriction sites.

mmcguffi commented 4 years ago

Thank you for getting back to me! Top and bottom would be great -- I could try this myself. Could you point me to the relevant code and maybe I can fork the repo?

Zulko commented 4 years ago

Thanks for offering your help (expect it to be a bit complicated!).

The subclass CircularGraphicRecord is defined here:

https://github.com/Edinburgh-Genome-Foundry/DnaFeaturesViewer/blob/master/dna_features_viewer/CircularGraphicRecord/CircularGraphicRecord.py

This class re-defines some methods like how the features are placed, but all other methods are inherited from GraphicRecord (which is why annotations are placed the same way, at the top, in both linear and circular plots). There should be a way to separate the features in 2 groups, and then plot them separately, but I'm not sure what would work/not work.