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

Snake case lint #281

Merged
merged 32 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
857bb93
big rename
d-morrison Sep 25, 2024
d193a50
snake case
d-morrison Sep 25, 2024
63d457d
Merge commit '96db118c8edcce6a407b931e885d1ce1da08ab09'
d-morrison Jan 29, 2025
c1283e4
lint
d-morrison Jan 29, 2025
735fc2e
rename
d-morrison Jan 29, 2025
7a59852
rename
d-morrison Jan 29, 2025
c3ff36b
rename
d-morrison Jan 29, 2025
3839695
more cleanup
d-morrison Jan 29, 2025
421ab51
snap changed because curve params changed
d-morrison Jan 29, 2025
3c27912
Increment version number to 1.3.0.9006
d-morrison Jan 29, 2025
27d0029
update
d-morrison Jan 29, 2025
6e9a5d0
test
d-morrison Jan 29, 2025
5721f29
more
d-morrison Jan 29, 2025
5b5ee29
more cleanup
d-morrison Jan 29, 2025
ffefc42
need parallel for `sim_pop_data_multi()`
d-morrison Jan 29, 2025
5f45c5e
de-lint
d-morrison Jan 29, 2025
783aba4
lint
d-morrison Jan 29, 2025
2ffcdca
fixed lint
d-morrison Jan 29, 2025
b210674
lint
d-morrison Jan 29, 2025
b3b3f0a
fix checks on github and CRAN
d-morrison Jan 29, 2025
169401f
fix
d-morrison Jan 29, 2025
f1f3d3a
cleared lints
d-morrison Jan 29, 2025
e5e0603
cleared lint
d-morrison Jan 29, 2025
3ae649a
cleared lint
d-morrison Jan 29, 2025
2d489b1
import if_else()
d-morrison Jan 29, 2025
d09fdfb
more
d-morrison Jan 29, 2025
b934daa
moved references list from package file to intro vignette
d-morrison Jan 29, 2025
eb2702f
trying to fix reference issues
d-morrison Jan 29, 2025
cdee4ce
more
d-morrison Jan 29, 2025
d747401
lint
d-morrison Jan 29, 2025
12efcb2
more lint
d-morrison Jan 29, 2025
abf8d62
cleanup
d-morrison Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ allpopsamples_hlye.csv$
^vignettes/methodology\.qmd$
^\.quarto$
^revdep$
^man/ab\.Rd$
^man/baseline\.Rd$
^man/mk_baseline\.Rd$
^NEWS_files$
^NEWS\.html$
^man/check_strata\.Rd$
^man/df_to_array\.Rd$
^man/ldpar\.Rd$
^man/simcs.tinf\.Rd$
^man/simresp.tinf\.Rd$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ README.html
README_files
/.quarto/
NEWS.html
NEWS_files
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: serocalculator
Title: Estimating Infection Rates from Serological Data
Version: 1.3.0.9005
Version: 1.3.0.9006
Authors@R: c(
person("Peter", "Teunis", , "[email protected]", role = c("aut", "cph"),
comment = "Author of the method and original code."),
Expand All @@ -15,15 +15,15 @@ Description: Translates antibody levels measured in cross-sectional
seroconversions (infections) occur in the sampled populations.
Replaces the previous `seroincidence` package.
License: GPL-3
URL: https://github.com/UCD-SERG/serocalculator,
https://ucd-serg.github.io/serocalculator/
URL: https://ucd-serg.github.io/serocalculator/,
https://github.com/UCD-SERG/serocalculator
BugReports: https://github.com/UCD-SERG/serocalculator/issues
Depends:
R (>= 4.1.0)
Imports:
cli,
doParallel,
dplyr (>= 1.1.1),
dplyr,
foreach,
ggplot2,
ggpubr,
Expand All @@ -42,15 +42,15 @@ Imports:
purrr,
and,
glue,
stringr
stringr,
parallel
Suggests:
bookdown,
DT,
fs,
ggbeeswarm,
knitr,
pak,
parallel,
readr,
quarto,
rmarkdown,
Expand Down
5 changes: 3 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export(load_noise_params)
export(load_pop_data)
export(log_likelihood)
export(serocalculator_example)
export(sim.cs)
export(sim.cs.multi)
export(sim_pop_data)
export(sim_pop_data_multi)
importFrom(Rcpp,sourceCpp)
importFrom(doParallel,registerDoParallel)
importFrom(dplyr,across)
Expand All @@ -48,6 +48,7 @@ importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,if_all)
importFrom(dplyr,if_any)
importFrom(dplyr,if_else)
importFrom(dplyr,inner_join)
importFrom(dplyr,is.grouped_df)
importFrom(dplyr,mutate)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## New features

* Renamed variables for consistency (#281):
- `sim.cs()` -> `sim_pop_data()`
- `sim.cs.multi()` -> `sim_pop_data_multi()`

## Internal changes

* Removed `ldpar()` from API (#345)
Expand Down
4 changes: 2 additions & 2 deletions R/ab.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#' ncol = 2L,
#' dimnames = list(c("HlyE_IgA", "HlyE_IgG"), c("min", "max"))
#' )
#' preds <- ab(t = t, par = par1, blims = blims)
#' preds <- serocalculator:::ab(t = t, par = par1, blims = blims)
#'
#' @dev
#' @keywords internal
ab <- function(t, par, ...) {
t1 <- t1func(par)
y1 <- y1func(par)
Expand Down
5 changes: 2 additions & 3 deletions R/baseline.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param ... unused
#'
#' @returns an altered version of `yvec`
#' @dev
#' @keywords internal
#'
baseline <- function(kab, yvec, blims, ...) {
subst <- which(yvec < blims[kab, 2])
Expand All @@ -29,9 +29,8 @@ baseline <- function(kab, yvec, blims, ...) {
#' @param blims range of possible baseline antibody levels
#' @param ... not currently used
#' @return a [numeric()] vector
#' @dev
#' @keywords internal
mk_baseline <- function(kab, n = 1, blims, ...) {
# yset <- rlnorm(n=1,meanlog=negpar[1],sdlog=negpar[2]);
if (blims[kab, 2] == 0) {
yset <- rep(0, n)
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/df_to_array.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ df.to.array <- function( # nolint: object_name_linter
#' ) %>%
#' mutate(parameter = factor(parameter, levels = unique(parameter)))
#' arr <- df %>%
#' serocalculator::df_to_array(
#' serocalculator:::df_to_array(
#' dim_var_names = c("parameter", "Species"))
#' ftable(arr[,,1:5])
#' @dev
#' @keywords internal
df_to_array <- function(
df,
dim_var_names,
Expand Down
5 changes: 2 additions & 3 deletions R/ldpar.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param npar number of parameters
#' @returns an array of parameters:
#' c(y0,b0,mu0,mu1,c1,alpha,shape)
#' @dev
#' @keywords internal
ldpar <- function(age, antigen_isos, nmc, npar, ...) {
dimnames1 <- list(
params = c("y0", "b0", "mu0", "mu1", "c1", "alpha", "shape_r"),
Expand All @@ -24,8 +24,7 @@ ldpar <- function(age, antigen_isos, nmc, npar, ...) {
dimnames = dimnames1
)

for (k.test in antigen_isos)
{
for (k.test in antigen_isos) {
spar[, k.test] <- simpar(age, k.test, nmc, ...)
}
return(spar)
Expand Down
128 changes: 3 additions & 125 deletions R/serocalculator-package.R
Original file line number Diff line number Diff line change
@@ -1,128 +1,5 @@
#' _PACKAGE
#'
#' @name serocalculator
#'
#' @aliases serocalculator serocalculator-package
#'
#' @title
#' Estimating Infection Rates from Serological Data
#'
#' @description
#' This package translates antibody levels measured in a
#' (cross-sectional) population sample into an
#' estimate of the frequency with which seroconversions (infections)
#' occur in the sampled population.
#'
#' @author
#' * Peter Teunis \email{p.teunis@@emory.edu}
#' * Doug Ezra Morrison \email{demorrison@@ucdavis.edu}
#' * Kristen Aiemjoy \email{kaiemjoy@@ucdavis.edu}
#' * Kristina Lai \email{kwlai@@ucdavis.edu}
#'
#' @references
#'
#' ***Methods for estimating seroincidence***
#'
#' * Teunis, P. F. M., and J. C. H. van Eijkeren.
#' "Estimation of seroconversion rates for infectious diseases:
#' Effects of age and noise."
#' Statistics in Medicine 39, no. 21 (2020): 2799-2814.
#'
#' * Teunis, P. F. M., J. C. H. van Eijkeren, W. F. de Graaf,
#' A. Bonačić Marinović, and M. E. E. Kretzschmar.
#' "Linking the seroresponse to infection to within-host heterogeneity
#' in antibody production." Epidemics 16 (2016): 33-39.
#'
#'
#' ***Applications***
#'
#' * Aiemjoy, Kristen, Jessica C. Seidman, Senjuti Saha,
#' Sira Jam Munira, Mohammad Saiful Islam Sajib,
#' Syed Muktadir Al Sium, Anik Sarkar et al.
#' "Estimating typhoid incidence from community-based serosurveys:
#' a multicohort study." The Lancet Microbe 3, no. 8 (2022): e578-e587.
#'
#' * Aiemjoy, Kristen, John Rumunu, Juma John Hassen,
#' Kirsten E. Wiens, Denise Garrett, Polina Kamenskaya,
#' Jason B. Harris et al. "Seroincidence of enteric fever, Juba,
#' South Sudan." Emerging infectious diseases 28, no. 11 (2022): 2316.
#'
#' * Monge, S., Teunis, P. F., Friesema, I., Franz, E., Ang, W.,
#' van Pelt, W., Mughini-Gras, L.
#' "Immune response-eliciting exposure to Campylobacter vastly exceeds
#' the incidence of clinically
#' overt campylobacteriosis but is associated with similar
#' risk factors: A nationwide serosurvey in the Netherlands"
#' Journal of Infection, 2018, 1--7, doi:10.1016/j.jinf.2018.04.016
#'
#' * Kretzschmar, M., Teunis, P. F., Pebody, R. G.
#' "Incidence and reproduction numbers of pertussis: estimates from
#' serological and social contact data in five European countries"
#' PLoS Medicine 7, no. 6 (June 1, 2010):e1000291.
#' doi:10.1371/journal.pmed.1000291.
#'
#' * Simonsen, J., Strid, M. A., Molbak, K., Krogfelt, K. A.,
#' Linneberg, A., Teunis, P.
#' "Sero-epidemiology as a tool to study the incidence of
#' Salmonella infections in humans"
#' Epidemiology and Infection 136, no. 7 (July 1, 2008): 895--902.
#' doi:10.1017/S0950268807009314
#'
#' * Simonsen, J., Teunis, P. F., van Pelt, W., van Duynhoven, Y.,
#' Krogfelt, K. A., Sadkowska-Todys, M., Molbak K.
#' "Usefulness of seroconversion rates for comparing infection
#' pressures between countries"
#' Epidemiology and Infection, April 12, 2010, 1--8.
#' doi:10.1017/S0950268810000750.
#'
#' * Falkenhorst, G., Simonsen, J., Ceper, T. H., van Pelt, W.,
#' de Valk, H., Sadkowska-Todys, M., Zota, L., Kuusi, M.,
#' Jernberg, C., Rota, M. C., van Duynhoven, Y. T., Teunis, P. F.,
#' Krogfelt, K. A., Molbak, K.
#' "Serological cross-sectional studies on salmonella incidence in
#' eight European countries: no correlation with incidence of
#' reported cases"
#' BMC Public Health 12, no. 1 (July 15, 2012): 523--23.
#' doi:10.1186/1471-2458-12-523.
#'
#' * Teunis, P. F., Falkenhorst, G., Ang, C. W., Strid, M. A.,
#' De Valk, H., Sadkowska-Todys, M., Zota, L., Kuusi, M., Rota, M. C., Simonsen, J. B., Molbak, K., Van Duynhoven, Y. T., van Pelt, W.
#' "Campylobacter seroconversion rates in selected countries in the European Union"
#' Epidemiology and Infection 141, no. 10 (2013): 2051--57.
#' doi:10.1017/S0950268812002774.
#'
#' * de Melker, H. E., Versteegh, F. G., Schellekens, J. F.,
#' Teunis, P. F., Kretzschmar, M.
#' "The incidence of Bordetella pertussis infections estimated in the
#' population from a combination of serological surveys"
#' The Journal of Infection 53, no. 2 (August 1, 2006): 106--13. doi:10.1016/j.jinf.2005.10.020
#'
#'
#' ***Quantification of seroresponse***
#'
#' * de Graaf, W. F., Kretzschmar, M. E., Teunis, P. F., Diekmann, O.
#' "A two-phase within-host model for immune response and its
#' application to serological profiles of pertussis"
#' Epidemics 9 (2014):1--7. doi:10.1016/j.epidem.2014.08.002.
#'
#' * Berbers, G. A., van de Wetering, M. S., van Gageldonk, P. G.,
#' Schellekens, J. F., Versteegh, F. G., Teunis, P.F.
#' "A novel method for evaluating natural and vaccine induced
#' serological responses to Bordetella pertussis antigens"
#' Vaccine 31, no. 36 (August 12, 2013): 3732--38.
#' doi:10.1016/j.vaccine.2013.05.073.
#'
#' * Versteegh, F. G., Mertens, P. L., de Melker, H. E., Roord, J. J.,
#' Schellekens, J. F., Teunis, P. F.
#' "Age-specific long-term course of IgG antibodies to pertussis toxin
#' after symptomatic infection with Bordetella pertussis"
#' Epidemiology and Infection 133, no. 4 (August 1, 2005): 737--48.
#'
#' * Teunis, P. F., van der Heijden, O. G., de Melker, H. E., Schellekens, J. F., Versteegh, F. G., Kretzschmar, M. E.
#' "Kinetics of the IgG antibody response to pertussis toxin after infection with B. pertussis"
#' Epidemiology and Infection 129, no. 3 (December 10, 2002):479. doi:10.1017/S0950268802007896.
#'
#'
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
#' @importFrom doParallel registerDoParallel
Expand All @@ -138,6 +15,7 @@
#' @importFrom dplyr group_by
#' @importFrom dplyr if_all
#' @importFrom dplyr if_any
#' @importFrom dplyr if_else
#' @importFrom dplyr inner_join
#' @importFrom dplyr is.grouped_df
#' @importFrom dplyr mutate
Expand Down
68 changes: 0 additions & 68 deletions R/sim.cs.multi.R

This file was deleted.

Loading
Loading