topiary.generax

Interface to generax.

topiary.generax.reconcile

Reconcile a gene tree with a species tree using generax.

topiary.generax.reconcile.reconcile(prev_calculation=None, df=None, model=None, gene_tree=None, species_tree=None, reconciled_tree=None, allow_horizontal_transfer=None, seed=None, bootstrap=False, converge_cutoff=0.03, calc_dir='reconcile', overwrite=False, num_threads=-1, threads_per_rep=1, generax_binary='generax', raxml_binary='raxml-ng')

Reconcile the gene tree to the species tree using generax.

Parameters:
  • prev_calculation (str or Supervisor, optional) – previously completed calculation. Should either be a directory containing the calculation (e.g. the directory with run_parameters.json, input, working, output) or a Supervisor instance with a calculation loaded. Function will load dataframe, model, gene_tree, and reconciled_tree from the previous run. If this is not specified, df, model, gene_tree and reconciled_tree arguments must be specified.

  • df (pandas.DataFrame or str, optional) – topiary data frame or csv written out from topiary df. Will override dataframe from prev_calculation if specified.

  • model (str, optional) – model (i.e. “LG+G8”). Will override model from prev_calculation if specified.

  • gene_tree (str, ete3.Tree, dendropy.tree, optional) – gene tree file for calculation. Will override tree in prev_calculation. If this an ete3 or dendropy tree, it will be written out with leaf names and branch lengths; all other data will be dropped.

  • species_tree (str, ete3.Tree, dendropy.tree, optional) – species tree file for calculation. Will override tree in prev_calculation. If this an ete3 or dendropy tree, it will be written out with leaf names; all other data will be dropped.

  • reconciled_tree (str, ete3.Tree, dendropy.tree, optional) – reconciled tree file for calculation. Will override tree in prev_calculation. If this an ete3 or dendropy tree, it will be written out with leaf names; all other data will be dropped. NOTE: this is required if bootstrap = True.

  • allow_horizontal_transfer (bool, optional) – whether to allow horizontal transfer during reconciliation. If True, use the “UndatedDTL” model. If False, use the “UndatedDL” model. If None, use whatever is in prev_calculation. If this is not specified, default to True.

  • seed (bool,int,str) – If true, pass a randomly generated seed to raxml. If int or str, use that as the seed. (passed via –seed)

  • bootstrap (bool, default=False) – whether or not to do bootstrap replicates. if True, prev_calculation must point to a raxml ml_bootstrap run

  • converge_cutoff (float, default=0.03) – bootstrap convergence criterion. only used of bootstrap = True. This is RAxML-NG default, passed to –bs-cutoff.

  • calc_dir (str, default="reconcile") – name of calc_dir directory

  • overwrite (bool, default=False) – whether or not to overwrite existing calc_dir directory

  • supervisor (Supervisor, optional) – supervisor instance to keep track of inputs and outputs

  • num_threads (int, default=-1) – number of threads to use. if -1 use all available.

  • threads_per_rep (int, default=1) – number of threads to use per replicate. only used if bootstrap = True

  • generax_binary (str, optional) – what generax binary to use

  • raxml_binary (str, optional) – what raxml binary to use

Returns:

plot – if running in jupyter notebook, return toyplot.canvas; otherwise, return None.

Return type:

toyplot.canvas or None