@@ -52,15 +52,11 @@ output-file: report.html
5252 <link href =" https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap " rel =" stylesheet " >
5353</head >
5454
55- ``` {r funcs, echo = F, message = F, include = F}
56- display.num <- function(n) {
57- sci <- if (n < 1e-3 || n > 1e4) {
58- sub("e\\+?(-?)(\\d+)", " × 10^{\\1\\2}",
59- formatC(n, format = "e", digits = 3))
60- } else {
61- formatC(n, format = "f", digits = 5)
62- }
55+ ``` {r setup, echo = F, message = F, include = F}
56+ display.num <- function(n, digits) {
57+ format(n, digits = digits, nsmall = digits)
6358}
59+ Sys.setlocale("LC_ALL", "English")
6460```
6561
6662``` {r read, echo = F, message = F, include = F}
@@ -81,7 +77,7 @@ stats <- append(
8177)
8278correlation <- stats[["r2"]]
8379sub_rate <- stats[["sub_rate"]]
84- sub_rate <- round (sub_rate, digits = 2)
80+ sub_rate <- display.num (sub_rate, 2)
8581p_value_lm <- stats[["pvalue"]]
8682
8783# NV counts
@@ -183,29 +179,28 @@ samples is squared.](`r params$tree_ml`){#fig-tree_ml}
183179### Nucleotide diversity comparison
184180
185181Nucleotide diversity (π) has been calculated for $` r div_values[["boot.reps"]] ` $ random
186- sample subsets of size $` r div_values[["sample.size"]] ` $, extracted
187- from the context dataset. The distribution of the nuclotide diversity is assumed to
188- ` r div_values[["norm.text"]] ` be normal after performing a Shapiro-Wilk test
189- (p-value of $` r div_values[["normal.pvalue"]] ` $).
190-
191- The nucleotide diversity of the target samples is $` r format(div_values[["diversity"]], scientific = TRUE) ` $ (vertical line in @fig-div ).
192- Assuming the independence of the context samples, the ` r div_values[["type.test"]] `
193- p-value of the context samples having a nucleotide diversity (smooth curve in @fig-div )
194- as low as that of the target dataset is $` r div_values[["p.value"]] ` $.
195-
196- ![ Analysis of the nucleotide diversity (π). The smooth curve describes
197- a normal distribution with the same mean and standard deviation as the distribution
198- of π from $` r div_values[["boot.reps"]] ` $ subsets of $` r div_values[["sample.size"]] ` $
199- sequences from the context. The vertical line indicates the π value of the
200- target samples.] (` r params$div ` ){#fig-div}
182+ subsets of size $` r div_values[["sample.size"]] ` $ drawn from the context dataset.
183+ A Shapiro–Wilk test indicates the distribution is ` r div_values[["norm.text"]] `
184+ normal (p-value of $` r div_values[["normal.pvalue"]] ` $).
185+
186+ The nucleotide diversity of the target samples is $` r display.num(div_values[["diversity"]], 3) ` $
187+ (vertical line in @fig-div ). Assuming the context subsets are independent, the
188+ ` r div_values[["type.test"]] ` test gives a p-value of $` r display.num(div_values[["p.value"]], 3) ` $
189+ for observing a nucleotide diversity as low as that of the target samples.
190+
191+ ![ Distribution of nucleotide diversity (π) calculated from $` r div_values[["boot.reps"]] ` $
192+ random subsets of $` r div_values[["sample.size"]] ` $ sequences from the context dataset.
193+ The shaded area shows the empirical density; the overlaid curve is the normal distribution
194+ with the same mean and standard deviation.
195+ The vertical line marks the π value of the target samples.] (` r params$div ` ){#fig-div}
201196
202197## Evolutionary trajectory of the serially-sampled SARS-CoV-2 infection
203198
204199### Number of polymorphic sites
205200
206201Sites with minor allele frequency $> ` r params$min_ivar_freq ` $ are considered polymorphic.
207202The linear association between the collection date of the samples and the number of
208- polymorphic sites has an $R^2$ of $` r nv.counts[["r2"]] ` $ and a p-value of
203+ polymorphic sites has an $R^2$ of $` r display.num( nv.counts[["r2"]], 4) ` $ and a p-value of
209204$` r nv.counts[["value"]] ` $ (@fig -fig_cor_snp).
210205
211206{#fig-tree}
267262
268263To estimate the evolutionary rate, root-to-tip distances measured on the previous
269264tree (@fig-tree ) have been correlated with time, obtaining a $R^2$ of
270- $` r correlation ` $ and a p-value of $` r p_value_lm ` $. The estimated evolutionary
265+ $` r display.num( correlation, 4) ` $ and a p-value of $` r p_value_lm ` $. The estimated evolutionary
271266rate is $` r sub_rate ` $ number of changes per year (@fig-tempest ).
272267
273268![ Scatterplot depicting the relationship between root-to-tip
0 commit comments