Skip to content

How to get ParameterValue objects from an opil.ProtocolInterface #183

@tramyn

Description

@tramyn

I want to get opil.ParameterValues from a strateos opil.ProtocolInterface (ex: CellFreeRiboswitches). I tried running the code below but unable to get desired information. What is the correct to do this?

Here is what I have tried so far.

import opil
import sbol

file_path = 'CellFreeRiboswitches.xml'
opil_doc = opil.Document()
opil_doc.read(file_path, sbol3.RDF_XML)
opil_protocol_interfaces = [top_level for top_level in opil_doc.objects if isinstance(top_level, opil.ProtocolInterface)]
parameters = opil_protocol_interfaces[0].has_parameter
parameter_values = []
for parameter in parameters:
     if parameter.default_value:
          parameter_value = opil_doc.find(parameter.default_value)
          if parameter_value:
               parameter_values.append(parameter_value)
if len(parameter_values) == 0:
     raise Exception('Expecting ParameterValues but found none')

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions