-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNodeEvolution.py
executable file
·66 lines (56 loc) · 1.72 KB
/
NodeEvolution.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/env python3
'''
Niema Moshiri 2016
"NodeEvolution" module
'''
import abc
class NodeEvolution(metaclass=abc.ABCMeta):
'''
Abstract class defining the ``NodeEvolution`` module
Methods
-------
cite()
Return citation string (or None)
evolve_to_current_time(node)
Simulate phylogeny evolution on ``node''
init()
Initialize the module (if need be)
'''
@staticmethod
@abc.abstractmethod
def init():
'''
Initialize the module (if need be)
'''
pass
@staticmethod
@abc.abstractmethod
def cite():
'''
Return citation string (or None)
Returns
-------
citation : str
The citation string (or None)
'''
pass
@staticmethod
@abc.abstractmethod
def evolve_to_current_time(node, finalize=False):
'''
Simulate phylogeny evolution on ``node'' until FAVITES_Global.time.
Should be able to be run in a continuing manner. In other words, if I
first call ``evolve_to_current_time(node)'' on a node that has not been
evolved yet, the resulting tree(s) should be from time 0 (root) to the
current time (i.e., the tree height should be the current time). Then,
on the same node, if I later call ``evolve_to_current_time(node)'', the
node's tree(s) should continue from where they left off last time and
evolve until the current time.
If finalize == True, that means we have finalized the transmission
network, so evolve to final time.
Parameters
----------
node : ContactNetworkNode
``ContactNetworkNode'' object to evolve
'''
pass