-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from SD2E/develop
Develop
- Loading branch information
Showing
15 changed files
with
503 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import intent_parser.utils.intent_parser_utils as ip_utils | ||
import intent_parser.protocols.opil_parameter_utils as opil_utils | ||
import logging | ||
|
||
from intent_parser.intent_parser_exceptions import IntentParserException | ||
|
||
|
||
class AquariumOpilAccessor(object): | ||
""" | ||
Retrieve experimental request from Aquarium-opil. | ||
Refer to link for getting aquarium-opil file: | ||
https://github.com/aquariumbio/aquarium-opil | ||
""" | ||
|
||
logger = logging.getLogger('aqurium_opil_accessor') | ||
_SUPPORTED_PROTOCOLS = {'jellyfish': 'jellyfish_htc.xml' | ||
} | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def get_experimental_request_as_opil_doc(self, experimental_request_name): | ||
if experimental_request_name in self._SUPPORTED_PROTOCOLS: | ||
opil_doc = ip_utils.load_sbol_xml_file(self._SUPPORTED_PROTOCOLS[experimental_request_name]) | ||
return opil_doc | ||
|
||
raise IntentParserException('Aquarium does not support %s as an experimental request' % experimental_request_name) | ||
|
||
def get_protocol_interface(self, protocol_name): | ||
opil_doc = self.get_experimental_request_as_opil_doc(protocol_name) | ||
protocol_interfaces = opil_utils.get_protocol_interfaces_from_sbol_doc(opil_doc) | ||
if len(protocol_interfaces) == 0: | ||
raise IntentParserException('No opil protocol interface found from aquarium protocol %s' % protocol_name) | ||
|
||
if len(protocol_interfaces) > 1: | ||
raise IntentParserException('Expected to find one opil protocol interface for %s but more than one was found' % protocol_name) | ||
|
||
return protocol_interfaces[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from intent_parser.intent.control_intent import ControlIntent | ||
from intent_parser.intent.lab_intent import LabIntent | ||
from intent_parser.intent.measurement_intent import MeasurementIntent | ||
from intent_parser.intent.parameter_intent import ParameterIntent | ||
import logging | ||
|
||
class ExperimentalRequestIntent(object): | ||
""" | ||
Intent Parser's representation of an experimental request | ||
""" | ||
|
||
logger = logging.getLogger('experimental_request_intent') | ||
|
||
def __init__(self, experimental_request_name=''): | ||
self._experimental_request_name = experimental_request_name | ||
self._lab_intent = LabIntent() | ||
self._measurement_intents = [] | ||
self._control_intent = ControlIntent() | ||
self._parameter_intent = ParameterIntent() | ||
|
||
def add_measurement_intent(self, measurement_intent): | ||
self._measurement_intents.add(measurement_intent) |
Oops, something went wrong.