r2dt-bio / R2DT

Visualise RNA secondary structure in consistent, reproducible and recognisable layouts
https://r2dt.bio
Apache License 2.0
59 stars 11 forks source link

Switch to relative coordinates #131

Open AntonPetrov opened 9 months ago

AntonPetrov commented 9 months ago

The RNA 2D JSON Schema is switching from absolute to relative coordinates. This means that the code that uses R2DT JSON output needs to be updated or the SVG images that are generated using the new files will be incorrect.

It is necessary to update R2DT without breaking the integration with XRNA-React and RNAcanvas.

There is already a new version of Traveler that implements the change (thanks @davidhoksza!): https://github.com/cusbg/traveler/tree/relative-labels

Here is the plan:

Here are some example files provided by @davidhoksza that can be used for testing:

⚠️ This is a breaking change so other stakeholders need to be notified - hopefully they are watching this repo 🤞but I can also announce on X and add a warning on r2dt.bio.

Does this plan work? Any ideas or suggestions are very welcome!

cc @aspetr01

davidhoksza commented 9 months ago

Just a small comment regarding the attached files - the *_abs.* files are the original files with absolute label positions, while the non "abs" files are the ones with the new relative positioning of labels.

pzhaojohnson commented 9 months ago

Just to double-check, so it seems like residues still have absolute coordinates, but things like labels now have relative coordinates (relative to the coordinates of the corresponding residue I assume)?

To avoid this being a breaking change, would it be possible to include some sort of "flag" property that would specify whether coordinates are to be interpreted as absolute or relative (and then to still interpret coordinates as absolute by default)?

AntonPetrov commented 9 months ago

@davidhoksza or @caedenM - would you be able to comment on this please?

Just to double-check, so it seems like residues still have absolute coordinates, but things like labels now have relative coordinates (relative to the coordinates of the corresponding residue I assume)? To avoid this being a breaking change, would it be possible to include some sort of "flag" property that would specify whether coordinates are to be interpreted as absolute or relative (and then to still interpret coordinates as absolute by default)?

Having a flag for absolute or relative coordinates sounds like a good idea to me - what does everyone else think?

davidhoksza commented 9 months ago

@pzhaojohnson Indeed, coordinates of the label and label lines relative to the coordinates of the corresponding residue

The flag should be added to the JSON schema, right? No problem with me to include it in the output from Traveler once it's in the schema...

AntonPetrov commented 9 months ago

@CaedenM and @aspetr01, what do you think about adding the flag suggested by Philip to the schema?

Using a flag the transition can be made asynchronously. RNAcanvas and XRNA-React could deploy new code on their own schedule and use the flag if it's present or default to the absolute coordinates in its absence for backwards compatibility.

pzhaojohnson commented 7 months ago

Would using dx and dy (in place of x and y) to denote relative coordinates be a possibility?