biocrnpyler.core.MonomerCollection
- class biocrnpyler.core.MonomerCollection(monomers)[source]
Bases:
objectCollection of ordered monomers without any particular structure.
A base container class that holds a collection of
OrderedMonomerobjects without imposing any ordering or structural constraints. This class serves as a parent class for more structured polymer representations likeOrderedPolymer.- Parameters:
monomers (
listofOrderedMonomer) – List ofOrderedMonomerobjects to include in the collection. Each monomer is copied and linked to this collection as its parent.- Attributes:
monomers (
tupleofOrderedMonomer) – Tuple containing copies of the input monomers, with each monomer’s parent set to this collection.
See also
OrderedPolymerA polymer with ordered monomers and directionality.
OrderedMonomerA unit that can belong to a MonomerCollection.
Notes
Monomers are stored as a tuple (immutable) to prevent direct modification. Each monomer is copied during initialization to ensure the collection maintains its own references.
Examples
Create a collection of monomers:
>>> mon1 = bcp.OrderedMonomer() >>> mon2 = bcp.OrderedMonomer() >>> collection = bcp.MonomerCollection([mon1, mon2]) >>> len(collection.monomers) 2
Methods