Code and data for: SARS-CoV-2 saltational events are recurrent and trace to persistent human infections
Abstract
SARS-CoV-2 evolution is characterized by gradual mutation accumulation but has been punctuated by rare yet impactful highly mutated variants. Whether such saltational jumps are a broad feature of SARS-CoV-2 evolution or rare anomalies remains unclear. We systematically investigate SARS-CoV-2 saltational evolution by developing a scalable framework to detect saltational events from 4.4 million high-quality viral genomes. Saltational events occurred at low but detectable rates during the pandemic and post-pandemic periods and across geographies. Their mutational signature closely matches that seen in persistent human infections but is inconsistent with the signatures of mink or deer infections. This points to persistent infection, rather than reverse zoonosis, as their primary source. While most saltational events lack evidence of onward transmission, those that do tend to carry mutations found in successful clades. Our work demonstrates that the emergence of highly mutated SARS-CoV-2 variants reflects a recurrent evolutionary process, with implications for preparedness.
Repository organization
This repository is organized around a Snakemake workflow that enables to process and analyze the viridian data, download SRA metadata, run the Bayesian model we developed, identify adaptive branches, visualize the adaptive branches in the context of the global SARS-CoV-2 phylogeny and investigate mutation patterns in adaptive branches.
This repository is organized in sub-folders as follows:
data/stores input data. Further information is available on the folder-level README file.figures/contains the figures and the scripts to generate the figures (both from the main text and the supplementary information) associated with the manuscript. Further information is available on the folder-level README file.manuscript/contains the manuscript.scripts/contains the custom scripts used in the workflow. Further information is available on the folder-level README file.workflow/contains the Snakemake files and environment files used in the main Snakefile.
Running the workflow
0. System requirements
Operating system: Tested on macOS 26.5.2.
Required software (versions used during development):
- Snakemake with conda support (tested with v8.11.1)
- conda or mamba (for environment management)
- R (tested with v4.3.1)
All other dependencies (Python, bioinformatics tools, and R packages) are managed automatically via conda environments defined in workflow/envs/.
Typical installation time: ~5 minutes for conda environment setup.
1. Downloading required input data
The workflow requires the following (large) input files for the SARS-CoV-2 viridian phylogeny. The files correspond to a large mutation-annotated tree from 4.4 million high-quality SARS-CoV-2 samples (described in Hunt et al.). Hunt et al. provide a nice detailed description of available files from their processing pipeline. This large tree is also publicly available on Taxonium at this link.
To be able to rerun the workflow, these files should be downloaded from https://doi.org/10.6084/m9.figshare.27194547 for both the .pb and .jsonl format. For the workflow to run properly, these two files should be put at the following paths: data/viridian/tree.all_viridian.202409.pb.gz and data/viridian/tree.all_viridian.202409.jsonl.gz.
This can be done using the command line with:
curl -L -o data/viridian/tree.all_viridian.202409.pb.gz "https://ndownloader.figshare.com/files/49691037"
curl -L -o data/viridian/tree.all_viridian.202409.jsonl.gz "https://ndownloader.figshare.com/files/49691040"
Downloading metadata from the SRA required some manual curation to collate both metadata directly available on the SRA but also adding metadata that we couldn’t download but that were abailable in the Viridian metadata. This results in a complicated and somewhat messy workflow that we don’t recommend rerunning. The resulting metadata files are available with the other workflow output on Figshare here.
2. Running the worfklow
The workflow can be run using:
snakemake --use-conda --conda-frontend conda --cores <number_of_cores>
Reproducing the figures
The workflow generates files in the results/ folder which are subsequently used to perform descriptive analysis and figures (code in the figures/scripts/ folder). Our version of the results folder can be downloaded here.
To reproduce all manuscript figures:
- Download the pre-computed results from Figshare and place in
results/ - Run the figure scripts in
figures/scripts/using R v4.3.1:Rscript figures/scripts/<script_name>.R
Demo
A minimal demo can be run by subsampling the full Viridian tree to a single Pango lineage. After downloading the full tree (step 1 above), extract the B.1.177 lineage with 500 random tips:
matUtils extract \
--input-mat data/viridian/tree.all_viridian.202409.pb.gz \
--clade B.1.177 \
--set-size 500 \
--write-mat demo/demo_tree.pb.gz
The demo also requires a manually curated metadata file (results/sra_metadata/sra_metadata_from_victor.csv) that cannot be regenerated automatically. Download the pre-computed results from Figshare and place this file at results/sra_metadata/sra_metadata_from_victor.csv.
Then run the pipeline on the demo tree:
snakemake --use-conda --conda-frontend conda --cores 4 \
--config viridian_tree=demo/demo_tree.pb.gz
The demo produces the same output structure as the full pipeline in results/, but limited to the B.1.177 lineage. Given the small number of sequences, very few or no saltational branches are expected to be detected.
Expected run time: The slowest step is downloading and processing metadata from NCBI, which can be skipped by using the pre-computed sra_metadata/ outputs from Figshare. With pre-computed metadata, the remaining pipeline steps are only expected to take a few hours