Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLs Partshop submission SBOL type added to the part ID #92

Open
jurquiza opened this issue May 25, 2019 · 1 comment
Open

URLs Partshop submission SBOL type added to the part ID #92

jurquiza opened this issue May 25, 2019 · 1 comment

Comments

@jurquiza
Copy link

jurquiza commented May 25, 2019

I wonder why it was decided to have the pattern for URLs described in the documentation? this is a bit problematic because then ComponentDefinition they displaying is not nice. Don't understand why the type of SBOL is added?

Sorry I still figuring out how URL are working in pySBOL ignore this

@bbartley
Copy link
Contributor

bbartley commented May 30, 2019

@jurquiza You can disable typed URIs. See below.

>>> cd = ComponentDefinition()
>>> print(cd)
http://examples.org/ComponentDefinition/example/1
>>> Config.setOption('sbol_typed_uris', False)
>>> cd = ComponentDefinition()
>>> print(cd)
http://examples.org/example/1

Typed URIs simplify use and readability of code using the pySBOL API. For example, with typed URIs enabled, I can re-use the same ID (e.g., 'lacI') for different types of objects:

>>> doc = Document()
>>> cd = ComponentDefinition('lacI')
>>> seq = Sequence('lacI')
>>> print(cd)
http://examples.org/ComponentDefinition/lacI/1
>>> print(seq)
http://examples.org/Sequence/lacI/1
>>> doc.addComponentDefinition(cd)
>>> doc.addSequence(seq)

However, with typed URIs disabled, this results in the following URI collision error:

>>> Config.setOption('sbol_typed_uris', False)
>>> doc = Document()
>>> cd = ComponentDefinition('lacI')
>>> seq = Sequence('lacI')
>>> print(cd)
http://examples.org/lacI/1
>>> print(seq)
http://examples.org/lacI/1
>>> doc.addComponentDefinition(cd)
>>> doc.addSequence(seq)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/bbartley/Dev/git/pysbol/Mac_64_3/sbol/libsbol.py", line 14987, in addSequence
    val = _libsbol.Document_addSequence(self, *args)
RuntimeError: Cannot add http://examples.org/lacI/1 to Document. An object with this identity is already contained in the Document

In this case the way users work around this problem in order to generate unique URIs for each object, is as follows:

>>> cd = ComponentDefinition('lacI_cd')
>>> seq = Sequence('lacI_seq')

Which is essentially the same as a typed URI, except now the burden is on the user to keep track of all the different IDs.

Unfortunately, Synbiohub does not play well with typed URIs and mangles them.

Sorry for the long explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants