Quick Start
Requirements
Python 3.9. We recommend starting with a clean conda environment.
Access to OpenEye’s Python package server, Magpie. If you are a licensed Orion user and don’t have access, please contact OpenEye Support.
Follow the instructions there to configure access to Orion python packages via your pip.conf
file.
Installing Orion Platform
First generate a Python 3 environment and then install Orion Platform from a private PyPI server
(myvirtualenv) > pip install openeye-orionplatform
Some utilities of orion-platform have extra requirements that are not part of the base orion-platform installation. Extras may be installed with
(myvirtualenv) > pip install "openeye-orionplatform[dev]"
(myvirtualenv) > pip install "openeye-orionplatform[convert]"
Migrating from Cube Record
If you have cubes that already written using CubeRecord and are looking to migrate to Orion Platform, visit Migrating from CubeRecord
Writing Cubes with Orion Platform
The API that Orion Platform provides utilities for writing cubes and otherwise interacting with Orion from Floes.
The following example demonstrates a simple Molecular Weight cube.
# Import Base ComputeCube from Floe
from floe.api import ComputeCube
from orionplatform.mixins import RecordPortsMixin
from orionplatform.parameters import FloatFieldParameter, PrimaryMolFieldParameter
# Note: oechem must be imported before OpenEye toolkits
from openeye.oechem import OECalculateMolecularWeight
# Use RecordsPortMixin to add the default intake, success and failure ports
class MolecularWeightCube(RecordPortsMixin, ComputeCube):
title = "Example Molecular Weight Cube"
description = """A Description of the cube"""
classification = [["Example"]]
tags = ["Example"]
mwfield = FloatFieldParameter(
"mwfield",
# Default value for the Field Name
default="Molecular Weight",
# Indicates that the field must be populated
required=True,
# Title that is displayed in the UI
title="Molecular Weight Field",
# Description displayed in UI
description="The field name of the molecule weight field.",
)
# Read only Primary Molecule Field
mol_field = PrimaryMolFieldParameter("mol_field", read_only=True)
def process(self, record, port):
# Get the primary molecule using the mol field parameter
mol = record.get_readonly_reference(self.args.mol_field)
# Calculate the molecular weight
mol_weight = OECalculateMolecularWeight(mol, False)
record.set_value(self.args.mwfield, mol_weight)
self.success.emit(record)
Download code
Building Floes with Orion Platform Cubes
We provide set of basic Cubes that provide basic functionality for retrieving and writing data from within floes.
The following example demonstrates building a floe that reads records from datasets and writes records to a new dataset.
from floe.api import WorkFloe
from orionplatform.cubes import DatasetReaderCube, DatasetWriterCube
floe = WorkFloe("Example Dataset Floe", title="Example Dataset Floe")
floe.description = """
Example Floe demonstrating connecting Dataset Reader and Writer
"""
floe.tags = ["Example"]
floe.classification = [["Example"]]
# Declare Cubes
ifs = DatasetReaderCube("ifs")
ofs = DatasetWriterCube("ofs")
# Add cubes to floe
floe.add_cubes(ifs, ofs)
# Promote parameters
ifs.modify_parameter(ifs.data_in, promoted_name="in", title="Input Dataset")
ofs.modify_parameter(ofs.data_out, promoted_name="out", title="Output Dataset")
# Connect Ports
ifs.success.connect(ofs.intake)
if __name__ == "__main__":
floe.run()
Download code