Skip to contents

Using NGSB data (see ?mutations_by_lineage), checks that the earliest sequence in a lineage was observed by start_date. Optionally checks if the latest sequence in the lineage was observed after start_date. Optionally checks if the lineage was ever observed in Canada.

Usage

extant_lineages(
  lineage_names,
  start_date,
  check_after = TRUE,
  check_canada = FALSE
)

Arguments

lineage_names

A character vector of lineage names. Must match the names in mutations_by_lineage.

start_date

Earliest date in the study. Must be in ISO-8601 format (as should all dates with no exceptions).

check_after

Check if there's an observed sequence after the start of your study? Set FALSE if the start date is recent.

check_canada

Checks if the lineage was ever observed in Canada. Default FALSE.

Value

A character vector.

Details

The code also ignores any + symbols and anything after them, so lineages such as B.1.617.2+K417N (Delta+) will be treated as B.1.617.2 (Delta).

Examples

# BA.1 was only observed as of January 2021
provoc:::extant_lineages(c("B.1.1.7", "B.1.617.2", "BA.1"), start_date = "2020-12-01")
#> [1] "B.1.1.7"   "B.1.617.2"

# Subset lineage defs by date:
data(Baaijens)
b1 <- Baaijens[Baaijens$sra == Baaijens$sra[1], ]
max_date <- max(b1$date)
lineage_defs <- astronomize()
lins_to_check <- provoc:::extant_lineages(rownames(lineage_defs), max_date)
lineage_defs <- provoc::filter_lineages(lineage_defs, lins_tocheck)
#> Error in provoc::filter_lineages(lineage_defs, lins_tocheck): object 'lins_tocheck' not found
dim(lineage_defs)
#> [1]  37 325