<aside> 🔅 Use cmd/ctrl+shift+l to switch between light/dark display mode.
</aside>
https://github.com/SynBioDex/SBOL-utilities/pull/136
sbol2genbank
, genbank2sbol
, sbol-converter
now have an added flag -force-new-converter
, which upon invoking would carry out the given conversion process using the new offline converter.test_genbank_conversion_new_converter
, has been added, which will test the converted output using the new force flag.BBa_J23101_from_genbank_to_sbol3_direct.nt
to convert the sbol3 document to genbank which is compared against the test file: BBa_J23101_from_sbol3_direct.gb
.In the previous blog, I discussed adding the ability to parse GenBank files having multiple records and features. Here, I shall discuss the newly added integration of the new offline converter with the existing converter.
⇒ In this PR, there has not been any work on the converter itself (sbol_utilities/sbol3_genbank_conversion.py
). The legacy converter could be invoked via the command line, using any of the console scripts of sbol2genbank
, genbank2sbol
, sbol-converter
. The changes allow us to use the new converter by specifying the --force-new-converter
.
I added a parser argument for the 3 library functions to allow the intake of the new flag:
parser.add_argument('--force-new-converter', dest='force_new_converter', action='store_true', default=False,
help='Force the usage of new (offline) converter instead of legacy (online) converter.')
⇒ I changed the signature of the underlying function, which is invoked whenever any of the console scripts are executed; to accommodate the new flag:
def convert_from_genbank(path: str, namespace: str, allow_genbank_online: bool = False, force_new_converter: bool = False) -> sbol3.Document:
"""Convert a GenBank document on disk into an SBOL3 document
Specifically, the GenBank document is first imported to SBOL2, then converted from SBOL2 to SBOL3
:param allow_genbank_online: Use the online converter, rather than the local converter
:return: SBOL3 document containing converted materials
"""
⇒ A unit test was also added in test/test_conversion.py
for testing the new flag. It executed the convert_from_genbank
with the --force-new-converter
flag set on a sample GenBank test file. The generated SBOL3 document is not written but instead is compared directly with a correct SBOL3 stored document, using doc_diff.