VoigtLab / dnaplotlib

DNA plotting library for Python
MIT License
288 stars 73 forks source link

Y offset for overlapping reading frames #3

Closed mcrone closed 8 years ago

mcrone commented 8 years ago

Would it be possible to please add a y offset for overlapping reading frames? It is very useful for adding primers for linear plasmid diagrams. I'm currently working in a lab and we are targeting HIV with crispr, but it is very difficult to show where exactly you are targeting with other available tools (snapgene is too generic and you can't edit like you can with this tool). A y offset for the different elements would solve this problem.

hiv-genome

chofski commented 8 years ago

This sounds like a nice addition that shouldn't be too difficult to implement. A assume this should be a feature for the trace-based renderers where part lengths are maintained.

mcrone commented 8 years ago

I'm not quite sure that I understand what you mean by trace-based renderers. I'm not sure how it would be implemented because ideally you want to maintain the SBOL syntax (and not change part sizes etc).

Just as an aside, will you continue to update the symbols according to the SBOL? It's a really awesome tool, so I'm hoping not to have to search for another one (when making diagrams).

chofski commented 8 years ago

The trace-based renders are the ones designed to correctly replicate the relative lengths of each part. SBOL symbols by default do not do this - we have extended some of them so that they can (e.g., the arrow for CDS). Basic SBOL diagrams only allow for the sequence of parts to be maintained. We could potentially allow all the symbols to have any offset though which might be the right way to do it.

Yes, we are aiming to keep parity with SBOL, but will probably also more quickly adopt other symbols/annotations that might be useful to less synthetic biology orientated crowds (e.g. we already have some interest in adding sequencing annotations).

chofski commented 8 years ago

I'm about to look into implementing this and wanted to comment that there may be a potentially better way of displaying what you want. Rather than showing all reading frames on the same plot, you could make 3 axes of the same dimensions and with the same scaling each only showing those elements present in that frame. I will implement a "y_offset" option as well for some of the elements, but for your application it might make more sense to have the three axes.

chofski commented 8 years ago

As this could be a common use case, I will add an example to the gallery to show what I mean.

chofski commented 8 years ago

This has been fixed and the trace renderers (the ones that maintain part lengths) are all compatible with the y_offset option. For the SBOL renderers we will add an annotate function at a later date to allow of individual icons to be overlaid on a design. The difficulty for these is that they only maintain the sequence of parts and so annotations are more appropriate. An example has also been included to show how either y_offset or multiple axes can be used to display multiple tracks of information. Example shown below:

offset_features_y_offset