This notebook is built to explore Canadian SARS-CoV-2 genomic and epidemiological data with the aim of investigating viral evolution and spread. It is for discussion with pillar 6’s team and for sharing with collaborators, e.g. public health labs. These analyses can spur further research within or across pillars, be used for reports (or data dashboards), support discussions with the science communication pillar for public dissemination, and enable code reuse by public health authorities/laboratories for their internal use.
Canadian genomic and epidemiological data will be regularly pulled from various public sources (see list below) to keep these analyses up-to-date. Only representations of aggregate data will be posted here.
Important caveats and disclaimers:
These analyses represent only a snapshot of SARS-CoV-2 evolution in Canada. Only some infections are detected by PCR testing, only some of those are sent for whole-genome sequencing, and not all sequences are posted to public facing reposittories. Sequencing volumes and priorities have changed during the pandemic, and the sequencing strategy is typically a combination of prioritizing outbreaks, travellers, public health investigations, and random sampling for genomic surveillance.
For example, specific variants or populations might be preferentially sequenced at certain times in certain jurisdictions. When possible, these differences in sampling strategies are mentioned but they are not always known. With the arrival of the Omicron wave, many jurisdictions across Canada reached testing and sequencing capacity mid-late December 2021 and thus switched to targeted testing of priority groups (e.g., hospitalized patients, health care workers, and people in high-risk settings). Therefore, from this time onward, case counts are likely underestimated and the sequenced virus diversity is not necessarily representative of the virus circulating in the overall population.
Thus, interpretation of these plots and comparisons between health regions should be made with caution, considering that the data may not be fully representative. These analyses are subject to frequent change given new data and updated lineage designations.
## 1. LOAD processed metadata of Canadian sequences (with latest pangolin, division, and full seq IDs)
#Download metadata from VirusSeq, put the date here:
# this can be made more compact for faster loading
meta <- read.csv(gzfile("data_needed/virusseq.metadata.csv.gz"), sep="\t")
meta$province <- meta$geo_loc_name_state_province_territory
# Select only the column we want to use later
columnlist=c("fasta_header_name", "province", "host_gender", "host_age_bin",
"sample_collection_date", "sample_collected_by",
"purpose_of_sampling", "purpose_of_sequencing","lineage",
"raw_lineage")
meta <- meta[ , columnlist]
### metadata cleaning
unknown.str <- c("Undeclared", "Not Provided", "Restricted Access", "Missing",
"Not Applicable")
meta <- as.data.frame(apply(meta, 2, function(x) {
x[is.element(x, unknown.str)] <- "Unknown"
x
}))
meta$sample_collection_date <- as.Date(meta$sample_collection_date)
meta$week <- cut(meta$sample_collection_date, 'week')
source("scripts/scanlineages.R")
meta$pango_group <- create.pango.group(VOCVOI, meta)
meta$pango_group <- as.factor(meta$pango_group)
meta[meta == ""] <- "Unknown"
## 2. LOAD epidemiological data (PHAC)
#from: https://health-infobase.canada.ca/covid-19/epidemiological-summary-covid-19-cases.html?stat=num&measure=total&map=pt#a2
epidataCANall <- read.csv(url("https://health-infobase.canada.ca/src/data/covidLive/covid19-download.csv"))
epidataCANall$date <- as.Date(epidataCANall$date)
epidataCANall$prname <- gsub('_', ' ', epidataCANall$prname)
epidate <- tail(epidataCANall,1)$date #download date
epidataCANall$previousvalue <- 0
#small loop to get the numtoday column from previous versions of this file from the cumulative cases
for(row in 1:nrow(epidataCANall)) {
p <- epidataCANall[row, "prname"]
subdf <- epidataCANall[which(
(epidataCANall$date > epidataCANall[row, "date"] & epidataCANall$prname==p)
), ]
if(nrow(subdf) != 0) {
nextrow <- which( (epidataCANall$date == min(subdf$date) & epidataCANall$prname==p))
epidataCANall[nextrow, "previousvalue"] <- epidataCANall[row, "totalcases"]
}
}
epidataCANall$numtoday <- epidataCANall$totalcases - epidataCANall$previousvalue
BQ.1, BQ.1.1 and associated sublineages continue to show the strongest growth, with other newer sublineages as noted below also of potential interest. BA.2.75 and XBB variants, which were previously more associated with the eastern hemisphere of the globe, are starting to increase more notably in some regions in the western hemisphere, including some regions of Canada.
Variants of current interest,, due to their potential growth advantage, or mutations of potential functional significance (note: sublineages of many of these are also of interest). See also the evolving plot below of “Fastest growing lineages in Canada”:
Here we take a look, sub-dividing the major sub-lineages currently circulating in Canada.
The grey zone represent rare lineages (not in top 15) : BA.1.1.3(1), BA.1.13.1(1), BA.1.15.3(1), BA.1.17.1(1), BD.1(1), BA.1.12(2), BA.1.4(2), BA.1.8(2), BA.1.1.11(4), BA.1.1.4(4), BA.1.1.9(4), BA.1.10(4), BA.1.14.1(4), BA.1.14.2(4), BA.1.7(4), BA.1.1.17(5), BA.1.1.8(9), BA.1.16(10), BA.1.5(13), BA.1.1.13(15), BA.1.1.7(16), BC.2(18), BA.1.15.2(27), BA.1.1.15(46), BA.1.21(55), BA.1.19(100), BA.1.9(127), BA.1.1.1(164), BA.1.13(164), BA.1.15.1(178), BA.1.1.2(281)
The grey zone represent rare lineages (not in top 15) : BA.2.10.3(1), BA.2.16(1), BA.2.25(1), BA.2.3.8(1), BA.2.38.3(1), BA.2.58(1), BA.2.59(1), BA.2.63(1), BA.2.73(1), BA.2.75.3(1), BM.1(1), BM.4.1(1), BA.2.14(2), BA.2.15(2), BA.2.2.1(2), BA.2.3.9(2), BA.2.30(2), BA.2.4(2), BA.2.42(2), BA.2.71(2), BA.2.9.6(2), BH.1(2), BA.2.11(3), BA.2.12.2(3), BA.2.27(3), BA.2.3.14(3), BA.2.38.2(3), BA.2.45(3), BA.2.53(3), BA.2.54(3), BA.2.55(3), BA.2.62(3), BA.2.68(3), BA.2.70(3), BA.2.9.4(3), BA.2.3.12(4), BA.2.50(4), BA.2.3.15(5), BA.2.34(5), BA.2.75.1(5), BA.2.79(5), BA.2.41(6), BA.2.44(6), BA.2.47(6), BA.2.23.1(7), BA.2.3.13(7), BA.2.35(7), BA.2.64(7), BA.2.81(7), BG.6(7), BA.2.43(8), BA.2.60(8), BA.2.3.5(9), BA.2.3.7(9), BA.2.61(9), BA.2.24(10), BA.2.31.1(10), BA.2.38.1(10), BA.2.9.2(10), BA.2.22(11), BA.2.52(11), BA.2.72(11), BA.2.9.1(11), BA.2.26(12), BA.2.6(12), BA.2.29(13), BA.2.49(13), BA.2.5(14), BA.2.8(14), BG.4(14), BA.2.51(15), BA.2.78(15), BA.2.3.1(16), BA.2.40.1(17), BA.2.13.1(18), BA.2.17(19), BA.2.32(21), BA.2.7(21), BA.2.9.5(21), BA.2.2(24), BA.2.9.3(26), BA.2.48(27), BA.2.74(29), BG.5(29), BA.2.31(36), BA.2.56(39), BA.2.13(48), BA.2.3.17(56), BA.2.75(58), BA.2.36(66), BA.2.3.2(75), BA.2.23(86), BA.2.76(87), BA.2.1(88), BA.2.37(99), BA.2.10.1(104), BG.2(110), BA.2.3.11(123), BA.2.18(128)
The grey zone represent rare lineages (not in top 15) : BA.2.1(1), BA.2.13.1(1), BA.2.21(1), BA.2.38.2(1), BA.2.40.1(1), BA.2.47(1), BA.2.56(1), BA.2.75.9(1), BA.2.82(1), BA.2.9(1), BG.5(1), BJ.1(1), BL.1.3(1), BM.2(1), BN.2(1), CB.1(1), BA.2.38(2), BA.2.75.6(2), CA.1(2), BA.2.18(3), BA.2.3(3), BA.2.65(3), BL.4(3), BH.1(4), BM.4.1.1(4), BA.2.74(5), BM.1(5), BM.1.1.1(5), BG.2(6), BL.3(6), BN.2.1(6), BP.1(6), BR.3(7), BL.2(10)
The grey zone represent rare lineages (not in top 15) : BA.4.8(1), BA.4.1.10(2), BA.4.1.4(2), BA.4.3(2), BA.4.5(2)
The grey zone represent rare lineages (not in top 15) : BA.5.1.26(1), BA.5.1.16(2), BA.5.1.9(3), BA.5.1.28(4), BA.5.1.19(8), BA.5.1.8(8), BA.5.1.21(9), BT.1(9), BA.5.1.27(11), BA.5.1.4(14), BA.5.1.17(21), BA.5.1.20(33), BA.5.1.15(40)
The grey zone represent rare lineages (not in top 15) : BF.23(1), BF.24(1), BF.3.1(1), BV.2(1), CD.1(1), BF.18(2), BF.19(2), BF.22(2), BU.1(3), CG.1(3), BA.5.2.7(6), BA.5.2.12(7), BA.5.2.32(10), BF.1.1(10), CE.1(11), BF.25(14), BA.5.2.4(16), BF.15(17), BF.3(19), BF.6(23), BF.20(24), BA.5.2.19(25), BA.5.2.31(26), BA.5.2.23(28), BA.5.2.18(34), BF.14(35), BF.12(36), BF.2(37), BF.16(39), BA.5.2.14(43), BA.5.2.16(45), BA.5.2.24(54), BA.5.2.26(61), BA.5.2.28(76), BF.13(96), BA.5.2.25(100), BA.5.2.27(121), BA.5.2.13(130), BF.4(182), BF.11(190), BF.8(191), BA.5.2.2(195), BA.5.2.6(197), BA.5.2.8(213), BF.21(216), BA.5.2.3(226)
The grey zone represent rare lineages (not in top 15) : BA.5.3.4(2), BQ.1.4(2), BE.2(7), BA.5.3.3(11), BA.5.5.3(11), BW.1(15), BA.5.6.1(16), BA.5.6.2(22), BA.5.3(23), BE.4.1(23), BA.5.5.1(25), CC.1(29), BA.5.10.1(35), BQ.1.3(35), BA.5.3.2(36), BE.1.2(41), BA.5.9(51), BA.5.5.2(60), BE.1.1.2(62)
The grey zone represent rare lineages (not in top 15) : XAF(2), XAP(2), XE(2), XZ(2)
Here we show the selection estimates and their 95% confidence intervals for pangolin lineages with more than 10 sequences in Canada since 2022-08-01 and with enough data to estimate the confidence interval. Each selection estimate measures the growth rate relative to BA.5.2 stricto. Plots showing the change in variant frequency over time in Canada are given below for lineages with more than 50 sequences.
Background shading illustrates sub-variants that we need to keep an eye on in blue (s ~ 0-5%, corresponding to doubling times of more than two weeks), those whose rapid growth is likely to displace currently common strains in pink (s ~ 5-10% with one to two week doubling times), and those with a growth advantage characteristic of a variant of concern in orange (s > 10%+ with less than one week doubling times).
Estimating selection of sub-variants with low sequence counts (10-100 dots) is prone to error, such as mistaking one-time super spreader events or pulses of sequence data from one regions as selection. These estimates should be considered as very preliminary.
source("scripts/plot_growing_lineages.R")
#paramselected=allparamstricto[sapply(allparamstricto,function(x){x$region=="Canada" & (x$fit)$fit[["s1"]]>0 & sum(x$toplot$n2)>10})]
paramselected=allparams[sapply(allparams,function(p){if(!any(is.na(p$fit))){
x=p$mut[[1]];
p$region=="Canada"&
(p$fit)$fit[["s1"]]>0 &
sum(p$toplot$n2)>10&
substr(x, nchar(x), nchar(x))!="*"
}else{FALSE}})]
a=plot_growing_lineage(paramselected[1:min(25,length(paramselected))])
This plot highlights the groups of related lineages that are growing fastest (e.g., BE.1.1.1* is the monophyletic clade that includes BE.1.1.1 and BQ.1*).
Again, background shading illustrates sub-variants that we need to keep an eye on in blue (s ~ 0-5%, corresponding to doubling times of more than two weeks), those whose rapid growth is likely to displace currently common strains in pink (s ~ 5-10% with one to two week doubling times), and those with a growth advantage characteristic of a variant of concern in orange (s > 10%+ with less than one week doubling times).
Estimating selection of sub-variants with low sequence counts (10-100 dots) is prone to error, such as mistaking one-time super spreader events or pulses of sequence data from one regions as selection. These estimates should be considered as very preliminary.
paramselected=allparams[sapply(allparams,function(p){if(!any(is.na(p$fit))){
x=p$mut[[1]];
p$region=="Canada"&
(p$fit)$fit[["s1"]]>0 &
sum(p$toplot$n2)>10&
substr(x, nchar(x), nchar(x))=="*"
}else{FALSE}})]
a=plot_growing_lineage(paramselected[1:min(25,length(paramselected))])
paramselected=allparams[sapply(allparams,function(p){if(!any(is.na(p$fit))){
x=p$mut[[1]];
p$region=="Canada"&
(p$fit)$fit[["s1"]]>0 &
sum(p$toplot$n2)>10
}else{FALSE}})]
DT::datatable(plot_growing_lineage(paramselected,makeplot=FALSE))
Tabulation of the most predominant mutational changes in Omicron, with adjacent rows comparing the composition of Canadian sublineages to that sublineage globally.
Mutational profile of Omicron and its sublineages in Canada and globally for the most prevalent (>75%) point mutations in each category (based on all genomes available on VirusSeq on 2022-12-08).
Here we examine the relative rate of spread of the different sublineages of Omicron currently in Canada. Specifically, we determine if a new or emerging lineage has a selective advantage, s (and by how much), against a reference lineage previously common in Canada (see the methods for more details about selection and how it is estimated).
Currently, the major group of Omicron lineages rising in frequency are the BQ.* group, which descend from BA.5*. We first show this growth of BQ.* and other BA.5* (here excluding BQ.*), relative to the remaining strains, which consist predominantly of BA.2* and BA.4*. Left plot: y-axis is the proportion of sub-lineages BA.4 and BA.5 among Omicron; right plot: y-axis describes the logit function, log(freq(BQ.* or BA.5*)/freq(other)), which gives a straight line whose slope is the selection coefficient if selection is constant over time (see methods).
For comparison, Alpha had a selective advantage of s ~ 6%-11% per day over preexisting SARS-CoV-2 lineages, and Delta had a selective advantage of about 10% per day over Alpha.
Caveat: These selection analyses must be interpreted with caution due to the potential for non-representative sampling, lags in reporting, and spatial heterogeneity in prevalence of different sublineages across Canada. Provinces that do not have at least 20 sequences of BQ.*, BA.5*, and other lineages during this time frame are not displayed.
Caveat: Separate analyses are provided for those provinces with at least 20 BA.2 sequences in the database. These selection analyses must be interpreted with caution due to the potential for non-representative sampling, lags in reporting, and spatial heterogeneity in prevalence of different sublineages across Canada.
startpar3 <- list(p=c(0.8, 0.1), s=c(0.1, 0.1))
setAll=getAllStrictoLineages(meta)
sublineages_BA5 <- getStrictoSubLineages("BA.5*",meta)
sublineages_BQ <- getStrictoSubLineages("BQ*",meta)
setAll=setAll[!setAll %in% sublineages_BA5]
sublineages_BA5=sublineages_BA5[!sublineages_BA5 %in% sublineages_BQ]
#color for each lineage
col <- c(pal["Omicron BA.5"], pal["Omicron BQ"])
source("scripts/plot_selection_estimator.R")
#Set a starting date
#Note that the startdate shouldn't be too much before both alleles become common
#or rare migration events that die off could throw off the estimation procedure
#(so that the parameter estimates account for the presence of those alleles long in the past).
startdate<-as.Date(VirusSeq_release)-days(75) #Using a later date with less sampling noise
sub.plot.selection.estimate <- function(region,maxdate=NA){
maxdate=plot.selection.estimate(region=region,
startdate=startdate, startpar=startpar3,
reference=c(setAll),
mutants=list(sublineages_BA5,sublineages_BQ),
names=list("BA.5*","BQ*","the rest"),
maxdate=maxdate, col=col)
return(maxdate)
}
#####################################################
# tabs for displaying in notebook
#each PT tab should have curve plot and breakpoint plot side by side
## [1] "Not enough data available"
## [1] "Not enough data available"
## [1] "Not enough data available"
## [1] "Not enough data available"
Here we show the trends of the various BA.2.* sublineages over time, relative to the frequency of BA.5.2 by itself (shown for sublineages with at least 50 (Canada) or 20 (provinces) cases). Proportions shown here are only among BA.5.2 (stricto) and the lineage illustrated. Note that these plots are not necessarily representative of trends in each province and that mixing of data from different provinces may lead to shifts in frequency that are not due to selection.
source("scripts/scanlineages.R")
plotsubvariant <- function(region,min,parentalnode){
#subnodes=getAllSubLineages(parentalnode,fullpangotree)
subnodes=getStrictoSubLineages(parentalnode,meta)
nplot=0
for(p in allparams) {
if(!any(is.na(p$fit)) && p$region==region ){
if((p$mut[[1]] %in% subnodes) && (p$fit)$fit[["s1"]]>0 && sum(p$toplot$n2)>min){
plot.selection(plotparam=p)
nplot=nplot+1
}
}
}
if(nplot==0){
print("Not enough data available")
}
}
plotba2 <- function(region,min){
plotsubvariant(region,min,"BA.2*")
}
plotba4 <- function(region,min){
plotsubvariant(region,min,"BA.4*")
}
plotba5 <- function(region,min){
plotsubvariant(region,min,"BA.5*")
}
[1] “Not enough data available”
[1] “Not enough data available”
[1] “Not enough data available”
[1] “Not enough data available”
Here we show the trends of the various BA.4# sublineages over time, relative to the frequency of BA.5.2 by itself (shown for sublineages with at least 50 (Canada) or 20 (provinces) cases). Proportions shown here are only among BA.5.2 (stricto) and the lineage illustrated. Note that these plots are not necessarily representative of trends in each province and that mixing of data from different provinces may lead to shifts in frequency that are not due to selection.
[1] “Not enough data available”
[1] “Not enough data available”
[1] “Not enough data available”
[1] “Not enough data available”
Here we show the trends of the various BA.5# sublineages over time, relative to the frequency of BA.5.2 by itself (shown for sublineages with at least 50 (Canada) or 20 (provinces) cases). Proportions shown here are only among BA.5.2 (stricto) and the lineage illustrated. Note that these plots are not necessarily representative of trends in each province and that mixing of data from different provinces may lead to shifts in frequency that are not due to selection.
[1] “Not enough data available”
[1] “Not enough data available”
These plots show the changing composition of sequences for all Canadian data posted to the VirusSeq Portal according to PANGO lineage/variant designation (Pango version 4.1.3 (Viral AI)), up to 2022-12-03. Because sampling and sequencing procedures vary by region and time, this does not necessarily reflect the true composition of SARS-CoV-2 viruses in Canada over time.
# focus on emergence of VoCs in Canada
meta1 <- meta[as.Date(meta$week) > Variants_Canada_over_time_Start_Date, ]
meta1$week <- as.factor(as.character(meta1$week))
dat <- lapply(unique(meta1$province), function(x) {
as.data.frame.matrix(table(meta1$week[meta1$province==x],
meta1$pango_group[meta1$province==x]))
})
names(dat) <- unique(meta1$province)
dat[['Canada']] <- as.data.frame.matrix(table(meta1$week, meta1$pango_group))
# pass colour legend to JavaScript layer
dat[['legend']] <- as.list(VOCVOI$color)
names(dat[['legend']]) <- VOCVOI$name
dat[['legend']]$other <- 'grey'
r2d3(data=toJSON(dat), script="js/barplot.js", container="div",
elementId="barplot-element")
rm(dat)
rm(meta1)
From the beginning of the pandemic to the fall of 2021, Canadian sequences were mostly of the wildtype lineages (pre-VOCs). By the beginning of summer 2021, the VOCs Alpha and Gamma were the most sequenced lineages overall in Canada. The Delta wave grew during the summer of 2021 with sublineages AY.25 and AY.27 constituting sizeable proportions of this wave. Omicron arrived in November of 2021 and spread in three main waves, first BA.1* (early 2022), then BA.2* (spring 2022), then BA.5* (summer 2022). Current, multiple sublineages of Omicron persist, with emerging sublineages spreading, such as BQ.1.1 (a BA.5 sub-lineage). See below for jurisdictional differences of these plots.
There are two PANGO lineages that have a Canadian origin and that predominately spread within Canada (with some exportations internationally): B.1.438.1 and B.1.1.176. Other lineages of historical interest in Canada:
Here we present a subsampled phylogenetic snapshot of SARS-CoV-2 genomes from Canada.
### metadata and trees
source("scripts/tree.r")
# load trees from files
mltree <- read.tree("./data_needed/sample1.rtt.nwk")
ttree <- read.tree("./data_needed/sample1.timetree.nwk")
stopifnot(all(sort(mltree$tip.label) == sort(ttree$tip.label)))
dateseq <- seq(ymd('2019-12-01'), ymd('2022-11-01'), by='3 month')
# tips are labeled with [fasta name]_[lineage]_[coldate]
# extracting just the first part makes it easier to link to metadata
mltree$tip.label <- reduce.tipnames(mltree$tip.label)
ttree$tip.label <- reduce.tipnames(ttree$tip.label)
fieldnames<- c("fasta_header_name", "province", "host_gender", "host_age_bin",
"sample_collected_by", "purpose_of_sampling",
"lineage", "pango_group","week")
# extract rows from metadata table that correspond to this tree
metasub1 <- meta[meta$fasta_header_name%in% ttree$tip.label, fieldnames]
# sort rows to match tip labels in tree
metasub1 <- metasub1[match(ttree$tip.label, metasub1$fasta_header_name), ]
metasub_omi <- metasub1[grepl("Omicron",metasub1$pango_group ), ]
#scale to number of mutations
mltree$edge.length <- mltree$edge.length*29903
###Time Tree
ttree2 <- ttree
ttree2$edge.length[ttree2$edge.length == 0] <- 1e-4
hab=unique(meta$host_age_bin)
hab=hab[order(hab)]
presetColors=data.frame(name=c("other",VOCVOI$name,hab), color=c("#777777",VOCVOI$color,rev(hcl.colors(length(hab)-1, "Red-Blue")),"#777777"))
#suppressWarnings({
# res <- ace(metasub1$pango.group, ttree2, type="discrete", model="ER")
#})
#idx <- apply(res$lik.anc, 1, which.max)[2:nrow(res$lik.anc)] # exclude root edge
#anc <- levels(as.factor(metasub1$pango.group))[idx]
timeTreeJsonObj <- DrawTree(ttree2, metasub1, "timetree", presetColors, fieldnames)
#diversity ML tree
diversityTreeJsonObj <- DrawTree(mltree, metasub1, "mltree", presetColors, fieldnames)
### omicron diversity tree
MLtree_omi<-keep.tip(mltree, metasub_omi$fasta_header_name)
OmicrondiversityTreeJsonObj <- DrawTree(MLtree_omi, metasub_omi, "omimltree", presetColors, fieldnames)
The slope of root-to-tip plots over time provide an estimate of the substitution rate. A lineage with a steeper positive slope than average for SARS-CoV-2 is accumulating mutations at a faster pace, while a lineage that exhibits a jump up (a shift in intercept but not slope) has accumulated more than expected numbers of mutations in a transient period of time (similar to what we saw with Alpha when it first appeared in the UK).
get.tipnames <- function(tip.label) {
sapply(tip.label, function(x) {
tokens <- strsplit(x, "_")[[1]]
ntok <- length(tokens)
paste(tokens[1:(ntok-2)], collapse='_')
})
}
source("scripts/fit-rtt.R")
fit1 <- fit.rtt("./data_needed/sample1.rtt.nwk", plot=TRUE)
fit2 <- fit.rtt("data_needed/sample2.rtt.nwk", plot=FALSE)
fit3 <- fit.rtt("data_needed/sample3.rtt.nwk", plot=FALSE)
Here we show the estimate of the substitution rate for 3 independent subsamples of different variants of interest, with their 95% confidence interval.
if(!is.null(fit1)){
est1 <- get.ci(fit1); est1$rep <- 'Rep1'
est2 <- get.ci(fit2); est2$rep <- 'Rep2'
est3 <- get.ci(fit3); est3$rep <- 'Rep3'
sec.frame <- rbind(est1, est2, est3)
sec.frame$est[sec.frame$est < 0] <- 0
sec.frame$lower.95[sec.frame$lower.95 < 0] <- 0
sec.frame=sec.frame[sec.frame$Lineage != "Recombinants",]
pal <- VOCVOI$color
names(pal) <- VOCVOI$name
pal["other"] <- "white"
ggplot(sec.frame, aes(x=Lineage, y=est, group=rep)) +
geom_bar(stat="identity", color="black", aes(fill=Lineage), position='dodge') +
scale_fill_manual(values=pal) +
theme(axis.text.x = element_text(size=9, angle=45, hjust=1, vjust=0.95),
legend.position='none', panel.grid.major=element_line(colour="grey90")) +
geom_errorbar(aes(ymin=lower.95, ymax=upper.95), width=.7,
position=position_dodge(1)) +
labs(y="Substitutions / Genome / Day",
x="Lineage", fill="Subsample")
}
We are in the process of adding or would like to develop code for some of the following analyses:
With anonymized data on vaccination status, severity/outcome, reason for sequencing (e.g., outbreak, hospitalization, or general sampling), and setting (workplace, school, daycare, LTC, health institution, other), we could analyze genomic characteristics of the virus relative to the epidemiological and immunological conditions in which it is spreading and evolving. Studies on mutational correlations to superspreading events, vaccination status, or comparisons between variants would allow us to better understand transmission and evolution in these environments.
Genome data and metadata are sourced from the Canadian VirusSeq Data Portal. Pangolin lineage assignments are generated using the pangoLEARN algorithm. Source code for generating this RMarkdown notebook can be found in [https://github.com/CoVaRR-NET/duotang].
Canadian genomes were obtained from the VirusSeq data on the 2022-12-08 and down-sampled to two genomes per lineage, province and month before October 2021, and five genomes per lineage, province and month after October 2021 (about 10,000 genomes in total). We used a Python wrapper of minimap2 (version 2.17) to generate multiple sequence alignments for these genome samples. A maximum likelihood (ML) tree was reconstructed from each alignment using the COVID-19 release of IQ-TREE (version 2.2.0). Outliers were identified in by root-to-tip regression using the R package ape and removed from the dataset. TreeTime was used to reconstruct a time-scaled tree under a strict molecular clock model. The resulting trees were plotted with ggtree.
We extracted mutation frequencies from unaligned genomes using a custom Python wrapper of minimap2 (version 2.17). These data were supplemented with genomic data and metadata from the NCBI GenNank database, curated by the Nextstrain development team. We used these outputs to generate mutational graphs reporting mutations seen in at least 75% of sequences in the respective variants of concern in Canada. Bars are colored by substitution type, and the corresponding amino acid changes are shown. Genomic position annotations were generated in Python using SnpEFF.
To estimate selection, we used standard likelihood techniques. In brief, sublineages of interest were prespecified (e.g., BA.1, BA.1.1, BA.2) and counts by day tracked over time. If selection were constant over time, the frequency of sub-type \(i\) at time \(t\) would be expected to rise according to \[p_i(t) = \frac{p_i(0) \exp(s_i t)}{\sum_j p_j(0) \exp(s_j t)},\] where \(s_i\) is the selection coefficient favouring sub-type \(i\). A selection coefficient of \(s_i=0.1\) implies that sub-type \(i\) is expected to rise from 10% to 90% frequency in 44 days (in \(4.4./s_i\) days for other values of \(s_i\)).
At any given time \(t\), the probability of observing \(n_i\) sequences of sublineage \(i\) is multinomially distributed, given the total number of sequences from that day and the frequency of each \(p_i(t)\). Consequently, the likelihood of seeing the observed sequence data over all times \(t\) and over all sublineages \(j\) is proportional to \[L = \prod_t \prod_j p_i(t)^{n_i(t)}.\]
The BBMLE package in R was used to maximize the likelihood of the observed data (using the default optimization method, optim). For each selection coefficient, 95% confidence intervals were obtained by profile likelihood (using uniroot).
Graphs illustrating the rise in frequency of a variant over time are shown (left panels), with the area of each dot proportional to the number of sequences. 95% confidence bands were obtained by randomly drawing 10,000 sets of parameters (\(p_i\) and \(s_i\) for each sub-type) using RandomFromHessianOrMCMC
, assuming a multi-normal distribution around the maximum likelihood point (estimated from the Hessian matrix, Pawitan 2001). At each point in time, the 2.5%-97.5% range of values for \(p_i(t)\) are then shown in the confidence bands.
Logit plots (right panels) show \[ln(\frac{p_i(t)}{p_{ref}(t)})\] relative to a given reference genotype (here BA.1), which gives a line whose slope is the strength of selection \(s_i\). Changes in slope indicate changes in selection on a variant (e.g., see Otto et al.).
These estimates of selection ignore heterogeneity within provinces and may be biased by the arrival of travel-related cases while frequencies are very low. Sampling strategies that oversample clustered cases (e.g., sequencing outbreaks) will introduce additional variation beyond the multinomial expectation, but these should lead to one-time shifts in frequency rather than trends over time. Provinces with sampling strategies that are variant specific are removed, unless explicit information about the variant frequencies is available.
Maximum likelihood tree (IQ-TREE) processed with root-to-tip regression and plotting in R.
All analyses draw on the most recent publicly available viral sequence data on ViralSeq and should be interpreted with caution due to lags in reporting and sequencing priorities that can differ across provinces or territories. Note that the NCCID provides a timeline of Canadian events related to each variant: https://nccid.ca/covid-19-variants/.
Provincial sequencing strategy includes a subset of representative positive samples and prioritized cases (outbreaks, long-term care, travel-related, vaccine escape, hospitalized). Additional up-to-date covid data for this province can be found here:
http://www.bccdc.ca/health-info/diseases-conditions/covid-19/data-trends
Additional up-to-date COVID data for this province can be found here:
https://www.alberta.ca/stats/covid-19-alberta-statistics.htm#variants-of-concern
Additional up-to-date COVID data for this province can be found here:
https://www.saskatchewan.ca/government/health-care-administration-and-provider-resources/treatment-procedures-and-guidelines/emerging-public-health-issues/2019-novel-coronavirus/cases-and-risk-of-covid-19-in-saskatchewan
Additional up-to-date COVID data for this province can be found here:
https://geoportal.gov.mb.ca/apps/manitoba-covid-19/explore
Additional up-to-date COVID data for this province can be found here:
https://www.publichealthontario.ca/en/diseases-and-conditions/infectious-diseases/respiratory-diseases/novel-coronavirus/variants
Provincial random sequencing has been temporarily suspended as of Feb 8th, 2021. Quebec provides a list of updates on changes to screening and sequencing strategies, found here (in French): https://www.inspq.qc.ca/covid-19/donnees/variants#methodologie. Additiona up-to-date COVID data for this province can be found here:
https://www.inspq.qc.ca/covid-19/donnees/variants
Additional up-to-date COVID data for this province can be found here:
https://experience.arcgis.com/experience/204d6ed723244dfbb763ca3f913c5cad
Additional up-to-date COVID data for this province can be found here:
https://experience.arcgis.com/experience/8eeb9a2052d641c996dba5de8f25a8aa (NB dashboard)
Additional up-to-date COVID data for this province can be found here:
https://covid-19-newfoundland-and-labrador-gnl.hub.arcgis.com/
Collect a list of bioinformatics, phylogenetic, and modelling tools that are useful for SARS-CoV-2 analyses:
variants # Acknowledgements and sources
We thank all the authors, developers, and contributors to the VirusSeq database for making their SARS-CoV-2 sequences publicly available. We especially thank the Canadian Public Health Laboratory Network, academic sequencing partners, diagnostic hospital labs, and other sequencing partners for the provision of the Canadian sequence data used in this work. Genome sequencing in Canada was supported by a Genome Canada grant to the Canadian COVID-19 Genomic Network (CanCOGeN).
We gratefully acknowledge all the Authors, the Originating laboratories responsible for obtaining the specimens, and the Submitting laboratories for generating the genetic sequence and metadata and sharing via the VirusSeq database, on which this research is based.
The Canadian VirusSeq Data Portal (https://virusseq-dataportal.ca) We wish to acknowledge the following organisations/laboratories for contributing data to the Portal: Canadian Public Health Laboratory Network (CPHLN), CanCOGGeN VirusSeq, Saskatchewan - Roy Romanow Provincial Laboratory (RRPL), Nova Scotia Health Authority, Alberta ProvLab North (APLN), Queen’s University / Kingston Health Sciences Centre, National Microbiology Laboratory (NML), Institut National de Sante Publique du Quebec (INSPQ), BCCDC Public Health Laboratory, Public Health Ontario (PHO), Newfoundland and Labrador - Eastern Health, Unity Health Toronto, Ontario Institute for Cancer Research (OICR), Provincial Public Health Laboratory Network of Nova Scotia, Centre Hospitalier Universitaire Georges L. Dumont - New Brunswick, and Manitoba Cadham Provincial Laboratory. Please see the complete list of laboratories included in this repository.
Public Health Agency of Canada (PHAC) / National Microbiology Laboratory (NML) - (https://health-infobase.canada.ca/covid-19/epidemiological-summary-covid-19-cases.html)
Various provincial public health websites (e.g. INSPQ https://www.inspq.qc.ca/covid-19/donnees/)
The version numbers of all packages in the current environment as well as information about the R install is reported below.
sessionInfo()
## R version 4.2.0 (2022-04-22)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.6 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
##
## locale:
## [1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8
## [5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
## [7] LC_PAPER=en_CA.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats4 parallel stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] dplyr_1.0.9 HelpersMG_5.4 rlang_1.0.2 MASS_7.3-57
## [5] coda_0.19-4 lme4_1.1-29 Matrix_1.4-1 bbmle_1.0.25
## [9] jsonlite_1.8.0 r2d3_0.2.6 ggfree_0.1.0 ape_5.6-2
## [13] ggplot2_3.3.6 lubridate_1.8.0 knitr_1.39 tidyr_1.2.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.9 bdsmatrix_1.3-6 mvtnorm_1.1-3
## [4] lattice_0.20-45 assertthat_0.2.1 digest_0.6.29
## [7] utf8_1.2.2 R6_2.5.1 evaluate_0.15
## [10] highr_0.9 pillar_1.7.0 rstudioapi_0.13
## [13] minqa_1.2.4 jquerylib_0.1.4 nloptr_2.0.3
## [16] DT_0.25 rmarkdown_2.14 labeling_0.4.2
## [19] splines_4.2.0 stringr_1.4.0 htmlwidgets_1.5.4
## [22] munsell_0.5.0 compiler_4.2.0 numDeriv_2016.8-1.1
## [25] xfun_0.31 pkgconfig_2.0.3 htmltools_0.5.2
## [28] tidyselect_1.1.2 tibble_3.1.7 fansi_1.0.3
## [31] crayon_1.5.1 withr_2.5.0 grid_4.2.0
## [34] nlme_3.1-157 gtable_0.3.0 lifecycle_1.0.1
## [37] DBI_1.1.2 magrittr_2.0.3 scales_1.2.0
## [40] cli_3.3.0 stringi_1.7.6 farver_2.1.0
## [43] bslib_0.3.1 ellipsis_0.3.2 generics_0.1.2
## [46] vctrs_0.4.1 boot_1.3-28 tools_4.2.0
## [49] glue_1.6.2 purrr_0.3.4 crosstalk_1.2.0
## [52] fastmap_1.1.0 yaml_2.3.5 colorspace_2.0-3
## [55] sass_0.4.1