-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathancestryWrapper.h
More file actions
32 lines (24 loc) · 1000 Bytes
/
ancestryWrapper.h
File metadata and controls
32 lines (24 loc) · 1000 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
#ifndef __ANCESTRY_WRAPPER_H__
#define __ANCESTRY_WRAPPER_H__
#include "discoal.h"
// Wrapper functions for ancestry tree operations
// Get ancestry count at a site
static inline uint16_t getAncestryAt(rootedNode *node, int site) {
return node->ancestryRoot ? getAncestryCount(node->ancestryRoot, site) : 0;
}
// Note: Setting ancestry at individual sites is no longer supported
// Ancestry is managed through tree merge/split operations
// Check if site has any ancestry
static inline int hasAncestryAt(rootedNode *node, int site) {
return getAncestryAt(node, site) > 0;
}
// Check if site is polymorphic (has ancestry but not fixed)
static inline int isPolymorphicAt(rootedNode *node, int site, int sampleSize) {
uint16_t count = getAncestryAt(node, site);
return count > 0 && count < sampleSize;
}
// Check if site is fixed (MRCA reached)
static inline int isFixedAt(rootedNode *node, int site, int sampleSize) {
return getAncestryAt(node, site) == sampleSize;
}
#endif