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

added fix for conversion between SBOL2 and SBOL3 #90

Merged

Conversation

Akshat-Kumar-0610
Copy link
Contributor

Hi @jakebeal, tried to work on the issue #83,

  1. In the function convert3to2 I have removed the part where orientation were mapped again after conversion to SBOL2 document.
  2. For the test for validation of orientation I have compaired orientation string to 'http://sbols.org/v3#inline' and if it matches to the string test fails since it must not be present in an SBOL2 document.

for c in doc2.componentDefinitions:
for sa in c.sequenceAnnotations:
for loc in sa.locations:
assert loc.orientation != 'http://sbols.org/v3#inline'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also have a positive check that we do have some SBOL2 inline marks where expected? Orientation is optional, and so we need to make sure we're actually exercising the test - I don't know if the test file has an orientation in it at all.

@jakebeal
Copy link
Contributor

This is looking good; I'd like to see a strengthening of the test case, since I'm not sure if the test file has an orientation listed at all.

@Akshat-Kumar-0610
Copy link
Contributor Author

Hi @jakebeal, I have made few changes:

  1. I have shifted conversion of orientation to traverse method for recursive traversal of objects.
  2. for the tests part I have tried to compare identity of location block if it has orientation attribute before and after conversion.
  3. for the actual testing test_files/BBa_J23101.nt file which is being used in test_3to2_conversion function does not contain location block with orientaion. For testing the changes I used test_files/iGEM_SBOL2_imports.nt file through python's interactive shell.

Copy link
Contributor

@jakebeal jakebeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, nice progress. Just a couple of small tweaks to request in the code.

With regards to this:

for the actual testing test_files/BBa_J23101.nt file which is being used in test_3to2_conversion function does not contain location block with orientation. For testing the changes I used test_files/iGEM_SBOL2_imports.nt file through python's interactive shell.

I'm glad that it worked for your local test. We won't know if it's still working once somebody else changes the code, however, unless we add a test to the test suite. Can you add a new test that uses test_files/iGEM_SBOL2_imports.nt? Tests are cheap and bugs are expensive!

@@ -62,10 +63,23 @@ def test_3to2_conversion(self):
assert doc2.componentDefinitions[0].sequences[0] == 'https://synbiohub.org/public/igem/BBa_J23101_sequence'
assert doc2.sequences[0].encoding == 'http://www.chem.qmul.ac.uk/iubmb/misc/naseq.html'
assert doc2.sequences[0].elements == 'tttacagctagctcagtcctaggtattatgctagc'
# ids of location block containing orientation before conversion
location_ids_sbol3 = []
def change_if_location(o):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't actually changing locations: its name should describe what it actually does.

if isinstance(o, sbol3.Location):
if hasattr(o, 'orientation') and o.orientation != None:
location_ids_sbol3.append(o.identity)
doc3.traverse(change_if_location)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many should there be? Add a check to see the number.

@Akshat-Kumar-0610
Copy link
Contributor Author

Should I rewrite whole test_3to2_conversion function to use test_files/iGEM_SBOL2_imports.nt file or add another function just to test conversion of orientation?

@jakebeal
Copy link
Contributor

I would suggest adding another function to test conversion of orientation. The reason I suggest that is that one often gets better coverage and simpler debugging when there are a larger number of more focused tests, rather than a smaller number of more complex tests.

@Akshat-Kumar-0610
Copy link
Contributor Author

Hi @jakebeal I have added separate test to validate orientation conversion using file test_files/iGEM_SBOL2_imports.nt and all 11 tests are passing as of now.

@jakebeal jakebeal merged commit e913304 into SynBioDex:develop Jan 29, 2022
@jakebeal
Copy link
Contributor

Looks good --- nice work and thank you!

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

Successfully merging this pull request may close these issues.

2 participants