You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 961cc15
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: pyMBE/storage/instances/molecule.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,14 @@
19
19
20
20
frompyMBE.storage.base_typeimportPMBBaseModel
21
21
frompydanticimportvalidator
22
-
fromtypingimportOptional
22
+
fromtypingimportLiteral, Optional
23
23
24
24
classMoleculeInstance(PMBBaseModel):
25
25
"""
26
26
Persistent instance representation of a molecule.
27
27
28
28
Attributes:
29
-
pmb_type ('str'):
29
+
pmb_type ('Literal["molecule"]'):
30
30
Fixed string identifying this object as a molecule instance. Always ``"molecule"``.
31
31
32
32
name ('str'):
@@ -35,15 +35,15 @@ class MoleculeInstance(PMBBaseModel):
35
35
molecule_id ('int'):
36
36
Unique non-negative integer identifying this molecule instance within the database.
37
37
38
-
assembly_id (int | None):
39
-
Identifier of the super-parent assembly (e.g. hydrogel) to which this residue belongs. ``None`` indicates that the residue is not assigned to any assembly.
38
+
assembly_id (Optional[int]):
39
+
Identifier of the super-parent assembly (e.g. hydrogel) to which this molecule belongs. ``None`` indicates that the molecule is not assigned to any assembly.
40
40
41
41
Notes:
42
42
- Validation of whether ``name`` corresponds to a registered molecule template is performed at the database level.
43
43
- Structural or connectivity information (e.g., residue ordering) is maintained outside this class in the instance registry.
Copy file name to clipboardExpand all lines: pyMBE/storage/instances/particle.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@
17
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
#
19
19
20
-
fromtypingimportOptional
20
+
fromtypingimportLiteral, Optional
21
21
frompydanticimportvalidator
22
22
from ..base_typeimportPMBBaseModel
23
23
@@ -27,7 +27,7 @@ class ParticleInstance(PMBBaseModel):
27
27
Concrete instance of a particle placed in the simulation.
28
28
29
29
Attributes:
30
-
pmb_type ('str'):
30
+
pmb_type ('Literal["particle"]'):
31
31
Fixed string identifying this object as a particle instance. Always ``"particle"``.
32
32
33
33
name ('str'):
@@ -39,20 +39,20 @@ class ParticleInstance(PMBBaseModel):
39
39
initial_state ('str'):
40
40
Name of the particle state at creation time.
41
41
42
-
residue_id ('int' | 'None'):
42
+
residue_id ('Optional[int]'):
43
43
Optional identifier of the ``ResidueInstance`` this particle belongs to. Particles that are not part of a residue should leave this field as ``None``.
44
44
45
-
molecule_id ('int' | 'None'):
45
+
molecule_id ('Optional[int]'):
46
46
Optional identifier of the ``MoleculeInstance`` this particle belongs to. Particles not belonging to any molecule should keep this as ``None``.
47
47
48
-
assembly_id ('int' | 'None'):
48
+
assembly_id ('Optional[int]'):
49
49
Identifier of the super-parent assembly (e.g. hydrogel) to which this particle instance belongs. ``None`` indicates that the particle is not assigned to any assembly.
50
50
51
51
Notes:
52
52
- ``initial_state`` is stored as a plain string to ensure clean serialization and avoid engine-specific objects.
53
53
- Connectivity, bonding, and spatial ordering are external to this class and handled by the database or simulation backend.
Copy file name to clipboardExpand all lines: pyMBE/storage/instances/peptide.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,15 @@
19
19
20
20
frompyMBE.storage.base_typeimportPMBBaseModel
21
21
frompydanticimportvalidator
22
-
fromtypingimportOptional
22
+
fromtypingimportLiteral, Optional
23
23
24
24
25
25
classPeptideInstance(PMBBaseModel):
26
26
"""
27
27
Instance of a peptide molecule placed in the simulation.
28
28
29
29
Attributes:
30
-
pmb_type ('str'):
30
+
pmb_type ('Literal["peptide"]'):
31
31
Fixed string identifying this object as a peptide instance. Always ``"peptide"``.
32
32
33
33
name ('str'):
@@ -36,14 +36,14 @@ class PeptideInstance(PMBBaseModel):
36
36
molecule_id ('int'):
37
37
Unique non-negative integer identifying this peptide within the database.
38
38
39
-
assembly_id ('int' | 'None'):
39
+
assembly_id ('Optional[int]'):
40
40
Identifier of the super-parent assembly (e.g. hydrogel) to which this residue belongs. ``None`` indicates that the residue is not assigned to any assembly.
41
41
42
42
Notes:
43
43
- This class only tracks the identity of the peptide instance. Residues and particles belonging to the peptide reference this instance through their ``molecule_id`` fields.
44
44
- Connectivity (ordering of residues), spatial arrangement, and bonding interactions are managed separately by the database or simulation engine.
Copy file name to clipboardExpand all lines: pyMBE/storage/instances/protein.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,15 @@
19
19
20
20
frompyMBE.storage.base_typeimportPMBBaseModel
21
21
frompydanticimportvalidator
22
-
fromtypingimportOptional
22
+
fromtypingimportLiteral, Optional
23
23
24
24
25
25
classProteinInstance(PMBBaseModel):
26
26
"""
27
27
Instance of a protein molecule placed in the simulation.
28
28
29
29
Attributes:
30
-
pmb_type ('str'):
30
+
pmb_type ('Literal["protein"]'):
31
31
Fixed string identifying this object as a protein instance. Always ``"protein"``.
32
32
33
33
name ('str'):
@@ -36,15 +36,15 @@ class ProteinInstance(PMBBaseModel):
36
36
molecule_id ('int'):
37
37
Unique non-negative integer identifying this protein within the database.
38
38
39
-
assembly_id ('int' | 'None'):
39
+
assembly_id ('Optional[int]'):
40
40
Identifier of the super-parent assembly (e.g. hydrogel) to which this residue belongs. ``None`` indicates that the residue is not assigned to any assembly.
41
41
42
42
Notes:
43
43
- A ``ProteinInstance`` only records the identity of the protein and its template association.
44
44
- Residues and particles that belong to the protein reference this instance through their ``molecule_id`` values.
45
45
- The structural connectivity (residue sequence, domains) is handled at the template level or by the builder modules.
46
46
"""
47
-
pmb_type: str="protein"
47
+
pmb_type: Literal["protein"]="protein"
48
48
name: str# molecule template name
49
49
molecule_id: int
50
50
assembly_id: Optional[int] =None
@@ -53,4 +53,4 @@ class ProteinInstance(PMBBaseModel):
53
53
defvalidate_residue_id(cls, mid):
54
54
ifmid<0:
55
55
raiseValueError("molecule_id must be a non-negative integer.")
Copy file name to clipboardExpand all lines: pyMBE/storage/instances/residue.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,14 @@
19
19
20
20
frompyMBE.storage.base_typeimportPMBBaseModel
21
21
frompydanticimportvalidator
22
-
fromtypingimportOptional
22
+
fromtypingimportLiteral, Optional
23
23
24
24
classResidueInstance(PMBBaseModel):
25
25
"""
26
26
Instance of a residue placed within a molecule during a simulation.
27
27
28
28
Attributes:
29
-
pmb_type ('str'):
29
+
pmb_type ('Literal["residue"]'):
30
30
Fixed string identifying this object as a residue instance. Always ``"residue"``.
31
31
32
32
name ('str'):
@@ -35,18 +35,18 @@ class ResidueInstance(PMBBaseModel):
35
35
residue_id ('int'):
36
36
Unique non-negative integer identifying this residue instance within the database.
37
37
38
-
molecule_id ('int' | 'None'):
38
+
molecule_id ('Optional[int]'):
39
39
Identifier of the parent molecule to which this residue belongs. ``None`` indicates that the residue is not assigned to any molecule.
40
40
41
-
assembly_id ('int' | 'None'):
41
+
assembly_id ('Optional[int]'):
42
42
Identifier of the super-parent assembly (e.g. hydrogel) to which this residue belongs. ``None`` indicates that the residue is not assigned to any assembly.
43
43
44
44
Notes:
45
45
- ``ResidueInstance`` does not itself store particle-level information; instead, particles reference the residue via ``residue_id``.
46
46
- Residues may be standalone (e.g., in coarse systems) or part of polymers, proteins, peptides, or hydrogels.
47
47
- The sequence ordering and topology of residues are encoded at the molecule instance/template level, not here.
0 commit comments