VisBOL / visbol-js

SBOLv rendering in JavaScript
visbol.org
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Issue with Component Definition with Sequence Constraints #111

Open PrashantVaidyanathan opened 4 years ago

PrashantVaidyanathan commented 4 years ago

If there is a Component Definition with sequence constraints and components, but no sequence annotations, the image rendered shows parts as "unknown type" instead of the rendering the part based on the role assigned to the component e.g. Promoter/RBS etc.

image

I believe this happens due to this part in the code:

https://github.com/VisBOL/visbol-js/blob/06c39348c0469e7c5ddb295d87abf930cbade124/lib/getDisplayList.js#L361

Where if there is no sequence annotation found that matches a specific component, a new sequence annotation is created however, the role field is an empty list and does not inherit the role(s) of the component.

Here's an intermediate json representation of the structure that reproduces the error observed.

visbolsc_repro.txt

cjmyers commented 4 years ago

Do you have an XML version of your example?

cjmyers commented 4 years ago

I see a problem though. Do not put roles on the Component, they only need to be on the definitions. I don't think roles on Components are supported.

PrashantVaidyanathan commented 4 years ago

Here's the XML for the same. visbolsc_reporxml.txt

If I run getDisplayList on the componentDefinition with the name device (the same component that has the SequenceConstraints and Components), the sequences in the displaylist do not have any type associated with them.

cjmyers commented 4 years ago

I dropped your file into visbol.org and it works fine. Have you tried that?

PrashantVaidyanathan commented 4 years ago

I did and saw that it works in visbol. We get the displaylist by invoking getDisplayList for each component definition. For some reason, the transcriptional unit does not render correctly. Is there another way/correct way of generating visbol images from an sboljs data structure?

cjmyers commented 4 years ago

One thing you might try to get more information is to print the result of your getDisplayList call and compare it with what you see under the display list tab on visbol.org. It could be that visbol.org is running on a different version than the latest. Which version of the visbol library are you using?

cjmyers commented 4 years ago

These may not be causing your VisBol problems (though they might be), your URIs are not compliant. First of all, the URIs should not end with a "/". They should end with the version number. Second, your child URIs are also not formed correctly, for example, for CD: http://www.microsoft.com/gec/db/device/1 It has Component: http://www.microsoft.com/gec/db/r0011/r0011/1/component/ but is should be: http://www.microsoft.com/gec/db/device/r0011/1 OR http://www.microsoft.com/gec/db/device/r0011_component/1 It has SequenceConstraint: http://www.microsoft.com/gec/db/device/1/sc0/ but it should be: http://www.microsoft.com/gec/db/device/sc0/1

cjmyers commented 4 years ago

Also, how similar is your code to that around line 232 here: https://github.com/VisBOL/visbol-js/blob/master/browser.js You don't need the ModuleDefinition loop, but the rest should be similar.