def __init__(self, reactants, products):
        """Build a reaction node.

        :param reactants: A list of PyBEL node data dictionaries representing the reactants
        :type reactants: BaseAbundance or iter[BaseAbundance]
        :param products: A list of PyBEL node data dictionaries representing the products
        :type products: BaseAbundance or iter[BaseAbundance]

        Example:

        >>> reaction([Protein(namespace='HGNC', name='KNG1')], [Abundance(namespace='CHEBI', name='bradykinin')])
        """
        super(Reaction, self).__init__(func=REACTION)

        if isinstance(reactants, BaseEntity):
            reactants = [reactants]
        else:
            reactants = sorted(reactants, key=_as_bel)

        if isinstance(products, BaseEntity):
            products = [products]
        else:
            products = sorted(products, key=_as_bel)

        self.update({
            REACTANTS: reactants,
            PRODUCTS: products,
        })
def __init__ ( self , reactants , products ) : super ( Reaction , self ) . __init__ ( func = REACTION ) if isinstance ( reactants , BaseEntity ) : reactants = [ reactants ] else : reactants = sorted ( reactants , key = _as_bel ) if isinstance ( products , BaseEntity ) : products = [ products ] else : products = sorted ( products , key = _as_bel ) self . update ( { REACTANTS : reactants , PRODUCTS : products , } )
Build a reaction node.

        :param reactants: A list of PyBEL node data dictionaries representing the reactants
        :type reactants: BaseAbundance or iter[BaseAbundance]
        :param products: A list of PyBEL node data dictionaries representing the products
        :type products: BaseAbundance or iter[BaseAbundance]

        Example:

        >>> reaction([Protein(namespace='HGNC', name='KNG1')], [Abundance(namespace='CHEBI', name='bradykinin')])