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

Copy function doesn't remap namespaces as expected, breaks links #413

Open
jakebeal opened this issue Jan 20, 2022 · 0 comments
Open

Copy function doesn't remap namespaces as expected, breaks links #413

jakebeal opened this issue Jan 20, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jakebeal
Copy link
Collaborator

Consider the attached SBOL2 file: lycopene.xml.txt

The following sequence has namespace remapping behavior that is either incorrect or incorrectly used due to lack of documentation:

import sbol2

doc1 = sbol2.Document()
doc1.read('lycopene.xml')

print(doc1.componentDefinitions[0].identity)
# http://liverpool.ac.uk/ComponentDefinition/P21684_10000_gene/1

doc2 = sbol2.Document()
doc1.copy(target_doc=doc2) # no namespace activity, no problems
print(doc2.componentDefinitions[0].identity)
# http://liverpool.ac.uk/ComponentDefinition/P21684_10000_gene/1

doc3 = sbol2.Document()
doc1.copy('http://liverpool.ac.uk', doc3)  # should be a no-op for materials already in this namespace
print(doc3.componentDefinitions[0].identity)
# http://examples.org/ComponentDefinition/P21684_10000_gene/1

doc4 = sbol2.Document()
doc1.copy('http://somethingelse.org', doc4) 
print(doc4.componentDefinitions[0].identity)
# http://liverpool.ac.uk/ComponentDefinition/P21684_10000_gene/1

Links to sequences get broken with namespaces too. Presumably other links are being broken as well, but these were the ones that appeared:

print(doc1.componentDefinitions[0].sequence.identity)
# http://examples.org/Sequence/P21684_10000_gene_seq/1
print(doc2.componentDefinitions[0].sequence)
# http://examples.org/Sequence/P21684_10000_gene_seq/1
print(doc3.componentDefinitions[0].sequence)
# None
print(doc4.componentDefinitions[0].sequence)
# None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant