SynBioDex / SBOL-utilities

Command-line utilities and scripts for manipulating SBOL data
MIT License
12 stars 21 forks source link

Different examples.org URIs in SBOL2 and SBOL3 #259

Open manulera opened 4 months ago

manulera commented 4 months ago

I realised this during the COMBINE meeting while working on the converter, and we discussed over video conference with @jakebeal . The value of certain identifiers.org constants differ between SBOL2 and SBOL3.

For example:

print(sbol3.SBO_REACTANT) # https://identifiers.org/SBO:0000010
print(sbol2.SBO_REACTANT) # http://identifiers.org/biomodels.sbo/SBO:0000010

It seems the issue only affects the identifiers.org constants. I checked with this script:

import sbol2
import sbol3

for setting in dir(sbol2):
    if setting.isupper():
        value_in_sbol3 = getattr(sbol3, setting, None)
        if value_in_sbol3 is not None:
            value_in_sbol2 = getattr(sbol2, setting, None)
            if value_in_sbol2 != value_in_sbol3:
                print(f'{setting}: {value_in_sbol2} != {value_in_sbol3}')

@jakebeal do you know where could be a good place in the code to introduce the conversion from one uri to the other?

Below the full lists of constant values that differ. They are only from identifiers.org and http://sbols.org (this one is expected).

SBOL_ATTACHMENT: http://sbols.org/v2#Attachment != http://sbols.org/v3#Attachment
SBOL_BUILD: http://sbols.org/v2#build != http://sbols.org/v3#build
SBOL_COLLECTION: http://sbols.org/v2#Collection != http://sbols.org/v3#Collection
SBOL_COMBINATORIAL_DERIVATION: http://sbols.org/v2#CombinatorialDerivation != http://sbols.org/v3#CombinatorialDerivation
SBOL_COMPONENT: http://sbols.org/v2#Component != http://sbols.org/v3#Component
SBOL_CUT: http://sbols.org/v2#Cut != http://sbols.org/v3#Cut
SBOL_DEFINITION: http://sbols.org/v2#definition != http://sbols.org/v3#definition
SBOL_DESCRIPTION: http://purl.org/dc/terms/description != http://sbols.org/v3#description
SBOL_DESIGN: http://sbols.org/v2#design != http://sbols.org/v3#design
SBOL_DISPLAY_ID: http://sbols.org/v2#displayId != http://sbols.org/v3#displayId
SBOL_ELEMENTS: http://sbols.org/v2#elements != http://sbols.org/v3#elements
SBOL_ENCODING: http://sbols.org/v2#encoding != http://sbols.org/v3#encoding
SBOL_END: http://sbols.org/v2#end != http://sbols.org/v3#end
SBOL_EXPERIMENT: http://sbols.org/v2#Experiment != http://sbols.org/v3#Experiment
SBOL_EXPERIMENTAL_DATA: http://sbols.org/v2#ExperimentalData != http://sbols.org/v3#ExperimentalData
SBOL_FRAMEWORK: http://sbols.org/v2#framework != http://sbols.org/v3#framework
SBOL_IDENTIFIED: http://sbols.org/v2#Identified != http://sbols.org/v3#Identified
SBOL_IMPLEMENTATION: http://sbols.org/v2#Implementation != http://sbols.org/v3#Implementation
SBOL_INTERACTION: http://sbols.org/v2#Interaction != http://sbols.org/v3#Interaction
SBOL_INTERACTIONS: http://sbols.org/v2#interaction != http://sbols.org/v3#hasInteraction
SBOL_LANGUAGE: http://sbols.org/v2#language != http://sbols.org/v3#language
SBOL_LEARN: http://sbols.org/v2#learn != http://sbols.org/v3#learn
SBOL_LOCATION: http://sbols.org/v2#Location != http://sbols.org/v3#hasLocation
SBOL_MODEL: http://sbols.org/v2#Model != http://sbols.org/v3#Model
SBOL_MODELS: http://sbols.org/v2#model != http://sbols.org/v3#hasModel
SBOL_NAME: http://purl.org/dc/terms/title != http://sbols.org/v3#name
SBOL_OBJECT: http://sbols.org/v2#object != http://sbols.org/v3#object
SBOL_ORIENTATION: http://sbols.org/v2#orientation != http://sbols.org/v3#orientation
SBOL_PARTICIPANT: http://sbols.org/v2#participant != http://sbols.org/v3#participant
SBOL_PARTICIPATIONS: http://sbols.org/v2#participation != http://sbols.org/v3#hasParticipation
SBOL_RANGE: http://sbols.org/v2#Range != http://sbols.org/v3#Range
SBOL_RESTRICTION: http://sbols.org/v2#restriction != http://sbols.org/v3#restriction
SBOL_SEQUENCE: http://sbols.org/v2#Sequence != http://sbols.org/v3#Sequence
SBOL_SOURCE: http://sbols.org/v2#source != http://sbols.org/v3#source
SBOL_START: http://sbols.org/v2#start != http://sbols.org/v3#start
SBOL_STRATEGY: http://sbols.org/v2#strategy != http://sbols.org/v3#strategy
SBOL_SUBJECT: http://sbols.org/v2#subject != http://sbols.org/v3#subject
SBOL_TEMPLATE: http://sbols.org/v2#template != http://sbols.org/v3#template
SBOL_TEST: http://sbols.org/v2#test != http://sbols.org/v3#test
SBOL_TOP_LEVEL: http://sbols.org/v2#TopLevel != http://sbols.org/v3#TopLevel
SBOL_VARIABLE: http://sbols.org/v2#variable != http://sbols.org/v3#variable
SBO_BIOCHEMICAL_REACTION: http://identifiers.org/biomodels.sbo/SBO:0000176 != https://identifiers.org/SBO:0000176
SBO_CONTROL: http://identifiers.org/biomodels.sbo/SBO:0000168 != https://identifiers.org/SBO:0000168
SBO_DEGRADATION: http://identifiers.org/biomodels.sbo/SBO:0000179 != https://identifiers.org/SBO:0000179
SBO_GENETIC_PRODUCTION: http://identifiers.org/biomodels.sbo/SBO:0000589 != https://identifiers.org/SBO:0000589
SBO_INHIBITED: http://identifiers.org/biomodels.sbo/SBO:0000642 != https://identifiers.org/SBO:0000642
SBO_INHIBITION: http://identifiers.org/biomodels.sbo/SBO:0000169 != https://identifiers.org/SBO:0000169
SBO_INHIBITOR: http://identifiers.org/biomodels.sbo/SBO:0000020 != https://identifiers.org/SBO:0000020
SBO_PRODUCT: http://identifiers.org/biomodels.sbo/SBO:0000011 != https://identifiers.org/SBO:0000011
SBO_PROMOTER: http://identifiers.org/biomodels.sbo/SBO:0000598 != https://identifiers.org/SBO:0000598
SBO_REACTANT: http://identifiers.org/biomodels.sbo/SBO:0000010 != https://identifiers.org/SBO:0000010
SBO_STIMULATED: http://identifiers.org/biomodels.sbo/SBO:0000643 != https://identifiers.org/SBO:0000643
SBO_STIMULATION: http://identifiers.org/biomodels.sbo/SBO:0000170 != https://identifiers.org/SBO:0000170
SBO_STIMULATOR: http://identifiers.org/biomodels.sbo/SBO:0000459 != https://identifiers.org/SBO:0000459
SO_CDS: http://identifiers.org/so/SO:0000316 != https://identifiers.org/SO:0000316
SO_CIRCULAR: http://identifiers.org/so/SO:0000988 != https://identifiers.org/SO:0000988
SO_GENE: http://identifiers.org/so/SO:0000704 != https://identifiers.org/SO:0000704
SO_LINEAR: http://identifiers.org/so/SO:0000987 != https://identifiers.org/SO:0000987
SO_PROMOTER: http://identifiers.org/so/SO:0000167 != https://identifiers.org/SO:0000167
SO_RBS: http://identifiers.org/so/SO:0000139 != https://identifiers.org/SO:0000139
SO_TERMINATOR: http://identifiers.org/so/SO:0000141 != https://identifiers.org/SO:0000141
jakebeal commented 4 months ago

The differences that you've identified cluster into three distinct categories:

For the latter two, the place to put them differs between the current wrapped-JavaScript converter and one focused on the new converter.

For the wrapped JavaScript converter, the convert2to3 function has a set of type remappings starting at https://github.com/SynBioDex/SBOL-utilities/blob/8a30f7b9fdc0d01b5f1637146e852cf3cc7a1702/sbol_utilities/conversion.py#L137 . There is a similar set in the convert3to2 function. These are where type remappings can go.

For the Python-native converter in sbol3_sbol2_conversion.py, the conversion should be done at the visitor for the affected property, such as the encoding_map table in visit_sequence at https://github.com/SynBioDex/SBOL-utilities/blob/8a30f7b9fdc0d01b5f1637146e852cf3cc7a1702/sbol_utilities/sbol3_sbol2_conversion.py#L255