Skip to content
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

Merged
merged 37 commits into from
Sep 27, 2023
Merged

Vivax subpatent duration #250

merged 37 commits into from
Sep 27, 2023

Conversation

RJSheppard
Copy link
Member

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.

… 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.
… 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...
Copy link
Member

@pwinskill pwinskill left a 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

R/disease_progression.R Outdated Show resolved Hide resolved
R/disease_progression.R Outdated Show resolved Hide resolved
R/disease_progression.R Outdated Show resolved Hide resolved
R/disease_progression.R Show resolved Hide resolved
R/processes.R Outdated Show resolved Hide resolved
R/render.R Outdated Show resolved Hide resolved
R/render.R Outdated Show resolved Hide resolved
tests/testthat/test-vivax.R Outdated Show resolved Hide resolved
Base automatically changed from vivax_parameters to vivax_main July 3, 2023 12:43
…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.
@RJSheppard RJSheppard requested a review from pwinskill July 4, 2023 10:30
Copy link
Member

@pwinskill pwinskill left a 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 👍

Copy link
Member

@giovannic giovannic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

R/human_infection.R Show resolved Hide resolved
R/parameters.R Show resolved Hide resolved
R/render.R Outdated Show resolved Hide resolved
…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.
Copy link
Member

@pwinskill pwinskill left a 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)
Copy link
Member

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.

Copy link
Member Author

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
Comment on lines 65 to 90
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
)
}
Copy link
Member

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:

Suggested change
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
)
}

Copy link
Member Author

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.

renderer,
names,
variables
renderer,
Copy link
Member

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
@RJSheppard RJSheppard merged commit b34c68b into vivax_main Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants