Package: slendr 0.9.1.9000

Martin Petr

slendr: A Simulation Framework for Spatiotemporal Population Genetics

A framework for simulating spatially explicit genomic data which leverages real cartographic information for programmatic and visual encoding of spatiotemporal population dynamics on real geographic landscapes. Population genetic models are then automatically executed by the 'SLiM' software by Haller et al. (2019) <doi:10.1093/molbev/msy228> behind the scenes, using a custom built-in simulation 'SLiM' script. Additionally, fully abstract spatial models not tied to a specific geographic location are supported, and users can also simulate data from standard, non-spatial, random-mating models. These can be simulated either with the 'SLiM' built-in back-end script, or using an efficient coalescent population genetics simulator 'msprime' by Baumdicker et al. (2022) <doi:10.1093/genetics/iyab229> with a custom-built 'Python' script bundled with the R package. Simulated genomic data is saved in a tree-sequence format and can be loaded, manipulated, and summarised using tree-sequence functionality via an R interface to the 'Python' module 'tskit' by Kelleher et al. (2019) <doi:10.1038/s41588-019-0483-y>. Complete model configuration, simulation and analysis pipelines can be therefore constructed without a need to leave the R environment, eliminating friction between disparate tools for population genetic simulations and data analysis.

Authors:Martin Petr [aut, cre]

slendr_0.9.1.9000.tar.gz
slendr_0.9.1.9000.zip(r-4.5)slendr_0.9.1.9000.zip(r-4.4)slendr_0.9.1.9000.zip(r-4.3)
slendr_0.9.1.9000.tgz(r-4.4-any)slendr_0.9.1.9000.tgz(r-4.3-any)
slendr_0.9.1.9000.tar.gz(r-4.5-noble)slendr_0.9.1.9000.tar.gz(r-4.4-noble)
slendr_0.9.1.9000.tgz(r-4.4-emscripten)slendr_0.9.1.9000.tgz(r-4.3-emscripten)
slendr.pdf |slendr.html
slendr/json (API)
NEWS

# Install 'slendr' in R:
install.packages('slendr', repos = c('https://bodkan.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/bodkan/slendr/issues

On CRAN:

popgenpopulation-geneticssimulationsspatial-statistics

67 exports 54 stars 3.71 score 82 dependencies 88 scripts 308 downloads

Last updated 8 days agofrom:4ac600cfa7. Checks:OK: 1 ERROR: 6. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 10 2024
R-4.5-winERRORSep 10 2024
R-4.5-linuxERRORSep 10 2024
R-4.4-winERRORSep 10 2024
R-4.4-macERRORSep 10 2024
R-4.3-winERRORSep 10 2024
R-4.3-macERRORSep 10 2024

Exports:%>%animate_modelareaas.phylo.slendr_phylocheck_dependenciescheck_envclear_envcompile_modeldistanceexpand_rangeexplore_modelextract_parametersgene_flowinit_envjoinmovemsprimeoverlapplot_mapplot_modelpopulationprint.slendr_tsread_modelregionreprojectresizeschedule_samplingset_dispersalset_rangesetup_envshrink_rangeslimsubstitute_valuessubtractts_afsts_ancestorsts_coalescedts_descendantsts_divergencets_diversityts_drawts_edgests_eigenstratts_f2ts_f3ts_f4ts_f4ratiots_fstts_genotypests_ibdts_loadts_metadatats_mutatets_namests_nodests_phylots_recapitatets_samplests_savets_segregatingts_simplifyts_tablets_tajimats_tractsts_treets_vcfworld

Dependencies:anytimeapebackportsbase64encBHbitbit64bslibcachemcheckmateclicliprcolorspacecommonmarkcpp11crayondigestdplyrfansifarverfastmapfontawesomefsgenericsggplot2gluegtableherehmshtmltoolshttpuvijtiffisobandjquerylibjsonlitelabelinglaterlatticelifecyclemagrittrMASSMatrixmemoisemgcvmimemunsellnlmepillarpkgconfigpngprettyunitsprogresspromisespurrrR6rappdirsRColorBrewerRcppRcppTOMLreadrreticulaterlangrprojrootsassscalesshinyshinyWidgetssourcetoolsstrexstringistringrtibbletidyrtidyselecttzdbutf8vctrsviridisLitevroomwithrxtablezeallot

Analyzing non-slendr tree sequences

Rendered fromvignette-08-nonslendr-tskit.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-05-07
Started: 2022-06-22

Demes on a regular spatial grid

Rendered fromvignette-02-grid-model.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-13
Started: 2021-07-16

Examples from the slendr paper

Rendered fromvignette-09-paper.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-05-07
Started: 2022-06-22

Extending models with custom SLiM code

Rendered fromvignette-11-extensions.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-05-21
Started: 2024-05-07

Extracting true ancestry tracts

Rendered fromvignette-10-tracts.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-13
Started: 2023-11-27

Installation instructions

Rendered fromvignette-00-installation.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-18
Started: 2022-03-21

Introduction and basic tutorial

Rendered fromvignette-01-tutorial.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-15
Started: 2021-07-16

Programming dispersion dynamics

Rendered fromvignette-03-interactions.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-13
Started: 2021-07-16

Simulating data with SLiM and msprime backends

Rendered fromvignette-07-backends.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-13
Started: 2022-01-21

Spatially annotated tree sequences

Rendered fromvignette-06-locations.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-03-13
Started: 2021-08-03

Traditional, non-spatial models

Rendered fromvignette-04-nonspatial-models.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-05-24
Started: 2021-07-16

Tree-sequence processing and statistics

Rendered fromvignette-05-tree-sequences.Rmdusingknitr::rmarkdownon Sep 10 2024.

Last update: 2024-05-07
Started: 2021-07-22

Readme and manuals

Help Manual

Help pageTopics
Animate the simulated population dynamicsanimate_model
Calculate the area covered by the given slendr objectarea
Check that the required dependencies are available for slendr to workcheck_dependencies
Check that the active Python environment is setup for slendrcheck_env
Remove the automatically created slendr Python environmentclear_env
Compile a slendr demographic modelcompile_model
Calculate the distance between a pair of spatial boundariesdistance
Expand the population rangeexpand_range
Open an interactive browser of the spatial modelexplore_model
Extract information from a compiled model or a simulated tree sequenceextract_parameters
Define a gene-flow event between two populationsgene_flow
Get the name of the current slendr Python environmentget_env
Activate slendr's own dedicated Python environmentinit_env
Merge two spatial 'slendr' objects into onejoin
Move the population to a new location in a given amount of timemove
Run a slendr model in msprimemsprime
Generate the overlap of two 'slendr' objectsoverlap
Plot 'slendr' geographic features on a mapplot_map
Plot demographic history encoded in a slendr modelplot_model
Define a populationpopulation
Print a short summary of a 'slendr' objectprint.slendr_map print.slendr_model print.slendr_pop print.slendr_region
Print tskit's summary table of the Python tree-sequence objectprint.slendr_ts
Read a previously serialized model configurationread_model
Define a geographic regionregion
Reproject coordinates between coordinate systemsreproject
Change the population sizeresize
Define sampling events for a given set of populationsschedule_sampling
Change dispersal parametersset_dispersal
Update the population rangeset_range
Setup a dedicated Python virtual environment for slendrsetup_env
Shrink the population rangeshrink_range
Run a slendr model in SLiMslim
Substitute values of parameters in a given slendr/SLiM extensionsubstitute_values
Generate the difference between two 'slendr' objectssubtract
Summarise the contents of a 'ts_nodes' resultsummary.slendr_nodes
Compute the allele frequency spectrum (AFS)ts_afs
Extract (spatio-)temporal ancestral history for given nodes/individualsts_ancestors
Check that all trees in the tree sequence are fully coalescedts_coalesced
Extract all descendants of a given tree-sequence nodets_descendants
Calculate pairwise divergence between sets of individualsts_divergence
Calculate diversity in given sets of individualsts_diversity
Plot a graphical representation of a single treets_draw
Extract spatio-temporal edge annotation table from a given tree or tree sequencets_edges
Convert genotypes to the EIGENSTRAT file formatts_eigenstrat
Calculate the f2, f3, f4, and f4-ratio statisticsts_f2 ts_f3 ts_f4 ts_f4ratio
Calculate pairwise statistics between sets of individualsts_fst
Extract genotype table from the tree sequencets_genotypes
Collect Identity-by-Descent (IBD) segments (EXPERIMENTAL)ts_ibd
Load a tree sequence file produced by a given modelts_load
Extract list with tree sequence metadata saved by SLiMts_metadata
Add mutations to the given tree sequencets_mutate
Extract names of individuals in a tree sequencets_names
Extract combined annotated table of individuals and nodests_nodes
Convert a tree in the tree sequence to an object of the class 'phylo'ts_phylo
Recapitate the tree sequencets_recapitate
Extract names and times of individuals of interest in the current tree sequence (either all sampled individuals or those that the user simplified to)ts_samples
Save a tree sequence to a filets_save
Calculate the density of segregating sites for the given sets of individualsts_segregating
Simplify the tree sequence down to a given set of individualsts_simplify
Get the table of individuals/nodes/edges/mutations/sites from the tree sequencets_table
Calculate Tajima's D for given sets of individualsts_tajima
Extract ancestry tracts from a tree sequence (EXPERIMENTAL)ts_tracts
Get a tree from a given tree sequencets_tree
Save genotypes from the tree sequence as a VCF filets_vcf
Define a world map for all spatial operationsworld