Python API

This page provides documentation for the arginfer Python API.

Running arginfer

arginfer.infer_sim(ts_full, sample_size, iteration=100, thin=20, burn=0, Ne=5000, seq_length=60000.0, mutation_rate=1e-08, recombination_rate=1e-08, outpath='/Users/amahmoudi/Ali/phd/github_projects/mcmc/arginfer/docs/output', plot=True, verbose=False, verify=False)

Takes msprime tree sequence with record_full_arg= True and - converts tree_sequence to Augmented Tree Sequence (ATS) format. - calculates true likelihood/ prior/ branch length / the number of ancestral and non-ancestral recombinations and returns them at outpath+"/true_values.npy - runs the mcmc and returns samples of ARGs from their posterior.

Parameters
  • ts_full -- msprime tree sequence with record_full_arg= True.

  • sample_size (int) -- The number of sampled genomes.

  • iteration (int) -- The number of MCMC iterations. Must be >20. The default = 100

  • thin (int) -- This specifies how often to write ARG samples to file. By default, the ARG is written every 10 iterations after burn-in.

  • burn (int) -- This specifies how many ARGs to discard as burn-in. Default is 0.

  • Ne (float) -- The effective (diploid) population size for the population. This defaults to 5000 if not specified.

  • seq_length (float) -- The length of the sequences in bases.This defaults to 6e4 if not specified.

  • mutation_rate (float) -- The rate of mutation per base per generation. This defaults to 1e-8 if not specified.

  • recombination_rate (float) -- The rate of recombination per base per generation. This defaults to 1e-8 if not specified.

  • outpath -- The path to store the outputs. This defaults to ./output if not specified.

  • plot (bool) -- plots the trace plots if True

  • verbose (bool) -- verbose.

  • verify (bool) -- for debugging purposes. Checks if the ARG is a valid ATS.

Returns

None. inferred ARGs are stored in outpath.