Пример #1
0
    def create_reaction_rule_cache(self, rr):
        reactants = [id for id in rr.reactants]
        products = [id for id in rr.products]

        if len(reactants) == 1:
            k = float(rr['k'])
        elif len(reactants) == 2:
            st1 = self.model.get_species_type_by_id(reactants[0])
            st2 = self.model.get_species_type_by_id(reactants[1])
            D = float(st1['D']) + float(st2['D'])
            sigma = float(st1['radius']) + float(st2['radius'])
            kD = utils.k_D(D, sigma)
            k = float(rr['k'])
            if kD == 0.0:
                k = 0.0
            elif k != 0.0:
                k = utils.k_on(k, kD) * (1000 * utils.N_A)

        return ReactionRuleCache(rr, reactants, products, k)
Пример #2
0
    def create_reaction_rule_cache(self, rr):
        reactants = [id for id in rr.reactants]
        products = [id for id in rr.products]

        if len(reactants) == 1:
            k = float(rr['k'])
        elif len(reactants) == 2:
            st1 = self.model.get_species_type_by_id(reactants[0])
            st2 = self.model.get_species_type_by_id(reactants[1])
            D = float(st1['D']) + float(st2['D'])
            sigma = float(st1['radius']) + float(st2['radius'])
            kD = utils.k_D(D, sigma)
            k = float(rr['k'])
            if kD == 0.0:
                k = 0.0
            elif k != 0.0:
                k = utils.k_on(k, kD) * (1000 * utils.N_A)

        return ReactionRuleCache(rr, reactants, products, k)
Пример #3
0
    def create_reaction_rule_cache(self, rr):
        reactants = [id for id in rr.reactants]
        products = [id for id in rr.products]

        k = float(rr.k)

        if self.convert_rates == False:
            # Don't do the conversion below.
            return ReactionRuleCache(rr, reactants, products, k)

        if len(reactants) == 1:
            if len(products) == 2:
                st1 = self.model.get_species_type_by_id(products[0])
                st2 = self.model.get_species_type_by_id(products[1])

                # Lookup kon for reverse reaction rule.
                for rr_possible_reverse in self.get_reaction_rule2(st1, st2):
                    if rr_possible_reverse.products == reactants: 
                        rr_reverse = rr_possible_reverse
                        kon = float(rr_reverse.k)

                        # Compute kD for reverse reaction.
                        D = float(st1['D']) + float(st2['D'])
                        sigma = float(st1['radius']) + float(st2['radius'])
                        kD = utils.k_D(D, sigma)

                        # Use overall rate internally.
                        k = utils.k_off(k, kon, kD)

        elif len(reactants) == 2:
            st1 = self.model.get_species_type_by_id(reactants[0])
            st2 = self.model.get_species_type_by_id(reactants[1])
            D = float(st1['D']) + float(st2['D'])
            sigma = float(st1['radius']) + float(st2['radius'])
            kD = utils.k_D(D, sigma)
            if kD == 0.0:
                k = 0.0
            elif k != 0.0:
                # Use overall rate kon internally.
                k = utils.k_on(k, kD)

        return ReactionRuleCache(rr, reactants, products, k)
Пример #4
0
    def create_reaction_rule_cache(self, rr):
        reactants = [id for id in rr.reactants]
        products = [id for id in rr.products]

        k = float(rr.k)

        if self.convert_rates == False:
            # Don't do the conversion below.
            return ReactionRuleCache(rr, reactants, products, k)

        if len(reactants) == 1:
            if len(products) == 2:
                st1 = self.model.get_species_type_by_id(products[0])
                st2 = self.model.get_species_type_by_id(products[1])

                # Lookup kon for reverse reaction rule.
                for rr_possible_reverse in self.get_reaction_rule2(st1, st2):
                    if rr_possible_reverse.products == reactants:
                        rr_reverse = rr_possible_reverse
                        kon = float(rr_reverse.k)

                        # Compute kD for reverse reaction.
                        D = float(st1['D']) + float(st2['D'])
                        sigma = float(st1['radius']) + float(st2['radius'])
                        kD = utils.k_D(D, sigma)

                        # Use overall rate internally.
                        k = utils.k_off(k, kon, kD)

        elif len(reactants) == 2:
            st1 = self.model.get_species_type_by_id(reactants[0])
            st2 = self.model.get_species_type_by_id(reactants[1])
            D = float(st1['D']) + float(st2['D'])
            sigma = float(st1['radius']) + float(st2['radius'])
            kD = utils.k_D(D, sigma)
            if kD == 0.0:
                k = 0.0
            elif k != 0.0:
                # Use overall rate kon internally.
                k = utils.k_on(k, kD)

        return ReactionRuleCache(rr, reactants, products, k)