bool IndividualHumanTB::HasEverRelapsedAfterTreatment() const { // Query for intervention container IIndividualHumanInterventionsContext *context = GetInterventionsContext(); ITBInterventionsContainer * itbivc = nullptr; if (s_OK != context->QueryInterface(GET_IID(ITBInterventionsContainer), (void**)&itbivc) ) { throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "context", "ITBInterventionsContainer", "IIndividualHumanInterventionsContext" ); } return itbivc->GetTxEverRelapsedStatus(); }
bool IndividualHumanTB::IsTreatmentNaive() const { // Query for intervention container, in future cache TB Intervention container when we create it IIndividualHumanInterventionsContext *context = GetInterventionsContext(); ITBInterventionsContainer * itbivc = nullptr; if (s_OK != context->QueryInterface(GET_IID(ITBInterventionsContainer), (void**)&itbivc) ) { throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "context", "ITBInterventionsContainer", "IIndividualHumanInterventionsContext" ); } return itbivc->GetTxNaiveStatus(); }
bool IndividualHumanTB::IsOnTreatment() const { // Query for intervention container IIndividualHumanInterventionsContext *context = GetInterventionsContext(); ITBInterventionsContainer * itbivc = nullptr; if (s_OK != context->QueryInterface(GET_IID(ITBInterventionsContainer), (void**)&itbivc) ) { throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "context", "ITBInterventionsContainer", "IIndividualHumanInterventionsContext" ); } if ( itbivc->GetNumTBDrugsActive() > 0 ) { return true; } else { return false; } }
void IndividualHumanMalaria::UpdateGametocyteCounts(float dt) { // Check for mature gametocyte drug killing float drugGametocyteKill = 0; IMalariaDrugEffects* imde = nullptr; if (s_OK == GetInterventionsContext()->QueryInterface(GET_IID(IMalariaDrugEffects), (void **)&imde)) { drugGametocyteKill = imde->get_drug_gametocyteM(); } else { throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "GetInterventionsContext()", "IMalariaDrugEffects", "IIndividualHumanInterventionsContext" ); } // Older mature gametocytes die; then add in the newly matured ones double pkill = 0; double numkilled = 0; // Decay half-life--Sinden, R. E., G. A. Butcher, et al. (1996). "Regulation of Infectivity of Plasmodium to the Mosquito Vector." Advances in Parasitology 38: 53-117. // Smalley, M. E. and R. E. Sinden (1977). "Plasmodium falciparum gametocytes: their longevity and infectivity." Parasitology 74(01): 1-8. pkill = EXPCDF(-dt * (0.277 + drugGametocyteKill));// half-life of 2.5 days corresponds to a decay time constant of 3.6 days, 0.277 = 1/3.6 m_male_gametocytes = 0; for( gametocytes_strain_map_t::iterator gc = m_male_gametocytes_by_strain.begin(); gc != m_male_gametocytes_by_strain.end(); ) { // Gaussian approximation of binomial errors for each strain that is present numkilled = (randgen->eGauss() * sqrt(pkill * gc->second * (1.0 - pkill)) + pkill * gc->second); // halflife of 2.5 days numkilled = max(0.0, numkilled); //can't add by killing gc->second = int64_t(gc->second - numkilled); gc->second = max(0L, gc->second); if ( gc->second == 0 ) { gc = m_male_gametocytes_by_strain.erase(gc); // remove empty strains from map } else { m_male_gametocytes += gc->second; ++gc; } } m_female_gametocytes = 0; for( gametocytes_strain_map_t::iterator gc = m_female_gametocytes_by_strain.begin(); gc != m_female_gametocytes_by_strain.end(); ) { numkilled = (randgen->eGauss() * sqrt(pkill * gc->second * (1.0 - pkill)) + pkill * gc->second); // halflife of 2.5 days numkilled = max(0.0, numkilled); //can't add by killing gc->second = int64_t(gc->second - numkilled); gc->second = max(0L, gc->second); if ( gc->second == 0 ) { gc = m_female_gametocytes_by_strain.erase(gc); // remove empty strains from map } else { m_female_gametocytes += gc->second; ++gc; } } infectiousness = 0; int64_t tmp_male_gametocytes = 0; int64_t tmp_female_gametocytes = 0; StrainIdentity tmp_strainIDs; // Loop over infections and add newly matured male and female gametocytes by strain for (auto infection : infections) { // Cast from Infection --> InfectionMalaria IInfectionMalaria *tempinf = nullptr; if( infection->QueryInterface( GET_IID(IInfectionMalaria), (void**)&tempinf ) != s_OK ) { throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "Infection", "IInfectionMalaria", "tempinf" ); } //InfectionMalaria *tempinf = static_cast<InfectionMalaria *>(infection); // Get gametocytes that have matured in this timestep // N.B. malariaCycleGametocytes is called once per asexual cycle (several days), // so the stage-5 counter is reset to avoid multiple counting. tmp_male_gametocytes = tempinf->get_MaleGametocytes(5); tempinf->reset_MaleGametocytes(/* stage */5); tmp_female_gametocytes = tempinf->get_FemaleGametocytes(5); tempinf->reset_FemaleGametocytes(/* stage */5); // No new gametocytes if ( tmp_male_gametocytes==0 && tmp_female_gametocytes==0 ) continue; // Add new gametocytes to those carried over (and not killed) from the previous time steps infection->GetInfectiousStrainID(&tmp_strainIDs); m_male_gametocytes_by_strain[tmp_strainIDs] += tmp_male_gametocytes; m_male_gametocytes += tmp_male_gametocytes; m_female_gametocytes_by_strain[tmp_strainIDs] += tmp_female_gametocytes; m_female_gametocytes += tmp_female_gametocytes; } }