Implements tools for building and visualising admixture graphs and for extracting equations from them. These equations can be compared to f- statistics obtained from data to test the consistency of a graph against data -- for example by comparing the sign of f_4-statistics with the signs predicted by the graph -- and graph parameters (edge lengths and admixture proportions) can be fitted to observed statistics.

Install the latest version of this package by entering the following in R:

`install.packages("admixturegraph")`

Author | Thomas Mailund [cre, aut], Kalle Leppala [aut], Svend Nielsen [aut] |

Date of publication | 2016-12-13 15:33:28 |

Maintainer | Thomas Mailund <mailund@birc.au.dk> |

License | GPL-2 |

Version | 1.0.2 |

https://github.com/mailund/admixture_graph |

**add_a_leaf:** Adds a new leaf to a graph.

**add_an_admixture:** Adds a new admixture event to a graph.

**add_an_admixture2:** Adds a new admixture event to a graph.

**add_graph_f4:** Evalutes the f_4 statistics for all rows in a data frame and...

**add_graph_f4_sign:** Extend a data frame with f_4 statistics predicted by a graph.

**admix_props:** Specify the proportions in an admixture event.

**admixture_edge:** Create an admixture edge from a child to two parents.

**admixturegraph-package:** admixturegraph: Visualising and analysing admixture graphs.

**admixture_proportions:** Create the list of admixture proportions for an admixture...

**agraph:** Create an admixture graph object.

**agraph_children:** Build the child incidene matrix from an parent edge list.

**agraph_parents:** Build the parent incidence matrix from an edge list.

**agraph_weights:** Build the matrix of admixture proportions from an edge list.

**all_graphs:** All graphs.

**all_path_overlaps:** Get the list of overlaps of all paths.

**all_paths:** Compute all paths from one leaf to another.

**bears:** Statistics for populations of bears

**build_edge_optimisation_matrix:** Build a matrix coding the linear system of edges once the...

**burn_in:** Removes the first k rows from a trace.

**calculate_concentration:** Building a proxy concentration matrix.

**canonise_expression:** Used to recognize similar expressions and to possibly...

**canonise_graph:** Canonise graph.

**coef.agraph_fit:** Parameters for the fitted graph.

**cost_function:** The cost function fed to Nelder-Mead.

**edge:** Create an edge from a child to a parent.

**edge_optimisation_function:** More detailed edge fitting than mere cost_function.

**eight_leaves_trees:** Eight leaves trees.

**evaluate_f4:** Evaluates an f_4 statistics in a given environment.

**examine_edge_optimisation_matrix:** Examine the edge optimisation matrix to detect unfitted admix...

**extract_admixture_proportion_parameters:** Extract the admixture proportion parameter from edge...

**extract_graph_parameters:** Extract all the parameters a graph contains.

**extract_trees:** Extract trees

**f2:** Calculate the f_2(A, B) statistics.

**f3:** Calculate the f_3(A; B, C) statistics.

**f4:** Calculate the f_4(W, X; Y, Z) statistics.

**f4stats:** Make a data frame an f_4 statistics object.

**fast_fit:** A fast version of graph fitting.

**fast_plot:** Fast version of graph plotting.

**filter_on_leaves:** Filter data so all W, X, Y and Z are leaves in the graph.

**fit_graph:** Fit the graph parameters to a data set.

**fit_graph_list:** Fit lots of graphs to data.

**fit_permutations_and_graphs:** Fit lots of graphs to data.

**fitted.agraph_fit:** Predicted f statistics for the fitted graph.

**five_leaves_graphs:** Five leaves graphs.

**format_path:** Create a path data frame from a list of nodes.

**four_leaves_graphs:** Four leaves graphs.

**get_graph_f4_sign:** Extracts the sign for the f_4 statistics predicted by the...

**graph_environment:** Build an environment in which f statistics can be evaluated.

**graphs_2_0:** Admixture graphs of 2 leaves and 0 admixture events...

**graphs_3_0:** Admixture graphs of 3 leaves and 0 admixture events...

**graphs_3_1:** Admixture graphs of 3 leaves and 1 admixture event compressed...

**graphs_4_0:** Admixture graphs of 4 leaves and 0 admixture events...

**graphs_4_1:** Admixture graphs of 4 leaves and 1 admixture event compressed...

**graphs_4_2:** Admixture graphs of 4 leaves and 2 admixture events...

**graphs_5_0:** Admixture graphs of 5 leaves and 0 admixture events...

**graphs_5_1:** Admixture graphs of 5 leaves and 1 admixture event compressed...

**graphs_5_2:** Admixture graphs of 5 leaves and 2 admixture events...

**graphs_6_0:** Admixture graphs of 6 leaves and 0 admixture events...

**graphs_6_1:** Admixture graphs of 6 leaves and 1 admixture event compressed...

**graphs_6_2:** Admixture graphs of 6 leaves and 2 admixture events...

**graphs_7_0:** Admixture graphs of 7 leaves and 0 admixture events...

**graphs_7_1:** Admixture graphs of 7 leaves and 1 admixture event compressed...

**graphs_8_0:** Admixture graphs of 8 leaves and 0 admixture events...

**graph_to_vector:** Graph to vector.

**is_descendant_of:** Is descendant of.

**is_negative:** All overlaps are either empty or have a negative weight.

**is_positive:** All overlaps are either empty or have a positive weight.

**is_unknown:** Overlapping edges have both positive and negative...

**is_zero:** All overlaps are empty.

**log_likelihood:** Calculate (essentially) the log likelihood of a graph with...

**log_sum_of_logs:** Computes the log of a sum of numbers all given in log-space.

**make_an_outgroup:** Make an outgroup.

**make_mcmc_model:** Collect the information about a graph and a data set needed...

**make_permutations:** List of permutations.

**model_bayes_factor_n:** Computes the Bayes factor between two models from samples...

**model_likelihood:** Computes the likelihood of a model from samples from its...

**model_likelihood_n:** Computes the likelihood of a model from samples from its...

**mynonneg:** Non negative least square solution.

**no_admixture_events:** Get the number of admixture events in a graph.

**no_admixture_events.agraph:** Get the number of admixture events in a graph.

**no_admixture_events.agraph_fit:** Get the number of admixture events in a fitted graph.

**no_admixture_events.agraph_fit_list:** Get the number of admixture events in a list of fitted graph.

**no_poor_fits:** Get the number of tests in the fit where the predictions fall...

**no_poor_fits.agraph_fit:** Get the number of tests in the fit where the predictions fall...

**no_poor_fits.agraph_fit_list:** Get the number of tests in the fit where the predictions fall...

**overlaps_sign:** Get the sign of overlapping paths.

**parent_edges:** Create the list of edges for an admixture graph.

**path_overlap:** Collect the postive and negative overlap between two paths.

**plot.agraph:** Plot an admixture graph.

**plot.agraph_fit:** Plot the fit of a graph to data.

**plot.f4stats:** Plot the fit of a graph to data.

**plot_fit_1:** A plot of the cost function or number of fitted statistics.

**plot_fit_2:** A contour plot of the cost function.

**poor_fits:** Get the tests in the fit where the predictions fall outside...

**poor_fits.agraph_fit:** Get the tests in the fit where the predictions fall outside...

**poor_fits.agraph_fit_list:** Get the tests in the fit where the predictions fall outside...

**print.agraph_fit:** Print function for the fitted graph.

**project_to_population:** Map sample names to population names.

**remove_duplicates:** Remove duplicate graphs from a list.

**rename_nodes:** Rename nodes.

**residuals.agraph_fit:** Errors of prediction in the fitted graph

**run_metropolis_hasting:** Run a Metropolis-Hasting MCMC to sample graph parameters.

**seven_leaves_graphs:** Seven leaves graphs.

**seven_leaves_trees:** Seven leaves trees.

**sf2:** Calculate the f_2(A, B) statistics.

**sf3:** Calculate the f_3(A; B, C) statistics.

**sf4:** Calculate the f_4(W, X; Y, Z) statistics.

**six_leaves_graphs:** Six leaves graphs.

**split_population:** Reverse a projection of samples to populations.

**split_population.agraph_fit:** Reverse a projection of samples to populations.

**split_population.data.frame:** Reverse a projection of samples to populations.

**summary.agraph_fit:** Summary for the fitted graph.

**sum_of_squared_errors:** Get the sum of squared errors for a fitted graph.

**sum_of_squared_errors.agraph_fit:** Get the sum of squared errors for a fitted graph.

**sum_of_squared_errors.agraph_fit_list:** Get the sum of squared errors for a list of fitted graph.

**thinning:** Thins out an MCMC trace.

**vector_to_graph:** Vector to graph.

add_a_leaf | Man page |

add_an_admixture | Man page |

add_an_admixture2 | Man page |

add_graph_f4 | Man page |

add_graph_f4_sign | Man page |

admix_props | Man page |

admixture_edge | Man page |

admixturegraph-package | Man page |

admixture_proportions | Man page |

agraph | Man page |

agraph_children | Man page |

agraph_parents | Man page |

agraph_weights | Man page |

all_graphs | Man page |

all_path_overlaps | Man page |

all_paths | Man page |

bears | Man page |

build_edge_optimisation_matrix | Man page |

burn_in | Man page |

calculate_concentration | Man page |

canonise_expression | Man page |

canonise_graph | Man page |

coef.agraph_fit | Man page |

cost_function | Man page |

edge | Man page |

edge_optimisation_function | Man page |

eight_leaves_trees | Man page |

evaluate_f4 | Man page |

examine_edge_optimisation_matrix | Man page |

extract_admixture_proportion_parameters | Man page |

extract_graph_parameters | Man page |

extract_trees | Man page |

f2 | Man page |

f3 | Man page |

f4 | Man page |

f4stats | Man page |

fast_fit | Man page |

fast_plot | Man page |

filter_on_leaves | Man page |

fit_graph | Man page |

fit_graph_list | Man page |

fit_permutations_and_graphs | Man page |

fitted.agraph_fit | Man page |

five_leaves_graphs | Man page |

format_path | Man page |

four_leaves_graphs | Man page |

get_graph_f4_sign | Man page |

graph_environment | Man page |

graphs_2_0 | Man page |

graphs_3_0 | Man page |

graphs_3_1 | Man page |

graphs_4_0 | Man page |

graphs_4_1 | Man page |

graphs_4_2 | Man page |

graphs_5_0 | Man page |

graphs_5_1 | Man page |

graphs_5_2 | Man page |

graphs_6_0 | Man page |

graphs_6_1 | Man page |

graphs_6_2 | Man page |

graphs_7_0 | Man page |

graphs_7_1 | Man page |

graphs_8_0 | Man page |

graph_to_vector | Man page |

is_descendant_of | Man page |

is_negative | Man page |

is_positive | Man page |

is_unknown | Man page |

is_zero | Man page |

log_likelihood | Man page |

log_sum_of_logs | Man page |

make_an_outgroup | Man page |

make_mcmc_model | Man page |

make_permutations | Man page |

model_bayes_factor_n | Man page |

model_likelihood | Man page |

model_likelihood_n | Man page |

mynonneg | Man page |

no_admixture_events | Man page |

no_admixture_events.agraph | Man page |

no_admixture_events.agraph_fit | Man page |

no_admixture_events.agraph_fit_list | Man page |

no_poor_fits | Man page |

no_poor_fits.agraph_fit | Man page |

no_poor_fits.agraph_fit_list | Man page |

overlaps_sign | Man page |

parent_edges | Man page |

path_overlap | Man page |

plot.agraph | Man page |

plot.agraph_fit | Man page |

plot.f4stats | Man page |

plot_fit_1 | Man page |

plot_fit_2 | Man page |

poor_fits | Man page |

poor_fits.agraph_fit | Man page |

poor_fits.agraph_fit_list | Man page |

print.agraph_fit | Man page |

project_to_population | Man page |

remove_duplicates | Man page |

rename_nodes | Man page |

residuals.agraph_fit | Man page |

run_metropolis_hasting | Man page |

seven_leaves_graphs | Man page |

seven_leaves_trees | Man page |

sf2 | Man page |

sf3 | Man page |

sf4 | Man page |

six_leaves_graphs | Man page |

split_population | Man page |

split_population.agraph_fit | Man page |

split_population.data.frame | Man page |

summary.agraph_fit | Man page |

sum_of_squared_errors | Man page |

sum_of_squared_errors.agraph_fit | Man page |

sum_of_squared_errors.agraph_fit_list | Man page |

thinning | Man page |

vector_to_graph | Man page |

inst

inst/doc

inst/doc/admixturegraph.html

inst/doc/admixturegraph.Rmd

inst/doc/admixturegraph.R
tests

tests/testthat.R
tests/testthat

tests/testthat/test_path_overlaps.R
tests/testthat/test_f_statistics.R
tests/testthat/test_graph_construction.R
tests/testthat/test_plots.R
tests/testthat/test_paths.R
tests/testthat/test_signs.R
NAMESPACE

data

data/graphs_5_0.RData

data/graphs_7_0.RData

data/graphs_8_0.RData

data/graphs_5_2.RData

data/graphs_3_1.RData

data/bears.RData

data/graphs_3_0.RData

data/graphs_4_1.RData

data/graphs_7_1.RData

data/graphs_6_2.RData

data/datalist

data/graphs_4_2.RData

data/graphs_5_1.RData

data/graphs_2_0.RData

data/graphs_6_1.RData

data/graphs_4_0.RData

data/graphs_6_0.RData

R

R/symbolic-f-statistics.R
R/evaluate-f-statistics.R
R/signs.R
R/summary-statistics.R
R/plot.R
R/project_and_split.R
R/filter.R
R/data.R
R/f4_plotting.R
R/fitting.R
R/paths.R
R/agraph.R
R/admixture_graph.R
R/fitted_plotting.R
R/overlaps.R
R/propose.R
R/mcmc.R
R/f-statistics.R
vignettes

vignettes/bibliography.bib

vignettes/admixturegraph.md

vignettes/admixturegraph.Rmd

vignettes/admixturegraph_files

vignettes/admixturegraph_files/figure-html

vignettes/admixturegraph_files/figure-html/new_leaves-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-1-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-19-4.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-14-1.png

vignettes/admixturegraph_files/figure-html/new_admixtures-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-12-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-4-1.png

vignettes/admixturegraph_files/figure-html/new_root-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-9-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-19-3.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-19-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-10-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-6-1.png

vignettes/admixturegraph_files/figure-html/bears_graph-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-18-2.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-15-2.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-3-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-7-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-11-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-8-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-15-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-18-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-13-1.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-19-2.png

vignettes/admixturegraph_files/figure-html/unnamed-chunk-5-1.png

vignettes/admixturegraph_files/figure-latex

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-11-1.pdf

vignettes/admixturegraph_files/figure-latex/bears_graph-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-15-2.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-19-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-7-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-6-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-18-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-4-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-1-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-12-1.pdf

vignettes/admixturegraph_files/figure-latex/new_admixtures-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-18-2.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-3-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-19-4.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-9-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-5-1.pdf

vignettes/admixturegraph_files/figure-latex/new_root-1.pdf

vignettes/admixturegraph_files/figure-latex/new_leaves-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-14-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-19-2.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-19-3.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-13-1.pdf

vignettes/admixturegraph_files/figure-latex/unnamed-chunk-15-1.pdf

README.md

MD5

build

build/vignette.rds

DESCRIPTION

man

man/seven_leaves_trees.Rd
man/path_overlap.Rd
man/no_admixture_events.agraph_fit_list.Rd
man/log_likelihood.Rd
man/agraph_children.Rd
man/project_to_population.Rd
man/thinning.Rd
man/f2.Rd
man/sum_of_squared_errors.agraph_fit.Rd
man/add_an_admixture2.Rd
man/sf2.Rd
man/plot_fit_2.Rd
man/log_sum_of_logs.Rd
man/vector_to_graph.Rd
man/graphs_3_0.Rd
man/graphs_6_0.Rd
man/graphs_6_1.Rd
man/fast_plot.Rd
man/graphs_5_2.Rd
man/graphs_4_0.Rd
man/poor_fits.agraph_fit.Rd
man/poor_fits.Rd
man/coef.agraph_fit.Rd
man/model_bayes_factor_n.Rd
man/edge_optimisation_function.Rd
man/six_leaves_graphs.Rd
man/graphs_3_1.Rd
man/f4stats.Rd
man/plot_fit_1.Rd
man/graphs_8_0.Rd
man/graphs_4_1.Rd
man/remove_duplicates.Rd
man/split_population.agraph_fit.Rd
man/is_zero.Rd
man/plot.f4stats.Rd
man/no_poor_fits.Rd
man/sf3.Rd
man/make_permutations.Rd
man/all_paths.Rd
man/agraph_parents.Rd
man/all_graphs.Rd
man/bears.Rd
man/filter_on_leaves.Rd
man/admixturegraph-package.Rd
man/canonise_expression.Rd
man/agraph.Rd
man/four_leaves_graphs.Rd
man/seven_leaves_graphs.Rd
man/canonise_graph.Rd
man/get_graph_f4_sign.Rd
man/examine_edge_optimisation_matrix.Rd
man/admixture_proportions.Rd
man/add_graph_f4.Rd
man/no_admixture_events.agraph.Rd
man/residuals.agraph_fit.Rd
man/make_mcmc_model.Rd
man/edge.Rd
man/plot.agraph.Rd
man/cost_function.Rd
man/graphs_6_2.Rd
man/poor_fits.agraph_fit_list.Rd
man/graphs_5_1.Rd
man/fit_permutations_and_graphs.Rd
man/sf4.Rd
man/graphs_7_0.Rd
man/overlaps_sign.Rd
man/graphs_5_0.Rd
man/f4.Rd
man/add_graph_f4_sign.Rd
man/model_likelihood.Rd
man/graphs_2_0.Rd
man/is_negative.Rd
man/evaluate_f4.Rd
man/no_poor_fits.agraph_fit.Rd
man/sum_of_squared_errors.Rd
man/mynonneg.Rd
man/build_edge_optimisation_matrix.Rd
man/eight_leaves_trees.Rd
man/graphs_7_1.Rd
man/rename_nodes.Rd
man/is_descendant_of.Rd
man/fast_fit.Rd
man/no_admixture_events.Rd
man/sum_of_squared_errors.agraph_fit_list.Rd
man/run_metropolis_hasting.Rd
man/no_admixture_events.agraph_fit.Rd
man/is_positive.Rd
man/five_leaves_graphs.Rd
man/agraph_weights.Rd
man/summary.agraph_fit.Rd
man/all_path_overlaps.Rd
man/format_path.Rd
man/model_likelihood_n.Rd
man/print.agraph_fit.Rd
man/is_unknown.Rd
man/f3.Rd
man/make_an_outgroup.Rd
man/graph_to_vector.Rd
man/calculate_concentration.Rd
man/graphs_4_2.Rd
man/extract_admixture_proportion_parameters.Rd
man/fit_graph_list.Rd
man/split_population.data.frame.Rd
man/no_poor_fits.agraph_fit_list.Rd
man/split_population.Rd
man/add_a_leaf.Rd
man/fitted.agraph_fit.Rd
man/admix_props.Rd
man/extract_graph_parameters.Rd
man/add_an_admixture.Rd
man/burn_in.Rd
man/graph_environment.Rd
man/fit_graph.Rd
man/plot.agraph_fit.Rd
man/extract_trees.Rd
man/parent_edges.Rd
man/admixture_edge.Rd
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.