<jupyter_start><jupyter_text>Inlined and Referenced Objects Replacing Identifiable Objects with their IdentifiersAs an example, `Allele` contains a `location`, which must be `oneOf` 1) a subclass of `Location`, or 2) a `CURIE`.Attributes that may be either objects or object identifiers are called _referable attributes_. When a referable attribute contains an object, the object is said to be _inlined_ ; when it is an identifier, it said to be _referenced_. `vr-python` provides code to convert referable attributes between their inlined and referenced forms. Replacing an inlined object with a referenced form is provided by `ga4gh_enref`, and replacing references with their inlined form is provided by `ga4gh_deref`.Dereferencing an object requires having an _object store_ that converts GA4GH identifiers into GA4GH VR objects. In the simplest case, this may be a Python dictionary.  The `vr-python` implementation includes a Redis-backed object store that provides high-performance object retrieval.![graphic](https://i.imgur.com/vBY3Pu8.png)<jupyter_code>from ga4gh.core import ga4gh_identify
from ga4gh.vrs import models, vrs_deref, vrs_enref

import json
def ppo(o):
    """pretty print object as json"""
    print(json.dumps(o.as_dict(), indent=2))
# A sample Allele
allele_dict = {
    'location': {
        'interval': {
            'end': 32936732,
            'start': 32936731,
            'type': 'SimpleInterval'},
        'sequence_id': 'ga4gh:SQ._0wi-qoDrvram155UmcSC-zA5ZK4fpLT',
        'type': 'SequenceLocation'},
    'state': {
        'sequence': 'A',
        'type': 'SequenceState'},
    'type': 'Allele'}
allele = models.Allele(**allele_dict)
allele._id = ga4gh_identify(allele)
allele.location._id = ga4gh_identify(allele.location)
ppo(allele)<jupyter_output>{
  "_id": "ga4gh:VA.mpIbo0Vv4HT-Oh3g5SWcuzAR2mue3yL-",
  "type": "Allele",
  "location": {
    "_id": "ga4gh:VSL.v9K0mcjQVugxTDIcdi7GBJ_R6fZ1lsYq",
    "type": "SequenceLocation",
    "sequence_id": "ga4gh:SQ._0wi-qoDrvram155UmcSC-zA5ZK4fpLT",
    "interval": {
      "type": "SimpleInterval",
      "start": 32936731,
      "end": 32936732
    }
  },
  "state": {
    "type": "SequenceState",
    "sequence": "A"
  }
}<jupyter_text>ga4gh_enref and ga4gh_deref using a Python dictionary<jupyter_code>object_store = {}
allele_refd = vrs_enref(allele, object_store=object_store)
ppo(allele_refd)
object_store
object_store["ga4gh:VSL.v9K0mcjQVugxTDIcdi7GBJ_R6fZ1lsYq"]
allele_inld = vrs_deref(allele_refd, object_store=object_store)
ppo(allele_inld)<jupyter_output>{
  "_id": "ga4gh:VA.mpIbo0Vv4HT-Oh3g5SWcuzAR2mue3yL-",
  "type": "Allele",
  "location": {
    "_id": "ga4gh:VSL.v9K0mcjQVugxTDIcdi7GBJ_R6fZ1lsYq",
    "type": "SequenceLocation",
    "sequence_id": "ga4gh:SQ._0wi-qoDrvram155UmcSC-zA5ZK4fpLT",
    "interval": {
      "type": "SimpleInterval",
      "start": 32936731,
      "end": 32936732
    }
  },
  "state": {
    "type": "SequenceState",
    "sequence": "A"
  }
}
{'fraction_non_alphanumeric': 0.12113055181695828, 'fraction_numerical': 0.03936742934051144, 'mean_word_length': 4.526022304832714, 'pattern_counts': {'":': 26, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '128800', 'license': 'Apache-2.0', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1100, 'n_words': 252, 'path': 'notebooks/Inlined and Referenced Objects.ipynb', 'repo_name': 'reece/vmc-python', 'size': '2972'}