Skip to contents

cg_annotate_episodes_find_seroconversion() finds episodes based on their seroconversion. Here, we use N (SARS-CoV-2 nucleocapsid). Most covid vaccines contain Spike only, so seroconversion to N means exposure to SARS-CoV-2. For symptoms, lateral flow tests and SARS-CoV-2 PCR positivity, the experimental data matches exposure to within a few days (or hours). Seroconversion occurs anytime between blood samples. Chronogram therefore provides separate annotation functions cg_annotate_episodes_find() and cg_annotate_episodes_find_seroconversion(), and options to combine the two results.

Usage

cg_annotate_episodes_find_seroconversion(
  cg,
  serum_N_titre = NULL,
  serum_N_cutoff = 1,
  N_seroconversion_episode = "N_seroconversion_episode",
  episode_number_append = "number",
  episode_start_col_append = "start",
  episode_end_col_append = "end"
)

Arguments

cg

a chronogram

serum_N_titre

the column containing seroconversion information.

serum_N_cutoff

the numerical threshold for seropositivity. Greater than or equal to the threshold is taken as positive. Default is 1 - check with your assay documentation.

N_seroconversion_episode

the column name for resulting episode flag. Default is "N_seroconversion_episode"

episode_number_append

appended to N_seroconversion_episode to provide the column name for the episode number. Default is "number"

episode_start_col_append

appended to N_seroconversion_episode to provide the column name for the episode start date. Default is "start"

episode_end_col_append

appended to N_seroconversion_episode to provide the column name for the episode end date. Default is "_end"

Value

a chronogram, with episode numbers annotated

Examples

##Example 1: Small study##-----------------------------------------
library(dplyr) # for dplyr::filter()

data("built_smallstudy")

cg <- built_smallstudy$chronogram
cg <- cg_annotate_episodes_find_seroconversion(cg,
  serum_N_titre =
    "serum_Ab_N"
)

## ID==1 seroconverts to N ##
## Their first N seroconversion has dates associated ##
## Their later N positive tests are flagged without dates ##
cg %>% 
filter(N_seroconversion_episode_number == 1) %>% 
cg_select(contains("episode"))
#> # A tibble:     4 × 6
#> # A chronogram: try summary()
#>   calendar_date elig_study_id N_seroconversion_episode N_seroconversion_episod…¹
#> * <date>        <fct>         <chr>                                        <dbl>
#> 1 2021-01-05    1             yes                                              1
#> 2 2021-01-15    1             NA                                               1
#> 3 2021-02-03    1             NA                                               1
#> 4 2021-02-15    1             NA                                               1
#> # ℹ abbreviated name: ¹​N_seroconversion_episode_number
#> # ℹ 2 more variables: N_seroconversion_episode_start <date>,
#> #   N_seroconversion_episode_end <date>
#> #  Dates: calendar_date       IDs: elig_study_id
#> #  metadata: 
##-------------------------------------------------------------------