-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetadata.h
89 lines (66 loc) · 3.12 KB
/
metadata.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
/**
* @file metadata.h
* @brief header file for metadata.cpp
* @details contains metadata data structure (metadata_t) and associated functions
*/
#ifndef __METADATA_H__
#define __METADATA_H__
/* INCLUDES ----------------------------------------------------------------- */
/* END-OF-INCLUDES ---------------------------------------------------------- */
/* FORWARD-DECLARATIONS ----------------------------------------------------- */
typedef struct metadata_t metadata_t;
typedef struct paramStruct paramStruct;
typedef struct strArray strArray;
typedef struct size_tArray size_tArray;
/* END-OF-FORWARD-DECLARATIONS ---------------------------------------------- */
/* MACROS ------------------------------------------------------------------- */
/* END-OF-MACROS ------------------------------------------------------------ */
/* TYPEDEF-STRUCTS ---------------------------------------------------------- */
/// @note
/// each new group name is added to groupNames and is given a group identifier index
///
/// number of groups at level i = level2groupIndices[i]->len
/// index of the i-th group at level j = level2groupIndices[j]->d[i]
///
/// number of pairs of individuals that belong to group with index i = group2pairIndices[i]->len
/// array of pairs of individuals (pair indices) that belong to the group with index i = group2pairIndices[i]->d
///
/// number of individuals that belong to group with index i = group2indIndices[i]->len
/// array of individuals that belong to the group with index i = group2indIndices[i]->d
///
/// number of groups that are subgroups of the group with index i = group2subgroupIndices[i]->len
/// array of groups that are subgroups of the group with index i = group2subgroupIndices[i]->d
///
struct metadata_t {
// total number of levels
// e.g. individual, region, population, subpopulation
// nLevels = 4
int nLevels;
int nGroups;
int nInd;
// \def levelNames->d[nLevels]
// names of levels in the hierarchy (e.g. region, population, subpopulation, individual)
// in the hierarchical order
// e.g. formula: "Individual ~ Region/Population/Subpopulation"
// levelNames = {"Region","Population","Subpopulation","Individual"}
strArray* levelNames;
// \def indNames->d[nInds]
// indNames->d[i] = name of individual i (char *)
/// @note free iff metadata==NULL && PROGRAM_HAS_INPUT_VCF ; else it is ptr to metadata->indNames
strArray* indNames;
// \def groupNames->d[nGroups]
// N.B. does not contain individual names
strArray* groupNames;
size_tArray** level2groupIndices;
size_tArray* group2levelIndices;
size_tArray** group2indIndices;
size_tArray** group2pairIndices;
size_tArray** group2subgroupIndices;
};
/* END-OF-TYPEDEF-STRUCTS --------------------------------------------------- */
/* FUNCTION-DECLARATIONS ----------------------------------------------------- */
metadata_t* metadata_init(const int in_nLevels);
metadata_t* metadata_read(paramStruct* pars);
void metadata_destroy(metadata_t* mtd);
/* END-OF-FUNCTION-DECLARATIONS ---------------------------------------------- */
#endif // __METADATA_H__