cobra.core.group
================

.. py:module:: cobra.core.group

.. autoapi-nested-parse::

   Define the group class.



Classes
-------

.. autoapisummary::

   cobra.core.group.Group


Module Contents
---------------

.. py:class:: Group(id: str, name: str = '', members: Optional[Iterable] = None, kind: Optional[str] = None)

   Bases: :py:obj:`cobra.core.object.Object`


   Manage groups via this implementation of the SBML group specification.

   `Group` is a class for holding information regarding a pathways,
   subsystems, or other custom groupings of objects within a cobra.Model
   object.

   :param id: The identifier to associate with this group
   :type id: str
   :param name: A human readable name for the group
   :type name: str, optional
   :param members: A DictList containing references to cobra.Model-associated objects
                   that belong to the group.
   :type members: iterable, optional
   :param kind: The kind of group, as specified for the Groups feature in the SBML
                level 3 package specification. Can be any of "classification",
                "partonomy", or "collection". The default is "collection".
                Please consult the SBML level 3 package specification to ensure you
                are using the proper value for kind. In short, members of a
                "classification" group should have an "is-a" relationship to the group
                (e.g. member is-a polar compound, or member is-a transporter).
                Members of a "partonomy" group should have a "part-of" relationship
                (e.g. member is part-of glycolysis). Members of a "collection" group
                do not have an implied relationship between the members, so use this
                value for kind when in doubt (e.g. member is a gap-filled reaction,
                or member is involved in a disease phenotype).
   :type kind: {"collection", "classification", "partonomy"}, optional


   .. py:attribute:: KIND_TYPES
      :value: ('collection', 'classification', 'partonomy')



   .. py:attribute:: _members


   .. py:attribute:: _kind
      :value: None



   .. py:property:: kind
      :type: str


      Return the group kind.

      :returns: The group kind. Should be one of the three types allowed in SBML.
      :rtype: str


   .. py:attribute:: _model
      :value: None



   .. py:method:: __len__() -> int

      Get length of group.

      :returns: An int with the length of the group.
      :rtype: int



   .. py:property:: members
      :type: Set


      Get members of the group.

      :returns: A Set containing the members of the group.
      :rtype: Set


   .. py:method:: add_members(new_members: list) -> None

      Add objects to the group.

      :param new_members: A list of cobrapy objects to add to the group.
      :type new_members: list



   .. py:method:: remove_members(to_remove: list) -> None

      Remove objects from the group.

      :param to_remove: A list of cobra objects to remove from the group
      :type to_remove: list



