Example #1
0
    void IndividualHumanVector::UpdateInfectiousness(float dt)
    {
        infectiousness = 0;
        float tmp_infectiousness = 0;  

        typedef std::map< StrainIdentity, float >     strain_infectivity_map_t;
        typedef strain_infectivity_map_t::value_type  strain_infectivity_t;
        strain_infectivity_map_t infectivity_by_strain;
        StrainIdentity tmp_strainIDs;

        // Loop once over all infections, caching strains and infectivity.
        // If total infectiousness exceeds unity, we will normalize all strains down accordingly.
        for (auto infection : infections)
        {
            release_assert( infection );
            tmp_infectiousness = infection->GetInfectiousness();
            infectiousness += tmp_infectiousness;

            if ( tmp_infectiousness > 0 )
            {
                infection->GetInfectiousStrainID(&tmp_strainIDs);
                infectivity_by_strain[tmp_strainIDs] += tmp_infectiousness;
            }
        }

        // Effects of transmission-reducing immunity.  N.B. interventions on vector success are not here, since they depend on vector-population-specific behavior
        release_assert( susceptibility );
        release_assert( interventions );
        float modtransmit = susceptibility->GetModTransmit() * interventions->GetInterventionReducedTransmit();

        // Maximum individual infectiousness is set here, capping the sum of unmodified infectivity at prob=1
        float truncate_infectious_mod = (infectiousness > 1 ) ? 1.0f/infectiousness : 1.0f;
        infectiousness *= truncate_infectious_mod * modtransmit;

        // Host weight is the product of MC weighting and relative biting
        float host_vector_weight = float(GetMonteCarloWeight() * GetRelativeBitingRate());

        // Effects from vector intervention container
        IVectorInterventionsEffects* ivie = nullptr;
        if ( s_OK !=  interventions->QueryInterface(GET_IID(IVectorInterventionsEffects), (void**)&ivie) )
        {
            throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "interventions", "IVectorInterventionsEffects", "IndividualHumanVector" );
        }

        // Loop again over infection strains, depositing (downscaled) infectivity modified by vector intervention effects etc. (indoor + outdoor)
        for (auto& infectivity : infectivity_by_strain)
        {
            const StrainIdentity *id = &(infectivity.first);

            parent->DepositFromIndividual( const_cast<StrainIdentity*>(id), host_vector_weight * infectivity.second * truncate_infectious_mod * modtransmit * ivie->GetblockIndoorVectorTransmit(), &NodeVector::human_to_vector_indoor );
            parent->DepositFromIndividual( const_cast<StrainIdentity*>(id), host_vector_weight * infectivity.second * truncate_infectious_mod * modtransmit * ivie->GetblockOutdoorVectorTransmit(), &NodeVector::human_to_vector_outdoor );
        }
    }
Example #2
0
    void IndividualHumanVector::Expose( const IContagionPopulation* cp, float dt, TransmissionRoute::Enum transmission_route )
    {
        release_assert( cp );
        release_assert( susceptibility );
        release_assert( interventions );
#if 1
        // get rid of this. but seems to be needed for malaria garki. :( :( :(
        if( !vector_interventions )
        {
            vector_interventions = static_cast<VectorInterventionsContainer*>(interventions);
        }
#endif
        release_assert( vector_interventions );
        float acqmod = GetRelativeBitingRate() * susceptibility->getModAcquire() * interventions->GetInterventionReducedAcquire();

        switch( transmission_route )
        {
            case TransmissionRoute::TRANSMISSIONROUTE_VECTOR_TO_HUMAN_INDOOR:
                acqmod *= vector_interventions->GetblockIndoorVectorAcquire();
                break;

            case TransmissionRoute::TRANSMISSIONROUTE_VECTOR_TO_HUMAN_OUTDOOR:
                acqmod *= vector_interventions->GetblockOutdoorVectorAcquire();
                break;
        
            default:
                throw BadEnumInSwitchStatementException( __FILE__, __LINE__, __FUNCTION__, "transmission_route", transmission_route, "Stringified enum value not available" );
        }

        // Accumulate vector of pairs of strain ids and cumulative infection probability
        float infection_probability = cp->GetTotalContagion() * acqmod * dt;
        if ( infection_probability > 0 )
        {
            // Increment total exposure
            m_total_exposure += infection_probability;

            // With a weighted random draw, pick a strain from the ContagionPopulation CDF
            StrainIdentity strain_id;
            strain_id.SetAntigenID(cp->GetAntigenId());
            cp->ResolveInfectingStrain(&strain_id); 

            // Push this exposure and strain back to the storage array for all vector-to-human pools (e.g. indoor, outdoor)
            m_strain_exposure.push_back( std::make_pair(strain_id, m_total_exposure) );
        }
    }
Example #3
0
    void IndividualHumanMalaria::DepositInfectiousnessFromGametocytes()
    {
        release_assert( malaria_susceptibility );
        m_inv_microliters_blood = malaria_susceptibility->get_inv_microliters_blood();

        // Now add a factor to limit inactivation of gametocytes by inflammatory cytokines
        // Important for slope of infectivity v. gametocyte counts
        double fever_effect = malaria_susceptibility->get_cytokines();
        fever_effect = Sigmoid::basic_sigmoid(SusceptibilityMalariaConfig::cytokine_gametocyte_inactivation, float(fever_effect));
        // fever_effect*=0.95;

        // Infectivity is reviewed by Sinden, R. E., G. A. Butcher, et al. (1996). "Regulation of Infectivity of Plasmodium to the Mosquito Vector." Advances in Parasitology 38: 53-117.
        // model based on data from Jeffery, G. M. and D. E. Eyles (1955). "Infectivity to Mosquitoes of Plasmodium Falciparum as Related to Gametocyte Density and Duration of Infection." Am J Trop Med Hyg 4(5): 781-789.
        // and Schneider, P., J. T. Bousema, et al. (2007). "Submicroscopic Plasmodium falciparum gametocyte densities frequently result in mosquito infection." Am J Trop Med Hyg 76(3): 470-474.
        // 2 due to bloodmeal and other factor due to conservative estimate for macrogametocyte ookinete transition, can be a higher reduction due to immune response
        // that factor also includes effect of successful fertilization with male gametocytes
        infectiousness = float(EXPCDF(-double(m_female_gametocytes) * m_inv_microliters_blood * MICROLITERS_PER_BLOODMEAL * SusceptibilityMalariaConfig::base_gametocyte_mosquito_survival * (1.0 - fever_effect))); //temp function, see vector_parameter_scratch.xlsx

        LOG_DEBUG_F("Gametocytes: %lld (male) %lld (female).  Infectiousness=%0.2g\n", m_male_gametocytes, m_female_gametocytes, infectiousness);

        // Effects of transmission-reducing immunity.  N.B. interventions on vector success are not here, since they depend on vector-population-specific behavior
        float modtransmit = susceptibility->GetModTransmit() * interventions->GetInterventionReducedTransmit();
        infectiousness *= modtransmit;

        // Host weight is the product of MC weighting and relative biting
        float host_vector_weight = float(GetMonteCarloWeight() * GetRelativeBitingRate());
        float weighted_infectiousnesss = host_vector_weight * infectiousness;

        // Effects from vector intervention container
        IVectorInterventionsEffects* ivie = nullptr;
        if ( s_OK !=  interventions->QueryInterface(GET_IID(IVectorInterventionsEffects), (void**)&ivie) )
        {
            throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "interventions", "IVectorInterventionsEffects", "IndividualHumanVector" );
        }

        // Here we deposit human-to-vector infectiousness based on proportional outcrossing of strain IDs
        gametocytes_strain_map_t::const_iterator gc1,gc2,end=m_female_gametocytes_by_strain.end();
        for (gc1=m_female_gametocytes_by_strain.begin(); gc1!=end; ++gc1)
        {
            for (gc2=gc1; gc2!=end; ++gc2)
            {
                // Fractional weight is product of component weights
                float strain_weight;
                if (gc1==gc2)
                {
                    strain_weight = pow( float(gc1->second) / float(m_female_gametocytes), 2 );
                    DepositFractionalContagionByStrain( weighted_infectiousnesss * strain_weight, ivie, gc1->first.GetAntigenID(), gc1->first.GetGeneticID() );
                    continue;
                }

                // Two off-diagonal contributions given how pairwise iteration is done in this loop
                strain_weight = 2.0f * gc1->second * gc2->second / pow( float(m_female_gametocytes), 2 );
                LOG_DEBUG_F("Crossing two strains with weight %0.2f and %0.2f\n", gc1->second/float(m_female_gametocytes), gc2->second/(float)m_female_gametocytes);

                // Genetic ID from first component
                int geneticID = gc1->first.GetGeneticID();
                if ( geneticID != gc2->first.GetGeneticID() ) 
                {
                    // One outcrossing realization if genetic IDs are different
                    geneticID = MalariaBarcode::getInstance()->fromOutcrossing( geneticID, gc2->first.GetGeneticID() );
                    LOG_DEBUG_F("Crossing geneticID %d + %d --> %d\n", gc1->first.GetGeneticID(), gc2->first.GetGeneticID(), geneticID);
                }

                // Deposit fractional infectiousness to each of indoor and outdoor pools
                if ( gc1->first.GetAntigenID() == gc2->first.GetAntigenID() )
                {
                    DepositFractionalContagionByStrain( weighted_infectiousnesss * strain_weight, ivie, gc1->first.GetAntigenID(), geneticID );
                }
                else
                {
                    // Deposit half the weight to each if antigenIDs are different.  
                    // Note that geneticID is not outcrossed independently for the different antigen IDs.
                    DepositFractionalContagionByStrain( 0.5f * weighted_infectiousnesss * strain_weight, ivie, gc1->first.GetAntigenID(), geneticID );
                    DepositFractionalContagionByStrain( 0.5f * weighted_infectiousnesss * strain_weight, ivie, gc2->first.GetAntigenID(), geneticID );
                    LOG_DEBUG_F("Depositing contagion with antigenIDs %d and %d for geneticID=%d\n", gc1->first.GetAntigenID(), gc2->first.GetAntigenID(), geneticID);
                }
            }
        }
    }