Package: admixtools 2.0.10

Robert Maier

admixtools: Inferring demographic history from genetic data

admixtools is a set of methods used to infer demographic history from genetic data using f-statistics. It was originally implemented as a command line program in C. This is a new implementation of the programs qpDstat, qpAdm, qpGraph, and contains several new features. It is efficient because it precomputes f2-statistics which can be re-used for many analyses.

Authors:Robert Maier [aut, cre], Nick Patterson [aut]

admixtools_2.0.10.tar.gz
admixtools_2.0.10.zip(r-4.7)admixtools_2.0.10.zip(r-4.6)admixtools_2.0.10.zip(r-4.5)
admixtools_2.0.10.tgz(r-4.6-x86_64)admixtools_2.0.10.tgz(r-4.6-arm64)admixtools_2.0.10.tgz(r-4.5-x86_64)admixtools_2.0.10.tgz(r-4.5-arm64)
admixtools_2.0.10.tar.gz(r-4.7-arm64)admixtools_2.0.10.tar.gz(r-4.7-x86_64)admixtools_2.0.10.tar.gz(r-4.6-arm64)admixtools_2.0.10.tar.gz(r-4.6-x86_64)
admixtools_2.0.10.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
admixtools/json (API)

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

Bug tracker:https://github.com/uqrmaie1/admixtools/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

openblascpp

8.34 score 96 stars 253 scripts 184 exports 61 dependencies

Last updated from:0c3ce6a408 (on master). Checks:11 NOTE, 2 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64NOTE297
linux-devel-x86_64NOTE280
source / vignettesOK431
linux-release-arm64NOTE353
linux-release-x86_64NOTE309
macos-release-arm64NOTE228
macos-release-x86_64NOTE393
macos-oldrel-arm64NOTE237
macos-oldrel-x86_64NOTE548
windows-develNOTE369
windows-releaseNOTE338
windows-oldrelNOTE346
wasm-releaseOK203

Exports:add_sampled_tipsafs_to_countsafs_to_f2agraph_to_igraphas_edge_tibbleboo_listcompare_fitscompute_f2_cache_idcount_snpsdecomposed_tree_neighborsdefault_drift_to_timedelete_admixdelete_groupsdelete_leafdesimplify_graphdiscard_from_aftableedges_to_igrapheigenstrat_to_afseigenstrat_to_plinkest_to_booest_to_looextract_afsextract_afs_simpleextract_countsextract_f2extract_f2_subsetextract_samplesf2f2_from_genof2_from_msprimef2_from_precompf2dat_f4datf3f3blockdat_from_genof4f4_from_afdatf4_from_f2f4blockdat_from_genof4blockdat_to_f4blocksfind_admixedgesfind_graphsfind_graphs_oldfind_newedgesfind_normedgesflipadmix_randomfstgenerate_all_graphsgenerate_all_treesget_block_lengthsget_leafnamesget_outpopget_rootnamegraph_addleafgraph_equationsgraph_f2_functiongraph_flipadmixgraph_hashgraph_minusonegraph_minusplusgraph_nodesgraph_plusonegraph_splittreesgraph_to_afsgraph_to_lgograph_to_pcsgraph_to_qpadmgraphmod_pavelgroup_samplesigraph_to_agraphinsert_admixinsert_admix_ninsert_leafis_validisomorphism_classesisomorphism_classes2joint_sfsjoint_spectrumlazadmloo_listloo_to_estmove_admixedge_oncemsprime_genomemsprime_simmutate_nnamedListnewick_to_edgesnode_timesnumadmixpackedancestrymap_to_afspackedancestrymap_to_plinkparse_dotparse_fstatsparse_qp3pop_outputparse_qpadm_outputparse_qpdstat_outputparse_qpf4ratio_outputparse_qpgraph_graphfileparse_qpgraph_outputpermute_leavespfile_to_afsplace_root_randomplink_to_afsplot_comparisonplot_graphplot_graph_mapplot_mapplotly_comparisonplotly_graphpseudo_datesqp3popqp3pop_resample_indsqp3pop_resample_snpsqp3pop_wrapperqpadmqpadm_modelsqpadm_multiqpadm_pqpadm_resample_indsqpadm_resample_snpsqpadm_rotateqpadm_sweepqpadm_wrapperqpdstatqpdstat_resample_indsqpdstat_resample_snpsqpdstat_wrapperqpf4diffqpf4ratioqpf4ratio_wrapperqpfstatsqpgraphqpgraph_precompute_f3qpgraph_resample_indsqpgraph_resample_multiqpgraph_resample_snpsqpgraph_resample_snps2qpgraph_wrapperqpwaveqpwave_pairsqpwave_resample_indsqpwave_resample_snpsrandom_admixturegraphrandom_datesrandom_newickrandom_simread_eigenstratread_f2read_f2_cache_metadataread_lgoread_packedancestrymapread_plinkresult_to_jsonrotate_modelsrun_shiny_admixtoolssatisfies_constraintssatisfies_eventordersatisfies_nonzerof4satisfies_numadmixsatisfies_zerof4set_node_attrsshortest_unique_prefixessimplify_graphsplit_matsplit_multifurcationsspr_allspr_leavessummarize_descendantssummarize_descendants_listsummarize_eventordersummarize_eventorder_listsummarize_fitssummarize_numadmixsummarize_numadmix_listsummarize_proxiessummarize_proxies_listsummarize_zerof4summarize_zerof4_listswap_leavestest_cladalitytree_in_graphtree_neighborsunidentifiable_edgeswrite_dotwrite_f2

Dependencies:abindbitbit64clicliprcodetoolscpp11crayoncubelyrdata.treedigestdoParalleldplyrfarverforeachfurrrfuturegenericsggplot2globalsgluegtablehmsigraphisobanditeratorsjsonlitelabelinglatticelifecyclelistenvlobstrmagrittrMatrixparallellypgenlibrpillarpkgconfigprettyunitsprogresspurrrquadprogR6RColorBrewerRcppRcppArmadilloreadrrlangS7scalesstringistringrtibbletidyrtidyselecttzdbutf8vctrsviridisLitevroomwithr

ADMIXTOOLS 2 Tutorial

Rendered fromadmixtools.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-24
Started: 2019-12-20

Admixture graphs

Rendered fromgraphs.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-24
Started: 2020-08-04

Data formats

Rendered fromio.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-23
Started: 2020-07-31

f-statistics

Rendered fromfstats.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-24
Started: 2020-07-31

Paper notes

Rendered frompaper.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2023-07-07
Started: 2022-05-09

Parallelization

Rendered fromparallel.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-23
Started: 2020-08-04

Plotting

Rendered fromplotting.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-24
Started: 2019-12-20

qpWave and qpAdm

Rendered fromqpadm.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-30
Started: 2020-12-28

Standard errors

Rendered fromresampling.Rmdusingknitr::rmarkdownon Jun 02 2026.

Last update: 2026-05-24
Started: 2020-07-31

Readme and manuals

Help Manual

Help pageTopics
Materialise sampled internal nodes as leaf tips.add_sampled_tips
Tools for inferring demographic history from genetic dataadmixtools-package admixtools
Compute count blocks and write them to diskafs_to_counts
Compute f2 blocks and write them to diskafs_to_f2
Compute all pairwise f2 statisticsafs_to_f2_blocks
Convert agraph to igraphagraph_to_igraph
Coerce to a plain edge tibble (drop the nodes attribute).as_edge_tibble
Generate a list of bootstrap resampled arraysboo_list
Compare the fit of two qpgraph modelscompare_fits
Compare the fit of two qpgraph modelscompare_fits2
Compare the fit of two qpgraph modelscompare_fits4
Compute a stable cache identifier for an 'extract_f2' runcompute_f2_cache_id
Count SNPs in an f2-statistics arraycount_snps
Count zero-length edgescount_zero_edges
Find all trees within SPR distance of 1 of all graph component treesdecomposed_tree_neighbors
Default drift-to-time conversion (identity)default_drift_to_time
Delete an admixture edgedelete_admix
Delete groupsdelete_groups
Remove population from graphdelete_leaf
Add two nodes before each admixture nodedesimplify_graph
Filter SNPs in an allele-frequency tablediscard_from_aftable
Convert data frame graph to igraphedges_to_igraph
Read allele frequencies from _EIGENSTRAT_ fileseigenstrat_to_afs
Turn per-block estimates into bootstrap estimatesest_to_boo
Turn per-block estimates into leave-one-out estimatesest_to_loo
Data frame with sample annotationsexample_anno
Blocked f2-statistics for 7 populationsexample_f2_blocks
Simulated f2-statistics for 5 populationsexample_f2sim1
Admixture graph for 7 populationsexample_graph
Admixture graph for 7 populationsexample_igraph
Data frame with one fitted admixture graphexample_opt
example_graph fitted using qpGraphexample_qpgraph_ref_results
Data frame with population triplesexample_triples
Compute and store blocked allele frequency dataextract_afs
Compute and store blocked allele frequency dataextract_afs_simple
Extract and store data needed to compute blocked f2extract_counts
Compute and store blocked f2 statisticsextract_f2
Compute and store blocked f2 statisticsextract_f2_large
Copy f2-statisticsextract_f2_subset
Extract samples from PLINK filesextract_samples
Estimate f2 statisticsf2
Compute blocked f2 statisticsf2_from_geno
Simulate an admixture graph in msprimef2_from_msprime
Read blocked f2 statistics from diskf2_from_precomp
Turn f2 data to f4 dataf2dat_f4dat
f3 from genotype dataf3blockdat_from_geno
Compute f4 from allele frequenciesf4_from_afdat
Get per-block f4-statisticsf4_from_f2
f4 from genotype dataf4blockdat_from_geno
Turn f4 block data to 3d arrayf4blockdat_to_f4blocks
Find admixture edgesfind_admixedges
Find well fitting admixture graphsfind_graphs
Find well fitting admixture graphsfind_graphs_old
Find possible new edgesfind_newedges
Find drift edgesfind_normedges
Modify a graph flipping the direction of an admixture edgeflipadmix_random
Compute Fstfst
Generate all graphsgenerate_all_graphs
Generate all treesgenerate_all_trees
Find LD-independent blocksget_block_lengths
Turns f2_data into f2_blocksget_f2
Get the population names of a graphget_leafnames
Get the outgroup from a graph (if it exists)get_outpop
Get the root nameget_rootname
Add a population to an admixture graphgraph_addleaf
Pairwise distance estimates for graphsgraph_distances
Find well fitting admixture graphsgraph_equations
Make a function representing a graphgraph_f2_function
Find all valid graphs which result from flipping one admixture edgegraph_flipadmix
Get unique hash of an admixture graphgraph_hash
Find all graphs which result from removing one admixture edgegraph_minusone
Find all graphs which result from adding and removing one admixture edgegraph_minusplus
Return the nodes attribute of an edge tibble.graph_nodes
Find all graphs which result from adding one admixture edgegraph_plusone
Find all trees which are part of the admixture graphgraph_splittrees
Simulate allele frequncies under an admixture graphgraph_to_afs
Export an admixtools admixture graph to LEGOFIT .lgo formatgraph_to_lgo
Simulate PCs under an admixture graphgraph_to_pcs
Get all qpadm models for a graphgraph_to_qpadm
Return all graphs created from permuting a subcladegraphmod_pavel
Group precomputed datagroup_samples
Convert igraph to agraphigraph_to_agraph
Insert a single edge into graphinsert_admix
Insert admixture edges into graphinsert_admix_n
Insert admixture edges into graphinsert_admix_old
Add population to graphinsert_leaf
Test if an admixture graph is validis_valid
Find identical graphsisomorphism_classes
Find identical graphsisomorphism_classes2
Joint site frequency spectrumjoint_sfs
Estimate joint allele frequency spectrumjoint_spectrum
Estimate admixture weightslazadm
Generate a list of leave-one-out arraysloo_list
Turn leave-one-out estimates to per-block estimatesloo_to_est
Modify a graph by moving an admixture edgemove_admixedge_once
Simulate an admixture graph in msprime v1.x.msprime_genome
Simulate an admixture graph in msprime v1.xmsprime_sim
Modify a graph by applying n mutation functionsmutate_n
Create a named list from argumentsnamedList
Turn a newick format tree to a matrix of edgesnewick_to_edges
Count how often each node in graph occurs in other graphsnode_counts
Returns a signature of a graph consisting of the left and right descendent leaf nodes of each internal node (sorted and concatenated)node_signature
Get fitted times as a named numeric vector.node_times
Count number of admixture nodesnumadmix
Read allele frequencies from packedancestrymap filespackedancestrymap_to_afs
Convert _EIGENSTRAT_ or _PACKEDANCESTRYMAP_ to _PLINK_eigenstrat_to_plink packedancestrymap_to_plink
Read graph in dot formatparse_dot
Parse qpGraph fstats output fileparse_fstats
Read qp3Pop output fileparse_qp3pop_output
Read qpAdm output fileparse_qpadm_output
Read qpDstat output fileparse_qpdstat_output
Read qpF4ratio output fileparse_qpf4ratio_output
Read qpGraph graph fileparse_qpgraph_graphfile
Read qpGraph output fileparse_qpgraph_output
Modify a graph by permuting leaf nodespermute_leaves
Read allele frequencies from 'PFILE' files ('.pgen' / '.pvar' / '.psam')pfile_to_afs
Modify a graph by changing the position of the root nodeplace_root_random
Read allele frequencies from 'PLINK' filesplink_to_afs
Compare two modelsplot_comparison
Plot an admixture graphplot_graph
Plot an admixture graph on a mapplot_graph_map
Plot samples on a mapplot_map
Compare two modelsplotly_comparison
Plot an admixture graph using plotlyplotly_graph
Get pseudo dates for graph nodespseudo_dates
Estimate f3 statisticsf3 qp3pop
Wrapper function around the original qp3Pop programqp3pop_wrapper
Estimate admixture weightsqpadm
Partition a list of populations into left and right populationsqpadm_models
Return all valid qpAdm models for an admixturegraphqpadm_models_old
Run multiple qpadm modelsqpadm_multi
Faster version of 'qpadm' with reduced outputqpadm_p
Compute p-values for many qpadm modelsqpadm_rotate
Sweep qpadm over a Cartesian product of targets, source-sets, and right-setsqpadm_sweep
Wrapper function around the original qpAdm programqpadm_wrapper
Estimate f4 statisticsf4 qpdstat
Wrapper function around the original qpDstat programqpdstat_wrapper
Estimate f4 differencesqpf4diff
Estimate admixture proportions via f4 ratiosqpf4ratio
Wrapper function around the original qpF4ratio programqpf4ratio_wrapper
Get smoothed f2-statisticsqpfstats
Compute the fit of an admixture graphqpgraph
Compute f3-statistics from f2-statistics.qpgraph_precompute_f3
Evaluate a qpgraph models many timesqpgraph_resample_multi
Evaluate a qpgraph model many timesqpgraph_resample_snps2
Wrapper function around the original qpGraph programqpgraph_wrapper
Estimate admixture wavesqpwave
Compute all pairwise qpwave p-valuesqpwave_pairs
Generate a random admixture graphrandom_admixturegraph
Get random dates for graph nodesrandom_dates
Generate a random binary graphrandom_newick
Generate a random graph and simulate it in msprime v1.xrandom_sim
Read genotype data from _EIGENSTRAT_ filesread_eigenstrat
Read blocked f2 estimates from diskread_f2
Read the cache metadata sidecar written by extract_f2()read_f2_cache_metadata
Parse a LEGOFIT .lgo file (minimum-viable subset)read_lgo
Read genotype data from packedancestrymap filesread_packedancestrymap
Read genotype data from 'PLINK' filesread_plink
Run models while leaving out individualsqp3pop_resample_inds qpadm_resample_inds qpdstat_resample_inds qpgraph_resample_inds qpwave_resample_inds resample_inds
Run models while leaving out SNP blocksqp3pop_resample_snps qpadm_resample_snps qpdstat_resample_snps qpgraph_resample_snps qpwave_resample_snps resample_snps
Serialize an admixtools result to JSONresult_to_json
Rotate populations between left and rightrotate_models
Launch ADMIXTOOLS 2 GUIrun_shiny_admixtools
Test constraints on a graphsatisfies_constraints
Test f4 constraints on a graphsatisfies_eventorder
Test f4 constraints on a graphsatisfies_nonzerof4
Test admixture constraints on a graphsatisfies_numadmix
Test f4 constraints on a graphsatisfies_zerof4
Set or update node attributes.set_node_attrs
Return shortest unique prefixesshortest_unique_prefixes
Remove redundant edgessimplify_graph
Split a matrix into blockssplit_mat
Split nodes with more than two edgessplit_multifurcations
Modify a graph by regrafting a subcomponentspr_all
Modify a graph by regrafting a leafspr_leaves
List leaf nodes for all internal nodessummarize_descendants
List leaf nodes for all internal nodes in a list of graphssummarize_descendants_list
List population split events in a graphsummarize_eventorder
List population split events in a list of graphssummarize_eventorder_list
Summarize graph fitssummarize_fits
List number of admixture events for each populationsummarize_numadmix
List number of admixture events for each population in a list of graphssummarize_numadmix_list
Assign proxy populations to admixed populationssummarize_proxies
List proxy populations in graphlistsummarize_proxies_list
Summarize triples across graphssummarize_triples
List clades in a graphsummarize_zerof4
List clades in a list of graphssummarize_zerof4_list
Modify a graph by swapping two leaf nodesswap_leaves
Test if two sets of populations form two cladestest_cladality
Test if a tree is part of a graphtree_in_graph
Find all trees within SPR distance of 1tree_neighbors
Find all unidentifiable edgesunidentifiable_edges
Convert graph to dot formatwrite_dot
Write blocked f2 estimates to diskwrite_f2