Table of Contents#

math.Skewness#

Returns skewness of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.Variance#

Returns variance of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.Std#

Returns standard deviation of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.GatherDescriptiveStats#

Returns suite of statistical information for a 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.GetIC#

Computes small-sample AIC

Parameters

  • logl
  • params
  • samples

math.HolmBonferroniCorrection#

Returns Holm-Bonferroni corrected p-values

Parameters

  • ps Dict a key -> p-value (or null, for not done)

math.minNormalizedRange#

Returns the range normalized to the lowest value

Returns number

math.DoLRT#

Computes the LRT and p-value

Parameters

  • lognull
  • logalt
  • df

math.Sum#

Computes sum of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math#

math.Median#

Returns median average of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.Int#

Converts a float to integer by rounding

Parameters

  • float

math.Mean#

Returns mean average of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

math.Kurtosis#

Returns kurtosis of 1xN vector

Parameters

  • _data_vector Matrix 1xN vector

matrix#

matrix.Symmetrize#

upper triangle gets copied to lower triangle for non-square matrices, the largest square minor is symmetrized

Parameters

  • mx Matrix matrix to perform transform on

Returns any nothing

random#

#

Parameters

  • strings Dict/Matrix set of strings to partition (if Dict, will use the set of VALUES)
  • rex Dict/Matrix string matrix of regular expressions (if Dict, will use the set of VALUES)

Returns Dict "reg-exp" : "set of matched strings" (as dict) PLUS a special key ("") which did not match any regular expression

regexp.Split#

Parameters

Returns Dictionary a dictionary containing split strings

regexp#

regexp.Replace#

Parameters

  • string String
  • re String search for this expression
  • repl String replace each occurence of re with repl

Returns Dictionary a dictionary containing split strings

regexp.Find#

Parameters

Returns String the portion of the string that is matching

regexp.FindSubexpressions#

Parameters

Returns AssociativeList all matched RE subsexpressions

regexp.PartitionByRegularExpressions#

Parameters

  • strings Dict/Matrix set of strings to partition (if Dict, will use the set of VALUES)
  • rex Dict/Matrix string matrix of regular expressions ((if Dict, will use the set of VALUES)

Returns Dict "reg-exp" : "set of matched strings" (as dict) PLUS a special key ("") which did not match any regular expression

models.binary.generic.Time#

Parameters

  • option does nothing

Returns any default time

models.binary.generic.DefineQMatrix#

Parameters

  • modelSpec Dictionary
  • namespace String

models.binary#

models.codon.generate_stencil#

Generates a branch length extraction stencil for synonymous and non-synonymous rates

Parameters

  • type String terms.genetic_code.synonymous or terms.genetic_code.nonsynonymous or callback
  • model Dictionary the model object

Returns Matrix the appropriate NxN matrix stencil

models.codon.generic.DefineQMatrix#

Parameters

  • modelSpect
  • namespace

#

return complete differences between two codons *

models.codon#

models.codon.MapCode#

Parameters

Returns Dictionary the sense, stop, and translation-table for the genetic code

models.DNA.generic.Time#

Parameters

  • option does nothing

Returns any default time

models.DNA.generic.DefineQMatrix#

Parameters

  • modelSpec Dictionary
  • namespace String

models.DNA#

frequencies.empirical.binary#

Sets model's equilibrium frequency estimator to ML for binary data

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.binary#

Sets model's equilibrium frequency estimator to Binary chatacter 2x1 estimator

Parameters

  • model Dictionary
  • namespace String does nothing
  • datafilter DataSetFilter does nothing

Returns Dictionary updated model

frequencies.empirical.protein#

Sets model's equilibrium frequency estimator to protein 20x1 estimator

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.protein#

Sets model's equilibrium frequency estimator to ML for protein data

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.protein#

Multiplies nucleotide frequencies into the empirical codon estimate

Parameters

  • model Dictionary
  • __estimates Matrix 4x3 matrix of frequency estimates

Returns Dictionary updated model

frequencies.equal#

Sets model's equilibrium frequency estimator to equal frequencies

Parameters

  • model Dictionary
  • namespace String does nothing
  • datafilter DataSetFilter does nothing

Returns Dictionary updated model

frequencies.empirical.F3x4#

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.F1x4#

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.corrected.CF3x4#

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.mle#

To be implemented

Parameters

  • model
  • namespace
  • datafilter

frequencies.empirical.nucleotide#

Sets model's equilibrium frequency estimator to Nucleotide 4x1 estimator

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies.empirical.nucleotide#

Compute equilibrium frequencies at run-time using Q inversion

Parameters

  • model Dictionary
  • namespace String
  • datafilter DataSetFilter

Returns Dictionary updated model

frequencies#

#

This is an function that computes stationary frequencies of Markov process based on its
rate matrix

Parameters

  • Q Matrix matrix

model.define_from_components#

Parameters

  • id {String} Name of of Model
  • q {Matrix} instantaneous transition matrix
  • evf {Matrix} the equilibrium frequencies
  • canonical Number matrix exponential

Examples

q = {{*,t,kappa*t,t}
 {t,*,t,t*kappa}
 {t*kappa,t,*,t}
 {t,t*kappa,t,*}};
evf =  {{0.4}{0.3}{0.2}{0.1}};
model.define_from_components(q,evf,1);

Returns any nothing, sets a global {Model}

model.generic.AddLocal#

Parameters

  • model_spec
  • id
  • tag

model.generic.AddGlobal#

Parameters

  • model_spec
  • id
  • tag

model.generic.GetLocalParameter#

Parameters

  • model_spec
  • tag

model.generic.GetLocalParameter#

Parameters

  • model Model

Returns String

model.generic.GetGlobalParameter#

Parameters

  • model_spec
  • tag

model.generic.get_a_parameter#

Parameters

  • model_spec
  • tag
  • type

model.generic.get_rate_variation#

Parameters

  • model_spec
  • tag
  • type

model.generic.DefineModel#

Parameters

  • model_spec
  • id
  • arguments
  • data_filter
  • estimator_type

model.generic.DefineMixtureModel#

Parameters

  • model_spec
  • id
  • arguments
  • data_filter
  • estimator_type

model.ApplyModelToTree#

Parameters

  • id {String}
  • tree
  • model_list
  • rules

models.generic.ConstrainBranchLength#

Parameters

  • model Model
  • or AssociativeList {Number} value
  • parameter String

Returns any the number of constraints generated (0 or 1)

models.generic.SetBranchLength#

Parameters

  • model Model
  • or AssociativeList {Number} value
  • parameter String

Returns any the number of constraints generated (0 or 1)

models.generic.AttachFilter#

Parameters

  • model Model
  • filter DataSetFilter

Returns any 0

model.Dimension#

Parameters

  • model Model

Returns Matrix dimensions of model

model.parameters.Local#

Parameters

  • model Model

Returns Matrix local parameters

model.parameters.Global#

Parameters

  • model Model

Returns Matrix global parameters

model.MatchAlphabets#

Parameters

  • a1 Matrix first alphabet to compare
  • a2 Matrix second alphabet to compare

Returns Number 1 if they are equal, 0 if they are not

#

Parameters

  • models Dict list of model objects
  • filter RegEx only apply to parameters matching this expression

Returns Dict the set of constraints applied

#

Parameters

  • model Dict first alphabet to compare

Returns String the branch length expression string

model#

model.GetParameters_RegExp#

Parameters

  • model {String} - model ID
  • re {String} - regular expression

Returns any a dictionary of global model parameters that match a regexp

model.ApplyToBranch#

Parameters

  • model_id
  • tree
  • branch

parameters.DeclareCategory#

Parameters

  • def Dict category definition components

parameters.NormalizeRatio#

Parameters

Returns any n/d

parameters.SetValue#

Sets value of passed parameter id

Parameters

  • id String id of parameter to set value to
  • value Number value to set

Returns any nothing

parameters.SetLocalValue#

Sets value of passed parameter tree.branch.id

Parameters

Returns any nothing

parameters.SetValues#

Sets value of passed parameter id

Parameters

  • desc dict -> {id : id, mle : value}

Returns any nothing

parameters.ConstrainMeanOfSet#

Ensures that the mean of parameters in a set is maintained

Parameters

  • set Dict list of variable ids
  • mean Number desired mean

Returns any nothing

parameters.UnconstrainParameterSet#

Parameters

  • lf LikelihoodFunction the likelihood function to operate on
  • set Matrix set of parameters to unconstrain

Returns any nothing

parameters.Mean#

Returns mean of values

Parameters

  • values Matrix values to return mean of
  • weights Matrix weights to multiply values by
  • d Number does nothing

Returns Number mean

parameters.Quote#

Quotes the argument

Parameters

  • arg String string to be quoted

Returns String string in quotes

parameters.AppendMultiplicativeTerm#

Parameters

  • expression String the matrix to modify
  • term String the multiplier to append

Returns String (expression) * (term)

parameters.AddMultiplicativeTerm#

Parameters

  • matrix Matrix matrix to scale
  • term Number scalar to multiply matrix by
  • do_empties Number if element matrix is empty, fill with term

Returns Matrix New matrix

parameters.StringMatrixToFormulas#

Parameters

  • id String matrix to scale
  • matrix Matrix if element matrix is empty, fill with term

Returns any nothing

parameters.GenerateAttributedNames#

Parameters

parameters.GenerateSequentialNames#

Parameters

Returns Matrix 1 x row vector of generated names

parameters.GetRange#

Parameters

  • id

Returns any variable range

parameters#

parameters.SetRange#

Parameters

  • id
  • ranges

Returns any nothing

parameters.IsIndependent#

Check if parameter is independent

Parameters

  • parameter id of parameter to check

Returns Bool TRUE if independent, FALSE otherwise

parameters.DeclareGlobal#

Parameters

Returns any nothing

parameters.SetConstraint#

sets constraint on parameter

Parameters

  • or String {AssociativeList} id - id(s) of parameter(s) to set constraint on
  • value Number the constraint to set on the parameter
  • global_tag String the global namespace of the parameter

Returns any nothing

parameters.SetProprtionalConstraint#

constrain x to be x := C * (current value of x)

Parameters

  • id String of parameter(s) to set constraint on
  • scaler String variable - the ID of the 'C' scaler variable above; could also be an expression

Returns any nothing

parameters.ConstrainSets#

constraint set of parameters

Parameters

  • set1 AssociativeList -
  • set2 AssociativeList -

Returns any nothing

parameters.RemoveConstraint#

Removes a constraint from a parameter

Parameters

  • id String id of parameter to remove constraint from

Returns any nothing

parameters.helper.copy_definitions#

Copies definitions from target to source

Parameters

  • target Dictionary the target dictionary
  • source Dictionary the source element to copy to target

Returns any nothing

pparameters.SetStickBreakingDistribution#

Parameters

  • parameters AssociativeList
  • values Matrix

Returns any nothing

pparameters.GetStickBreakingDistribution#

Parameters

  • parameters AssociativeList

Returns Matrix computed distribution (Nx2)

parameters.helper.stick_breaking#

Parameters

  • parameters AssociativeList
  • initial_values Matrix

Returns any weights

parameters.helper.dump_matrix#

Prints matrix to screen

Parameters

  • matrix Matrix

Returns any nothing

parameters.helper.tree_lengths_to_initial_values#

Sets tree lengths to initial values

Parameters

  • dict a [0 to N-1] dictrionary of tree objects
  • type codon or nucleotide

Returns Dictionary dictionary of initial branch lengths

parameters.GetProfileCI#

Profiles likelihood function based on covariance precision level

Parameters

  • id String covariance parameter id
  • lf LikelihoodFunction likelihood function to profile
  • null-null Number Covariance precision level

Returns Dictionary a dictionary containing profiling information

parameters.ExportParameterDefinition#

Geneate an HBL string needed to define a parameter

Parameters

  • id String the name of the parameter to export;

Returns String the string for an HBL definition of the parameter e.g. "global x := 2.3; x :> 1; x :< 3"; note that the definition will be NOT recursive, so if x depends on y and z, then y and z need to be exported separately

parameters.SetLocalModelParameters#

Copy local parameters from a node to 'template' variables

Parameters

  • model Dict model description
  • tree String id
  • node String ide.g. set alpha = Tree.Node.alpha set beta = Tree.Node.beta

parameters.SetLocalModelParameters#

Set category variables to their mean values for branch length calculations

Parameters

  • model Dict model description

parameters.ApplyNameSpace#

Applies a namespace to parameter ids

Parameters

parameters.DeclareGlobalWithRanges#

Parameters

  • id String variable id
  • init Number initial value (could be None)
  • lb Number lower bound (could be None)
  • ub Number upper bound (could be None)

Returns any nothing

models.protein.generic.Time#

Parameters

  • option does nothing

Returns any default time

models.protein#

models.protein.generic.DefineQMatrix#

Parameters

  • modelSpec Dictionary
  • namespace String

rate_variation#

alignments.GetSequenceNames#

Get sequence names from existing dataset

Parameters

  • dataset_name String name of dataset to get sequence names from

Returns Matrix list of sequence names

alignments.GetSequenceNames#

Get sequence from existing dataset by name

Parameters

  • dataset_name String name of dataset to get sequence names from
  • sequence_name (String | None) the name of the sequence to extract or None to set up the initial mapping

Returns String the corresponding sequence string

alignments.GetIthSequence#

Get i-th sequence name/value from an alignment

Parameters

  • dataset_name String name of dataset to get sequence names from
  • index String the name of the sequence to extract or None to set up the initial mapping

Returns Dict {"id" : sequence name, "sequence" : sequence data}

alignments.LoadGeneticCode#

Reads dataset from a file path

Parameters

  • code String name - name of the genetic code to load, or None to prompt

Returns Dictionary metadata pertaining to the genetic code

alignments.GetIthSequenceOriginalName#

Get i-th sequence name/value from an alignment; retrieve the original sequence name if available

Parameters

  • dataset_name String name of dataset to get sequence names from
  • index String the name of the sequence to extract or None to set up the initial mapping

Returns Dict {"id" : sequence name, "sequence" : sequence data}

alignments.GetAllSequences#

Get all sequences as "id" : "sequence" dictionary

Parameters

  • dataset_name String name of dataset to get sequence names from

Returns Dict { id -> sequence}

alignments.ReadNucleotideDataSet#

Read Nucleotide dataset from file_name

Parameters

  • dataset_name the name of the dataset you wish to use
  • file_name path to file

Returns Dictionary r - metadata pertaining to the dataset

alignments.FilterType#

Determine what type of data are in the filter

Parameters

  • filter_name String the name of the dataset filter object

Returns String one of the standard datatypes, or the alphabet string if it's non-standard

alignments.ReadProteinDataSet#

Read a protein dataset from file_name

Parameters

  • dataset_name the name of the dataset you wish to use
  • file_name path to file

Returns Dictionary r - metadata pertaining to the dataset

alignments.AlphabetType#

Categorize an alphabet for an alignment

Parameters

  • alphabet the alphabet vector, e.g. fetched by GetDataInfo (alphabet, ..., "CHARACTERS");

Returns String one of standard alphabet types or None if unknown

alignments.EnsureMapping#

Ensure that name mapping is not None by creating a f(x)=x map if needed

Parameters

  • dataset_name the name of the dataset you wish to use
  • r Dictionary metadata pertaining to the dataset
  • file_name path to file

Returns Dictionary r - metadata pertaining to the dataset

alignments.ReadNucleotideDataSetString#

Read dataset from data

Parameters

  • dataset_name String the name of the dataset you wish to use
  • data String the data you wish to parse

Returns Dictionary r - metadata pertaining to the dataset

alignments.PromptForGeneticCodeAndAlignment#

Prompts user for genetic code and alignment

Parameters

  • dataset_name String the name of the dataset you wish to use
  • datafilter_name String the name of the dataset filter you wish to use

Returns Dictionary r - metadata pertaining to the dataset

alignments.LoadGeneticCodeAndAlignment#

Loads genetic code and alignment from file path

Parameters

  • dataset_name String the name of the dataset you wish to use
  • datafilter_name String the name of the dataset filter you wish to use
  • path String path to file

Returns Dictionary r - metadata pertaining to the dataset

alignments.LoadCodonDataFile#

Creates codon dataset filter from data set

Parameters

  • datafilter_name String the name of the dataset filter you wish to use
  • dataset_name String the name of the existing dataset
  • data_info Dictionary DataSet metadata information

Returns Dictionary updated data_info that includes the number of sites, dataset, and datafilter name

alignments.ReadCodonDataSetFromPath#

Reads dataset from a file path

Parameters

  • dataset_name String name of variable you would like to set the dataset to
  • path String path to alignment file

Returns Dictionary r - metadata pertaining to the dataset

alignments.ReadNucleotideAlignment#

Creates nucleotide dataset filter from file

Parameters

  • file_name String The location of the alignment file
  • datafilter_name String the name of the dataset filter you wish to use
  • dataset_name String the name of the dataset you wish to use

Returns Dictionary updated data_info that includes the number of sites, dataset, and datafilter name

alignments.CompressDuplicateSequences#

Take an input filter, replace all identical sequences with a single copy Optionally, rename the sequences to indicate copy # by adding ':copies'

Parameters

  • filter_in String The name of an existing filter
  • filter_out String the name (to be created) of the filter where the compressed sequences will go)
  • rename Bool if true, rename the sequences

Returns any the number of unique sequences

alignments.DefineFiltersForPartitions#

Defines filters for multiple partitions

Parameters

  • partitions Matrix a row vector of dictionaries with partition information containing "name" and "filter-string" attributes
  • source_data DataSet the existing dataset to partition

Returns Matrix filters - a list of newly created dataset filters

alignments.serialize_site_filter#

Parameters

  • data_filter DataFilter
  • site_index Number

Returns String a string representation of data_filter

alignments.ReadCodonDataSet#

Get metadata from existing dataset

Parameters

  • dataset_name id of dataset

Returns Dictionary r - metadata pertaining to the dataset

alignments.ReadCodonDataSetFromPathGivenCode#

Reads a codon dataset from a file path given a genetic code

Parameters

  • dataset_name String name of variable you would like to set the dataset to
  • path String path to alignment file
  • code Matrix genetic code
  • stop_codons String the list of stopcodons

Returns Dictionary r - metadata pertaining to the dataset

#

Parameters

  • sequence String the string to translate
  • offset Number start at this position (should be in {0,1,2})
  • code Dictionary genetic code description (e.g. returned by alignments.LoadGeneticCode)

Returns String the amino-acid translation ('?' is used to represent ambiguities; 'X' - stop codons)

#

Parameters

  • sequence String the string to translate
  • offset Number start at this position (should be in {0,1,2})
  • code Dictionary genetic code description (e.g. returned by alignments.LoadGeneticCode)
  • code lookup resolution lookup dictionary

Returns Dict list of possible amino-acids (as dicts) at this position

#

Parameters

  • sequence String the string to translate
  • code Dictionary genetic code description (e.g. returned by alignments.LoadGeneticCode)
  • code lookup resolution lookup dictionary

Returns Dict for each reading frame F in {0, 1, 2} returnsF -> { terms.data.sequence: translated sequence (always choose X if available, otherwise first sense resolution) terms.sense_codons : N, // number of sense A/A terms.stop_codons : N // number of stop codons }

#

Parameters

  • sequence String the string to translate

Returns String the amino-acid translation ('?' is used to represent ambiguities; 'X' - stop codons)

alignments.Extract_site_patterns#

Parameters

  • data_filter DataFilter

Returns any for a data filter, returns a dictionary like this "pattern id": "sites" : sites (0-based) mapping to this pattern "is_constant" : T/F (is the site constant w/matching ambigs) "0":{ "sites":{ "0":0 }, "is_constant":0 },

    "1":{
      "sites":{
        "0":1
       },
      "is_constant":1
     },...
    "34":{
      "sites":{
        "0":34,
        "1":113
       },
      "is_constant":1
     },
   ...

#

Parameters

  • sequence String the input sequence

Returns String the sequence with all gaps removed

#

Parameters

  • sequence String the input sequence

Returns String the sequence with all gaps removed

#

Parameters

  • codon_sequence String the codon sequence to map
  • aa_sequence String the matching aligned a.a. sequence
  • no Number more than this many mismatches - the codon sequence to map
  • mapping Dict code ["terms.code.mapping"]

Examples

GCAAAATCATTAGGGACTATGGAAAACAGA
-AKSLGTMEN-R

maps to

---GCAAAATCATTAGGGACTATGGAAAAC---AGA

Returns String the mapped sequence

#

ancestral.Sequences#

Parameters

  • ancestral_data Dictionary the dictionary returned by ancestral.build

Returns any { "Node Name" : {String} inferred ancestral sequence, }

ancestral.ComputeSubstitutionCounts#

Parameters

  • ancestral_data Dictionary the dictionary returned by ancestral.build
  • branch_filter Dictionary/Function/None now to determine the subset of branches to count on None -- all branches Dictionary -- all branches that appear as keys in this dict Function -- all branches on which the function (called with branch name) returns 1
  • substitution_filter Function/None how to decide if the substitution should count None -- different characters (except anything vs a gap) yields a 1 Function -- callback (state1, state2, ancestral_data) will return the value
  • site_filter Function/None how to decide which sites will be kept None -- at least one substitution Function -- callback (substitution vector) will T/F

Returns any { "Branches" : {Matrix Nx1} names of selected branches, "Sites" : {Matrix Sx1} indices of sites passing filter, "Counts" : {Matrix NxS} of substitution counts, }N = number of selected branches S = number of sites passing filter

ancestral#

ancestral.build#

Builds ancestral states

Parameters

  • _lfID Number the likelihood function ID
  • _lfComponentID Number -
  • options options -

Returns any an integer index to reference the opaque structure for subsequent operations

distances.nucleotide.tn93#

Compute all pairwise distances between sequences in a data set

Parameters

  • filter {String} - id of dataset
  • freqs {Matrix/null} - if not null, use these nucleotide frequencies
  • options {Dict/null} - options for ambiguity treatment

Returns Matrix r - pairwise TN93 distances

distances.nucleotide.p_distance#

Compute all pairwise percent distances between sequences in a data set

Parameters

  • filter {String} - id of dataset
  • options {Dict/null} - options for ambiguity treatment

Returns Matrix r - pairwise TN93 distances

estimators.FitMGREV#

Parameters

  • codon_data DataFilter
  • tree Tree
  • genetic_code String
  • option Dictionary
  • initial_values Dictionary

Returns any MGREV results

estimators.FitMGREV#

compute the asymptotic (chi^2) p-value for the LRT

Parameters

  • alternative Number log likelihood for the alternative (more general model)
  • Null Number log likelihood for the null
  • df Number degrees of freedom

Returns any p-value

estimators.ComputeLF#

compute the current value of the log likelihood function

Parameters

  • lfid String name of the function

Returns any log likelihood

estimators.CreateInitialGrid#

prepare a Dict object suitable for seeding initial LF values

Parameters

  • values Dict : "parameter_id" -> {{initial values}} [row matrix], e.g. ... "busted.test.bsrel_mixture_aux_0": { {0.1, 0.25, 0.4, 0.55, 0.7, 0.85, 0.9} }, "busted.test.bsrel_mixture_aux_1": { {0.1, 0.25, 0.4, 0.55, 0.7, 0.85, 0.9} } ...
  • N int how many points to sample
  • init Dict/null if not null, taken to be the initial template for variables i.e. random draws will be one index change from this vector

Returns Dict like in{ "0":{ "busted.test.bsrel_mixture_aux_0":{ "ID":"busted.test.bsrel_mixture_aux_0", "MLE":0.4 }, "busted.test.bsrel_mixture_aux_1":{ "ID":"busted.test.bsrel_mixture_aux_1", "MLE":0.7 }, "busted.test.omega1":{ "ID":"busted.test.omega1", "MLE":0.01 }, "busted.test.omega2":{ "ID":"busted.test.omega2", "MLE":0.1 }, "busted.test.omega3":{ "ID":"busted.test.omega3", "MLE":1.5 } } ....

estimators.LHC#

prepare a Dict object suitable for seeding initial LF values based on Latin Hypercube Sampling

Parameters

  • ranges Dict : "parameter_id" -> range, i.e. { lower_bound: 0, upper_bound: 1 }.
  • samples Number : the # of samples to draw

estimators.SetGlobals#

Parameters

Returns any nothing

estimators.SetCategory#

Parameters

Returns any nothing

estimators.ExtractBranchInformation.copy_local#

Parameters

estimators.ExtractBranchInformation#

Parameters

Returns Dictionary branch information

estimators.branch_lengths_in_string#

Parameters

Returns String branch lenghts in tree string

estimators.ExtractMLEs#

Parameters

Returns any results

estimators.TraverseLocalParameters#

Parameters

  • likelihood_function_id String
  • model_descriptions Dictionary
  • callback String (tree, node, parameter_list)

#

Parameters

  • tree_name String
  • model_descriptions Dictionary
  • initial_values Matrix
  • branch_length_conditions

Returns any number of constrained parameters;

#

Parameters

  • likelihood_function_id String
  • model_descriptions Dictionary
  • initial_values Matrix
  • branch_length_conditions

Returns any estimators.ApplyExistingEstimates.df_correction - Abs(estimators.ApplyExistingEstimates.keep_track_of_proportional_scalers);

estimators.GetGlobalMLE#

Parameters

  • results Dictionary
  • tag String

Returns any None

estimators.FitExistingLF#

Fits a LikelihoodFunction

Parameters

  • model_map

Returns any LF results

estimators.FitLF#

Makes a likelihood function object with the desired parameters

Parameters

  • data_filters_list Matrix a vector of {DataFilter}s
  • tree_list Matrix a vector of {Tree}s
  • model_map
  • initial_values

Returns any LF results

estimators.FitLF#

Fits a LikelihoodFunction

Parameters

  • data_filters_list Matrix a vector of {DataFilter}s
  • tree_list Matrix a vector of {Tree}s
  • model_map
  • initial_values

Returns any LF results

estimators.GetBranchEstimates#

Parameters

Returns any None

estimators.TakeLFStateSnapshot#

Parameters

Returns Dict parameter -> {"MLE" : value, "constraint" : string (if present)}

estimators.GetGlobalMLE_RegExp#

Extract global scope parameter estimates that match a regular expression

Parameters

  • results Dictionary
  • regular String expression to match

Returns Dict parameter description : value (could be empty)

estimators.FitSingleModel_Ext#

Parameters

  • data_filter DataFilter
  • tree Tree
  • model Dict
  • initial_values Matrix
  • run_options Dict

Returns any results

estimators.FitGTR_Ext#

Parameters

  • data_filter DataFilter
  • tree Tree
  • initial_values Matrix
  • run_options Dict

Returns any results

estimators.FitGTR#

Parameters

  • data_filter DataFilter
  • tree Tree
  • initial_values Matrix

Returns any results

estimators.FitCodonModel#

Parameters

  • codon_data DataFilter
  • tree Tree
  • genetic_code String
  • option Dictionary
  • initial_values Dictionary

Returns any MGREV results

genetic_code.DefineCodonToAAMapping#

genetic_code.DefineCodonToAAMapping

Parameters

  • code AssociativeList the nucleotide to codon mapping

Returns any returns ordered codon to amino acid map

genetic_code.DefineCodonToAAMapping#

genetic_code.DefineIntegerToAAMapping

Parameters

  • code AssociativeList the nucleotide to codon mapping
  • only_sense Boolean if true, do not include stop codons in mapping

Returns any returns an integer to AA map { "0" : "K" .. "60" : "F" }

genetic_code.IsStop#

genetic_code.IsStop

Parameters

  • codon Number (a number between 0 and 63 in AAA...TTT encoding)
  • code Number the genetic code

Returns any whether or not the codon is a stop codon

#

genetic_code.DefineCodonToAAGivenCode#

genetic_code.DefineCodonToAAGivenCode

Parameters

  • code AssociativeList the nucleotide to codon mapping

Returns any the amino acid map

genetic_code#

#

trees._matrix2string#

Convert a matrix representation of a tree into Newick

Parameters

  • matrix_form Matrix : Kx3 matrix; each row represents ?
  • N Number : number of leaves
  • names Matrix/Dict : leaf index -> name
  • do_lengths Bool : include branch lengths in the output

Returns String newick tree string

trees.GetTreeString#

Looks for a newick tree in an alignment file

Parameters

  • look_for_newick_tree (String | Bool) If a string, sanitizes and returns the string. If TRUE, search the alignment file for a newick tree. If FALSE, the user will be prompted for a nwk tree file.

Returns String a newick tree string

trees.PartitionTree#

Partitions a tree by assigning nodes to either being internal or leaf

Parameters

  • avl Dictionary an AVL representation of the tree to be partitioned

Returns any nothing

trees.LoadAnnotatedTopology#

Loads an annatotaed tree topology from a newick tree

Parameters

  • look_for_newick_tree (String | Bool) If a string, sanitizes and returns the string. If TRUE, search the alignment file for a newick tree. If FALSE, the user will be prompted for a nwk tree file.

Returns Dictionary an annotated tree

trees.LoadAnnotatedTopologyAndMap#

Parameters

  • dataset_name

Returns Dictionary an annotated tree

trees.LoadAnnotatedTreeTopology.match_partitions#

Loads a tree topology with node name label mappings and annotations from a list of partitions

Parameters

  • partitions Matrix a 1xN vector of partition names, typically retrieved from the partitions key in the dictionary returned from an alignments parser function.
  • mapping Dictionary a mapping of node names to labels

Examples

hky85_nucdata_info = alignments.ReadNucleotideAlignment(file_name, "hky85.nuc_data", "hky85.nuc_filter");
 name_mapping = {
  "HUMAN":"HUMAN",
  "CHIMP":"CHIMP",
  "BABOON":"BABOON",
  "RHMONKEY":"RHMONKEY",
  "COW":"COW",
  "PIG":"PIG",
  "HORSE":"HORSE",
  "CAT":"CAT",
  "MOUSE":"MOUSE",
  "RAT":"RAT"
 };
 trees.LoadAnnotatedTreeTopology.match_partitions(hky85_nucdata_info[terms.json.partitions], name_mapping);
 =>
 {
  "0":{
    "name":"default",
    "filter-string":"",
    "tree": *    }
 }

Returns Dictionary of matched partitions

trees.branch_names#

Parameters

  • tree
  • respect_case

Returns any result

trees.RootTree#

Parameters

  • tree_info Dict
  • root String on this node (or prompt if empty)

Returns any a {Dictionary} (same as ExtractTreeInfo) for the rerooted tree

trees.ExtractTreeInfo#

Parameters

Returns any a {Dictionary} of the following tree information :- newick string - newick string with branch lengths - annotated string - model map - internal leaves - list of models

trees.HasBranchLengths#

Parameters

  • tree Dictionary information object (e.g. as returned by LoadAnnotatedTopology)

Returns any a {Boolean} to indicate whether the tree has a valid branch length array

trees.BootstrapSupport#

Parameters

  • tree Dictionary information object (e.g. as returned by LoadAnnotatedTopology)

Returns any a {Dictionary} (could be empty or partially filled) with "node name" -> bootstrap support

trees.GetBranchCount#

Gets total branch count of supplied tree

Parameters

Returns Number total branch count

trees.SortedBranchLengths#

Sorts branch lengths in a descending order

Parameters

Returns Number total branch count

trees.BranchNames#

Return branch names

Parameters

Returns Matrix 1xN sorted branch names

trees.ParsimonyLabel#

Compute branch labeling using parsimony

Parameters

  • tree String ID
  • leaf Dict -> label labels may be missing for some of the leaves to induce partial labeling of the tree

Returns Dict {"score" : value, "labels" : Internal Branch -> label}

trees.ParsimonyLabel#

Annotate a tree string with using user-specified labels

Parameters

  • tree String ID
  • node_name Dict/String -> label OR (if string) (node_name) => name + annotation
  • a String pair of characters to enclose the label in
  • node_name Dict/String -> length OR (if string) (node_name) => length annotation

Returns String annotated string

trees.ConjunctionLabel#

Compute branch labeling using conjunction, i.e. node N is labeled 'X' iff all of the nodes that are in the subtree rooted at 'N' are also labeled 'N'

Parameters

  • tree String ID
  • leaf Dict -> label labels may be missing for some of the leaves to induce partial labeling of the tree

Returns Dict {"labeled" : # of labeled internal nodes, "labels" : Internal Branch -> label}

trees.GenerateSymmetricTree#

Generate a symmetric binary tree on N leaves (only perfectly symmetric if N is a power of 2)

Parameters

  • N Number : number of leavers
  • rooted Bool : whether the tree is rooted
  • branch_name None/String : if a string, then it is assumed to be a function with an integer argument (node index) that generates branch names default is to use numeric names
  • branch_length None/String : if a string, then it is assumed to be a function with no arguments that generates branch lengths

Returns String Newick tree string

trees.GenerateSymmetricTree#

Generate a ladder tree on N leaves

Parameters

  • N Number : number of leavers
  • rooted Bool : whether the tree is rooted
  • branch_name None/String : if a string, then it is assumed to be a function with an integer argument (node index) that generates branch names default is to use numeric names
  • branch_length None/String : if a string, then it is assumed to be a function with no arguments that generates branch lengths

Returns String Newick tree string

trees#

trees.infer.NJ#

Infer a neighbor joining tree from a data filter using a specific distance

Parameters

  • datafilter String the ID of an existing datafilter
  • null null/String/Matrix , null : use the default distance calculation appropriate for the datatype String : a callback which takes (filter_id, seq1, seq2) arguments and returns d(seq1,seq2) Matrix : a precomputed distance matrix (same order of rows/column as datafilter names)

Returns String inferred tree string