Skip to content
Browse files

Merge pull request #383 from nextstrain/min-clades-for-tree-frequencies

Parameterize size of clades to estimate by diffusion frequency likelihood
  • Loading branch information...
huddlej committed Oct 17, 2019
2 parents abe930b + ef48dea commit 390b9071ee6fdc8718e03f8bd17af124607838a6
Showing with 10 additions and 5 deletions.
  1. +8 −3 augur/
  2. +2 −2 augur/
@@ -32,8 +32,6 @@ def register_arguments(parser):
help="tree to estimate clade frequencies for")
parser.add_argument("--include-internal-nodes", action="store_true",
help="calculate frequencies for internal nodes as well as tips")
parser.add_argument('--minimal-clade-size', type=int, default=0,
help="minimal size of a clade to have frequencies estimated")

# Alignment-specific arguments
parser.add_argument('--alignments', type=str, nargs='+',
@@ -54,6 +52,12 @@ def register_arguments(parser):
parser.add_argument("--censored", action="store_true", help="calculate censored frequencies at each pivot")

# Diffusion frequency specific arguments
parser.add_argument('--minimal-clade-size', type=int, default=0,
help="minimal number of tips a clade must have for its diffusion frequencies to be reported")
parser.add_argument('--minimal-clade-size-to-estimate', type=int, default=10,
help="""minimal number of tips a clade must have for its diffusion frequencies to be estimated
by the diffusion likelihood; all smaller clades will inherit frequencies from their
parser.add_argument("--stiffness", type=float, default=10.0, help="parameter penalizing curvature of the frequency trajectory")
parser.add_argument("--inertia", type=float, default=0.0, help="determines how frequencies continue "
"in absense of data (inertia=0 -> go flat, inertia=1.0 -> continue current trend)")
@@ -116,7 +120,8 @@ def run(args):
tree_freqs = tree_frequencies(tree, pivots, method='SLSQP',
node_filter = node_filter_func,
ws = max(2, tree.count_terminals()//10),
stiffness = stiffness, inertia=inertia)
stiffness = stiffness, inertia=inertia,


@@ -436,7 +436,7 @@ class that estimates frequencies for nodes in the tree. each internal node is as
will be numbered in preorder. Each node is assumed to have an attribute `attr` with a
key "num_date".
def __init__(self, tree, pivots, node_filter=None, min_clades = 20, verbose=0, pc=1e-4, **kwargs):
def __init__(self, tree, pivots, node_filter=None, min_clades=10, verbose=0, pc=1e-4, **kwargs):
set up the internal tree, the pivots and cutoffs
@@ -458,7 +458,7 @@ def __init__(self, tree, pivots, node_filter=None, min_clades = 20, verbose=0, p
self.tree = tree
self.min_clades = 10 #min_clades
self.min_clades = min_clades
self.pivots = pivots
self.kwargs = kwargs
self.verbose = verbose

0 comments on commit 390b907

Please sign in to comment.
You can’t perform that action at this time.