SBGN-AF labels
pd2af.building.sbgn.labels
Make the label of an SBGN-AF activity from an SBGN-PD entity pool.
SBGN-AF activities are opaque, so two distinct PD proteoforms (same type and name, different state) would collapse under content-based model equality unless their distinguishing fields are folded into the activity's content. We do that through the activity label, built from the entity's units of information, state variables and name:
[unit|of|information][state@variables]name
Rules:
- The entity type and its compartment are not part of the label (the type is carried by the activity's unit-of-information glyph).
- Units of information are rendered
prefix:value(orvaluewith no prefix) and sorted (they carry no order). When inlined in the activity label they sit in a[...]bracket; on the unit-of-information glyph they carry no brackets (the brackets are the label serialization device only). In the merged reading (keep_speciesoff) (include_units_of_information=False) this block is not inlined into the label: a curator building an AF map from scratch writesct:mRNAon the nucleic-acid-feature glyph, never[ct:mRNA]in the label. The block (see :func:make_units_of_information_label) is instead placed on the activity's typed unit-of-information glyph by the model builder. The block is still kept inline for a complex's recursively built subunit name (below), which is a synthetic identity key, not a curator-facing label, so it stays maximally distinguishing. - State variables are rendered
value@variable(@variablewith no value,valuewith no variable, empty when neither) and listed in theirorderso multi-site proteoforms stay positionally distinct without showing the order number. An all-blank state-variable set renders no bracket. - A complex's subunits are not part of its name when the complex has its
own label; for an unlabelled complex the name is its subunits, built
recursively and joined by
:.
There are no spaces between elements.
Functions:
| Name | Description |
|---|---|
make_label |
Return the SBGN-AF activity label for an SBGN-PD entity pool or subunit. |
make_units_of_information_label |
Return the unit-of-information glyph label for an SBGN-PD element. |
make_label
make_label(entity_pool_or_subunit: Any, include_state_variables: bool = True, include_units_of_information: bool = True) -> str
Return the SBGN-AF activity label for an SBGN-PD entity pool or subunit.
The rules are those given in the module docstring.
When include_state_variables is False the state-variable block is
omitted so that distinct proteoforms (same type/name/units, different state)
collapse into a single merged activity.
When include_units_of_information is False the unit-of-information
block is omitted too -- the merged reading (keep_species off) relocates
it to the activity's unit-of-information glyph instead of inlining it. The
keep_species option keeps both blocks (the defaults).
Source code in src/pd2af/building/sbgn/labels.py
make_units_of_information_label
Return the unit-of-information glyph label for an SBGN-PD element.
The label is uoi1|uoi2|... -- tokens prefix:value (or value with
no prefix), sorted, joined by | -- or None when
entity_pool_or_subunit carries no units of information.
The merged reading (keep_species off) moves this off the activity
label and onto the AF activity's typed unit-of-information glyph (see
:func:pd2af.building.sbgn.model._make_activity), where a curator would put
it -- e.g. ct:mRNA on a nucleic-acid-feature glyph. It carries no
surrounding brackets: those are only the activity-label serialization device
(added by :func:make_label), not part of the glyph text.