A LinkML data model for OpenCloning, a standardized schema for describing molecular cloning strategies and DNA assembly protocols.
You can access the model documentation at https://opencloning.github.io/OpenCloning_LinkML
If you have json files in older formats, you can migrate them to the latest version using the migrate command:
python -m opencloning_linkml.migrations.migrate file.jsonThis will create a new file with the same name but with the suffix _backup.json with the original data, and overwrite the original file with the migrated data.
You can also specify a target version to migrate to:
python -m opencloning_linkml.migrations.migrate file.json --target-version 0.2.9And you can skip the backup (simply edit in place):
python -m opencloning_linkml.migrations.migrate file.json --no-backupThe python package can be installed from PyPI:
pip install opencloning-linkmlmake all: make everythingmake deploy: deploys site
To add a migration from version X.Y.Z to a new version A.B.C, follow these steps:
-
Archive the current model: Save a copy of the current Pydantic model to
src/opencloning_linkml/migrations/model_archive/vA_B_C.py. This file should contain the complete model classes for versionA.B.C(typically copied fromsrc/opencloning_linkml/datamodel/_models.pyafter generating the new version). -
Create the transformation file: Create a new file
src/opencloning_linkml/migrations/transformations/vX_Y_Z_to_vA_B_C.pywith a migration function -
Register the migration: Add the migration to
src/opencloning_linkml/migrations/__init__.py:- Import the migration function:
from .transformations.vX_Y_Z_to_vA_B_C import migrate_X_Y_Z_to_A_B_C - Add it to the
load_migrations()return dictionary:("X.Y.Z", "A.B.C"): migrate_X_Y_Z_to_A_B_C
- Import the migration function:
-
Add a test: Add a test to
tests/test_migration.pyto ensure the migration works as expected.
Example: See v0_2_8_to_v0_2_9.py for a simple transformation example, or v0_2_9_to_v_0_4_0.py for a more complex migration with ID remapping and structural changes.
This project was made with linkml-project-cookiecutter.