Example #1
0
    def step(self, mcs):
        if self.ir_steppable is None:
            self.ir_steppable: ImmuneRecruitmentSteppable = \
                self.shared_steppable_vars[ViralInfectionVTMLib.ir_steppable_key]

        # Track the total amount added and subtracted to the cytokine field
        total_ck_inc = 0.0

        for cell in self.cell_list_by_type(self.INFECTED, self.VIRUSRELEASING):
            viral_load = ViralInfectionVTMLib.get_assembled_viral_load_inside_cell(
                cell, vr_step_size)
            produced = cell.dict['ck_production'] * nCoVUtils.hill_equation(
                viral_load, ec50_infecte_ck_prod, 2)
            res = self.ck_secretor.secreteInsideCellTotalCount(
                cell, produced / cell.volume)
            total_ck_inc += res.tot_amount

        for cell in self.cell_list_by_type(self.IMMUNECELL):

            self.virus_secretor.uptakeInsideCellTotalCount(
                cell, cell.dict['ck_consumption'] / cell.volume, 0.1)

            up_res = self.ck_secretor.uptakeInsideCellTotalCount(
                cell, cell.dict['ck_consumption'] / cell.volume, 0.1)
            # decay seen ck
            cell.dict['tot_ck_upt'] *= ck_memory_immune

            # uptake ck

            cell.dict[
                'tot_ck_upt'] -= up_res.tot_amount  # from POV of secretion uptake is negative
            total_ck_inc += up_res.tot_amount
            p_activate = nCoVUtils.hill_equation(cell.dict['tot_ck_upt'],
                                                 EC50_ck_immune, 2)

            if rng.uniform() < p_activate and not cell.dict['activated']:

                cell.dict['activated'] = True
                cell.dict['time_activation'] = mcs
            elif (cell.dict['activated'] and
                  mcs - cell.dict['time_activation'] > minimum_activated_time):
                cell.dict['activated'] = False
                cell.dict['time_activation'] = -99

            if cell.dict['activated']:
                seen_field = self.total_seen_field(self.field.cytokine, cell)
                produced = cell.dict['ck_production'] * nCoVUtils.hill_equation(
                    seen_field, 100, 1)
                sec_res = self.ck_secretor.secreteInsideCellTotalCount(
                    cell, produced / cell.volume)

                total_ck_inc += sec_res.tot_amount

        self.ir_steppable.increment_total_cytokine_count(total_ck_inc)
Example #2
0
    def do_cell_internalization(self, cell, viral_amount_com):
        if cell.dict['Receptors'] == 0:
            return False, 0.0

        _k = kon * cell.volume / koff
        diss_coeff_uptake_pr = (initial_unbound_receptors / 2.0 / _k /
                                cell.dict['Receptors'])**(1.0 /
                                                          hill_coeff_uptake_pr)
        uptake_probability = nCoVUtils.hill_equation(viral_amount_com,
                                                     diss_coeff_uptake_pr,
                                                     hill_coeff_uptake_pr)

        cell_does_uptake = np.random.rand() < uptake_probability
        uptake_amount = s_to_mcs / rate_coeff_uptake_pr * uptake_probability

        if cell_does_uptake and cell.type == self.UNINFECTED:
            cell.type = self.INFECTED
            cell.dict['ck_production'] = max_ck_secrete_infect
            self.load_viral_replication_model(
                cell=cell,
                vr_step_size=vr_step_size,
                unpacking_rate=unpacking_rate,
                replicating_rate=replicating_rate,
                r_half=r_half,
                translating_rate=translating_rate,
                packing_rate=packing_rate,
                secretion_rate=secretion_rate)

        return cell_does_uptake, uptake_amount
Example #3
0
    def step(self, mcs):
        if self.simdata_steppable is None:
            self.simdata_steppable: SimDataSteppable = \
                self.shared_steppable_vars[ViralInfectionVTMLib.simdata_steppable_key]

        # Sample state of cell at center of domain (first infected cell)
        cell = self.cellField[self.dim.x / 2, self.dim.y / 2, 0]
        self.simdata_steppable.set_vrm_tracked_cell(cell=cell)

        # Do viral model
        for cell in self.cell_list_by_type(self.INFECTED, self.VIRUSRELEASING):
            # Step the model for this cell
            ViralInfectionVTMLib.step_sbml_model_cell(cell=cell)
            # Pack state variables into cell dictionary
            ViralInfectionVTMLib.pack_viral_replication_variables(cell=cell)

            # Test for infection secretion
            if cell.dict['Assembled'] > cell_infection_threshold:
                cell.type = self.VIRUSRELEASING
                ViralInfectionVTMLib.enable_viral_secretion(
                    cell=cell, secretion_rate=secretion_rate)

                # cytokine params
                cell.dict['ck_production'] = max_ck_secrete_infect

            # Test for cell death
            if cell.type == self.VIRUSRELEASING and \
                    np.random.random() < nCoVUtils.hill_equation(cell.dict['Assembled'],
                                                                 diss_coeff_uptake_apo,
                                                                 hill_coeff_uptake_apo):
                self.kill_cell(cell=cell)
                self.simdata_steppable.track_death_viral()
    def step(self, mcs):
        secretor = self.get_field_secretor("Virus")
        for cell in self.cell_list_by_type(self.UNINFECTED, self.INFECTED,
                                           self.INFECTEDSECRETING):

            # Evaluate probability of cell uptake of viral particles from environment
            # If cell isn't infected, it changes type to infected here if uptake occurs
            _k = kon * cell.volume / koff
            diss_coeff_uptake_pr = math.sqrt(initial_unbound_receptors / 2.0 /
                                             _k / cell.dict['Receptors'])
            viral_amount_com = self.field.Virus[cell.xCOM, cell.yCOM,
                                                cell.zCOM] * cell.volume
            uptake_probability = nCoVUtils.hill_equation(
                viral_amount_com, diss_coeff_uptake_pr, hill_coeff_uptake_pr)
            if np.random.rand() < uptake_probability:
                uptake = secretor.uptakeInsideCellTotalCount(
                    cell, 1E12, uptake_probability / cell.volume)
                cell.dict['Uptake'] = abs(uptake.tot_amount)
                cell.dict['Receptors'] = max(
                    cell.dict['Receptors'] + cell.dict['Uptake'] * s_to_mcs,
                    0.0)
                if cell.type == self.UNINFECTED:
                    cell.type = self.INFECTED
                    cell.dict['ck_production'] = max_ck_secrete_infect
                    self.load_viral_replication_model(
                        cell=cell,
                        vr_step_size=vr_step_size,
                        unpacking_rate=unpacking_rate,
                        replicating_rate=replicating_rate,
                        r_half=r_half,
                        translating_rate=translating_rate,
                        packing_rate=packing_rate,
                        secretion_rate=secretion_rate)
                CoronavirusLib.set_viral_replication_cell_uptake(
                    cell=cell, uptake=cell.dict['Uptake'])

            if cell.type == self.INFECTEDSECRETING:
                sec_amount = CoronavirusLib.get_viral_replication_cell_secretion(
                    cell=cell)
                secretor.secreteInsideCellTotalCount(cell,
                                                     sec_amount / cell.volume)
    def step(self, mcs):
        if self.simdata_steppable is None:
            self.simdata_steppable: SimDataSteppable = self.shared_steppable_vars[
                CoronavirusLib.simdata_steppable_key]

        # Report rates to console
        # print("Unpacking Rate = " + str(unpacking_rate))
        # print("Replicating Rate = " + str(replicating_rate))
        # print("Translating Rate = " + str(translating_rate))
        # print("Packing Rate = " + str(packing_rate))
        # print("Secretion Rate = " + str(secretion_rate))

        # Sample state of cell at center of domain (first infected cell)
        cell = self.cellField[self.dim.x / 2, self.dim.y / 2, 0]
        # Or sample state of cell near the first infected cell
        # cell = self.cellField[40, 45, 0]
        self.simdata_steppable.set_vrm_tracked_cell(cell=cell)

        # Do viral model
        for cell in self.cell_list_by_type(self.INFECTED,
                                           self.INFECTEDSECRETING):
            # Step the model for this cell
            CoronavirusLib.step_sbml_model_cell(cell)
            # Pack state variables into cell dictionary
            CoronavirusLib.pack_viral_replication_variables(cell=cell)

            # Test for infection secretion
            if cell.dict['Assembled'] > cell_infection_threshold:
                cell.type = self.INFECTEDSECRETING
                CoronavirusLib.enable_viral_secretion(
                    cell=cell, secretion_rate=secretion_rate)

                # cyttokine params
                cell.dict['ck_production'] = max_ck_secrete_infect

            # Test for cell death
            if cell.type == self.INFECTEDSECRETING and \
                    np.random.random() < nCoVUtils.hill_equation(cell.dict['Assembled'],
                                                                 diss_coeff_uptake_apo,
                                                                 hill_coeff_uptake_apo):
                self.kill_cell(cell=cell)