Skip to content

About

A LinkML data model for OpenCloning

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

93 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCloning_LinkML

A LinkML data model for OpenCloning, a standardized schema for describing molecular cloning strategies and DNA assembly protocols.

Website

You can access the model documentation at https://opencloning.github.io/OpenCloning_LinkML

Migration from previous versions of the schema

If you have json files (or zip files exported from OpenCloning, with the cloning strategy and its sequencing files) in older formats, you can migrate them to the latest version using the migrate command. Some migrations edit the GenBank files of the sequences (e.g. those of sequences annotated with pLannotate), which requires Biopython, installed with the migration extra:

pip install 'opencloning-linkml[migration]'
python -m opencloning_linkml.migrations.migrate file.json

This 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.

Zip files are migrated the same way (python -m opencloning_linkml.migrations.migrate file.zip): the json file inside is migrated, and the sequencing files (verification-{sequence_id}-{file_name}) are renamed if the ids of their sequences change.

You can also specify a target version to migrate to:

python -m opencloning_linkml.migrations.migrate file.json --target-version 0.2.9

And you can skip the backup (simply edit in place):

python -m opencloning_linkml.migrations.migrate file.json --no-backup

Developer Documentation

The python package can be installed from PyPI:

pip install opencloning-linkml

For development you need uv and just (uv tool install rust-just). Then:

just install      # create .venv with all dev dependencies
just test         # run the schema, python and example tests
just gen-project  # regenerate project/ artefacts and the pydantic model from the schema
just testdoc      # build the docs and serve them locally
just              # list all recipes

Pre-commit hooks (ruff, yamllint, ...) can be enabled with uv run pre-commit install.

Creating a migration

To add a migration from version X.Y.Z to a new version A.B.C, follow these steps:

  1. Archive the current model: After generating the model for the new version (just gen-project), run just archive-model A.B.C. This saves a copy of src/opencloning_linkml/datamodel/_models.py to src/opencloning_linkml/migrations/model_archive/vA_B_C.py, without the LinkML metadata (which the migrations don't need).

  2. Create the transformation file: Create a new file src/opencloning_linkml/migrations/transformations/vX_Y_Z_to_vA_B_C.py with a migration function

  3. 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
    • Append it to the end of the MIGRATIONS list: ("X.Y.Z", "A.B.C", migrate_X_Y_Z_to_A_B_C)
  4. Add a test: Add a test to tests/test_migration.py to 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.

Credits

This project was made with linkml-project-cookiecutter and is kept up to date with its successor, linkml-project-copier.

About

A LinkML data model for OpenCloning

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages