-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathancestryVerify.c
More file actions
35 lines (28 loc) · 876 Bytes
/
ancestryVerify.c
File metadata and controls
35 lines (28 loc) · 876 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include "ancestryVerify.h"
extern rootedNode **allNodes;
extern int totNodeNumber;
int verifyAncestryConsistency(rootedNode *node, int nSites) {
if (!node) return 1;
// Only verify tree structure now that ancSites is removed
if (node->ancestryRoot) {
// Could add tree consistency checks here if needed
// For now, just verify the tree exists
return 1;
}
// No ancestry tree is OK for some nodes
return 1;
}
void verifyAllNodes(int nSites) {
int errors = 0;
for (int i = 0; i < totNodeNumber; i++) {
if (allNodes[i] && !verifyAncestryConsistency(allNodes[i], nSites)) {
errors++;
}
}
if (errors > 0) {
fprintf(stderr, "VERIFICATION FAILED: %d nodes have inconsistent ancestry\n", errors);
exit(1);
}
}