-
Notifications
You must be signed in to change notification settings - Fork 10
/
discoalFunctions.h
92 lines (70 loc) · 3.79 KB
/
discoalFunctions.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef __DISCOAL_H__
#define __DISCOAL_H__
void initialize();
rootedNode *newRootedNode(double cTime, int popn);
void coalesceAtTimePopn(double cTime, int popn);
void coalesceAtTimePopnSweep(double cTime, int popn, int sp);
void migrateAtTime(double cTime,int srcPopn, int destPopn);
void migrateExceptSite(double site, double scalar, int srcPopn, int destPopn);
int recombineAtTimePopnSweep(double cTime, int popn, int sp, double sweepSite, double popnFreq);
int recombineToLeftPopnSweep(int popn, int sp, double popnFreq);
void geneConversionAtTimePopnSweep(double cTime, int popn, int sp, double sweepSite, double popnFreq);
void updateActiveMaterial(rootedNode *aNode);
int isActive(int site);
int isAncestralHere(rootedNode *aNode, float site);
int nAncestorsHere(rootedNode *aNode, float site);
int siteBetweenChunks(rootedNode *aNode, int xOverSite);
void dropMutations();
void addMutation(rootedNode *aNode, double site);
int hasMutation(rootedNode *aNode, double site);
void makeGametesMS(int argc,const char *argv[]);
void dropMutationsRecurse();
void recurseTreePushMutation(rootedNode *aNode, float site);
void errorCheckMutations();
void mergePopns(int popnSrc, int popnDest);
void admixPopns(int popnSrc, int popnDest1, int popnDest2, double admixProp);
void addAncientSample(int lineageNumber, int popnDest, double addTime, int stillSweeping, double currentFreq);
void recurrentMutAtTime(double cTime,int srcPopn, int sp);
double sweepPhaseEventsGeneralPopNumber(int *bpArray, double startTime, double endTime, double sweepSite,\
double initialFreq, double *finalFreq, int *stillSweeping, double alpha,\
double *sizeRatio, char sweepMode,double f0, double uA);
double recurrentSweepPhaseGeneralPopNumber(int *bpArray,double startTime, double endTime, double *finalFreq, double alpha, char sweepMode, double *sizeRatio);
double proposeTrajectory(int currentEventNumber, float *currentTrajectory, double *sizeRatio, char sweepMode, \
double initialFreq, double *finalFreq, double alpha, double f0, double currentTime);
double sweepPhaseEventsConditionalTrajectory(int *bpArray, double startTime, double endTime, double sweepSite,\
double initialFreq, double *finalFreq, int *stillSweeping, double alpha,\
double *sizeRatio, char sweepMode,double f0, double uA);
double totalTimeInTree();
void dropMutationsUntilTime(double t);
double totalTimeInTreeUntilTime(double t);
int recombineAtTimePopn(double cTime, int popn);
void geneConversionAtTimePopn(double cTime, int popn);
double neutralPhase(int *bpArray,double startTime, double endTime, double sizeRatio);
double neutralPhaseMig(int *bpArray,double startTime, double endTime, double sizeRatio);
double neutralPhaseMigExclude(int *bpArray,double startTime, double endTime, double sizeRatio, double selSite, double migScale);
double neutralPhaseGeneralPopNumber(int *bpArray,double startTime, double endTime, double *sizeRatio);
rootedNode *pickNodePopn(int popn);
void addNode(rootedNode *aNode);
void removeNodeAt(int index);
void removeNode(rootedNode *aNode);
void addNodeAtIndex(rootedNode *aNode, int anIndex);
void shiftNodes(int offset);
void printNode(rootedNode *aNode);
void freeTree(rootedNode *aNode);
int nodePopnSize(int popn);
int nodePopnSweepSize(int popn, int sp);
rootedNode *pickNodePopnSweep(int popn,int sp);
int compare_events(const void *a,const void *b);
void sortEventArray(struct event *eArray, int eNumber);
int findRootAtSite(float site);
int hasMaterialHere(rootedNode *aNode, float site);
int isLeaf(rootedNode *aNode);
int isCoalNode(rootedNode *aNode);
void newickRecurse(rootedNode *aNode, float site,float tempTime);
void printTreeAtSite(float site);
void printAllNodes();
void printAllActiveNodes();
unsigned int devrand(void);
int compare_doubles(const void *a,const void *b);
int compare_floats(const void *a,const void *b);
#endif