-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vivax subpatent duration #250
Conversation
… check infectivity is constant. I think only the switch in human_infection.R will be looped during the simulation. The other switches specity initial infectivity and process selection.
…ameter. Typos in parameter.R corrected
… maternal immunity to detectability with rendering
Merge branch 'vivax_pre_eryth_imm' of https://github.com/mrc-ide/malariasimulation into vivax_pre_eryth_imm # Conflicts: # R/parasite_parameters.R
Merge branch 'vivax_subpatent_duration' of https://github.com/mrc-ide/malariasimulation into vivax_subpatent_duration # Conflicts: # tests/testthat/test-vivax.R
…c state is detectable by miscroscopy (e.g. prob = 1). This means that n-detect = p-detect, so might not be incredibly useful...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Richard, great to see all this progress.
A few specific and general comments here from me
…tion. Use anti-parasite immunity to calculate subpatent recovery rate for vivax. If vivax: calculate patent infections using anti-parasite immunity, then clinical infections. Added patent incidence to possible age rendering. Created immunity names list outside of render. Improved spacing, typos corrected. Tests for patent rendering and n/p detect outputs.
Added test for vivax infections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work updating the tests 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…t_pcr added: rendering and documentation. Restructured prevalence rendering function. Patent infection incidence added as an output. Made some of the documentation more consistent... Made tests consistent with outputs. Removed severe prevalence rendering documentation
…it wasn't actually producing an output becuase min age was set to numeric(0), rather than 0, so it might as well be fully turned off to avoid confusion. Changed age rendering back to n_age_ after chatting with Pete. test-infection-integration, I removed a couple of lines that don't seem to be contributing to anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RJSheppard 🎉. Just a few bits to follow up on from me.
R/render.R
Outdated
} | ||
|
||
clinically_detected <- state$get_index_of(c('Tr', 'D')) | ||
detected <- clinically_detected$copy()$or(asymptomatic_detected) | ||
|
||
lm_detected <- detected <- clinically_detected$copy()$or(asymptomatic_detected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be something that bugs me an not anyone else, but can we keep these as two seperate assignments please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops - this was actually a mistake (shouldn't have the middle part). I'll fix that.
R/render.R
Outdated
if(parameters$parasite == "falciparum"){ | ||
# render lm detection (falciparum): integer sample | ||
renderer$render( | ||
paste0('n_detect_lm_', lower, '_', upper), | ||
in_age$copy()$and(lm_detected)$size(), | ||
timestep | ||
) | ||
|
||
# render lm detection (falciparum): summed probability | ||
renderer$render( | ||
paste0('p_detect_lm_', lower, '_', upper), | ||
in_age$copy()$and(clinically_detected)$size() + sum( | ||
prob[bitset_index(asymptomatic, in_age)] | ||
), | ||
timestep | ||
) | ||
|
||
} else if (parameters$parasite == "vivax") { | ||
|
||
# render lm detection (vivax) | ||
renderer$render( | ||
paste0('n_detect_lm_', lower, '_', upper), | ||
in_age$copy()$and(lm_detected)$size(), | ||
timestep | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pull the repeating code out to simplify here:
if(parameters$parasite == "falciparum"){ | |
# render lm detection (falciparum): integer sample | |
renderer$render( | |
paste0('n_detect_lm_', lower, '_', upper), | |
in_age$copy()$and(lm_detected)$size(), | |
timestep | |
) | |
# render lm detection (falciparum): summed probability | |
renderer$render( | |
paste0('p_detect_lm_', lower, '_', upper), | |
in_age$copy()$and(clinically_detected)$size() + sum( | |
prob[bitset_index(asymptomatic, in_age)] | |
), | |
timestep | |
) | |
} else if (parameters$parasite == "vivax") { | |
# render lm detection (vivax) | |
renderer$render( | |
paste0('n_detect_lm_', lower, '_', upper), | |
in_age$copy()$and(lm_detected)$size(), | |
timestep | |
) | |
} | |
# render lm detection | |
renderer$render( | |
paste0('n_detect_lm_', lower, '_', upper), | |
in_age$copy()$and(lm_detected)$size(), | |
timestep | |
) | |
if(parameters$parasite == "falciparum"){ | |
# render lm detection (falciparum): summed probability | |
renderer$render( | |
paste0('p_detect_lm_', lower, '_', upper), | |
in_age$copy()$and(clinically_detected)$size() + sum( | |
prob[bitset_index(asymptomatic, in_age)] | |
), | |
timestep | |
) | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing - I think I'd been separating them because the calculations were different, but I've since included an extra if statement earlier that does that calculation at an earlier point.
… white spaces removed.
renderer, | ||
names, | ||
variables | ||
renderer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine now. But adding spaces can cause needless merge conflicts
Merge branch 'vivax_subpatent_duration' into HEAD # Conflicts: # R/disease_progression.R # R/mortality_processes.R # R/processes.R # data/parasite_parameters.rda # tests/testthat/test-vivax.R
I've created process function to work out subpatent durations (I thought about coopting the existing functions, but they don't line up closely enough and they model conceptually different things). Introduced maternal ID - used in these functions (birth/death and decay). Falciparum probability of detectability functions no longer used, including in rendering (also altered). Tests to check outputs.