Haplo Prediction
predict haplogroups
Enumerations | Functions
haplo_groups.h File Reference

Provides a mapping between haplo groups and their sequential ordering. More...

#include <config.h>
#include <stdlib.h>
#include <inttypes.h>
#include <jwsc/base/error.h>
#include <jwsc/vector/vector.h>

Go to the source code of this file.

Enumerations

enum  Haplo_ancestor_type { HAPLO_ANCESTOR_NONE = 0, HAPLO_ANCESTOR_DIRECT, HAPLO_ANCESTOR_INDIRECT }
 Type of ancestry relating two haplo groups. More...

Functions

Errorread_haplo_groups (const char *fname)
 Reads the haplo groups from a file.
Errorlookup_haplo_group_index_from_label (uint32_t *index_out, const char *label)
 Looks up the index for a haplo group based on its label.
Errorlookup_haplo_group_label_from_index (const char **label_out, uint32_t index)
 Looks up a haplo group label from its index.
Errorlookup_haplo_group_ancestor_index_from_haplo_group_index (uint32_t *index_out, uint32_t index)
 Looks up the index of the immediate ancestor for the haplogroup specified by the index.
uint32_t get_num_haplo_groups ()
 Returns the number of haplo groups represented.
uint8_t is_ancestor (uint32_t index_1, uint32_t index_2)
 Returns whether a haplo group label is an ancestor of another.
Haplo_ancestor_type find_ancestor_index_of_pair (uint32_t *index_out, uint32_t index_1, uint32_t index_2)
 Finds the lowest common ancestor between two haplo group labels.
Haplo_ancestor_type find_ancestor_index_of_set (uint32_t *index_out, const Vector_u32 *indices)
 Finds the lowest common ancestor between a set of haplo group labels.

Detailed Description

Provides a mapping between haplo groups and their sequential ordering.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file haplo_groups.h.


Enumeration Type Documentation

Type of ancestry relating two haplo groups.

Enumerator:
HAPLO_ANCESTOR_NONE 
HAPLO_ANCESTOR_DIRECT 
HAPLO_ANCESTOR_INDIRECT 

Definition at line 60 of file haplo_groups.h.


Function Documentation

Error* read_haplo_groups ( const char *  fname)

Reads the haplo groups from a file.

The file is expected to be a valid xml document according to haplo.dtd.

Parameters:
fnameFile to read the haplo groups from.
Returns:
On success, NULL is returned; otherwise an Error is returned.

Definition at line 324 of file haplo_groups.c.

Error* lookup_haplo_group_index_from_label ( uint32_t *  index_out,
const char *  label 
)

Looks up the index for a haplo group based on its label.

Parameters:
index_outResult parameter.
labelHaplo group label to look-up the sequential index for.
Returns:
On success, NULL is returned; otherwise an Error is returned.

Definition at line 384 of file haplo_groups.c.

Error* lookup_haplo_group_label_from_index ( const char **  label_out,
uint32_t  index 
)

Looks up a haplo group label from its index.

Parameters:
label_outResult parameter.
indexIndex representing one of the haplo groups.
Returns:
On success, NULL is returned; otherwise an Error is returned.

Definition at line 414 of file haplo_groups.c.

Error* lookup_haplo_group_ancestor_index_from_haplo_group_index ( uint32_t *  index_out,
uint32_t  index 
)

Looks up the index of the immediate ancestor for the haplogroup specified by the index.

Definition at line 440 of file haplo_groups.c.

uint32_t get_num_haplo_groups ( )

Returns the number of haplo groups represented.

Returns:
The number of haplo groups represented.

Definition at line 484 of file haplo_groups.c.

uint8_t is_ancestor ( uint32_t  index_1,
uint32_t  index_2 
)

Returns whether a haplo group label is an ancestor of another.

Parameters:
index_1Index whose ancestors are to be searched.
index_2Index to test if it is an ancestor of index_1.
Returns:
If index_2 is an ancestor of index_1, 1 is returned; otherwise 0.

Definition at line 594 of file haplo_groups.c.

Haplo_ancestor_type find_ancestor_index_of_pair ( uint32_t *  index_out,
uint32_t  index_1,
uint32_t  index_2 
)

Finds the lowest common ancestor between two haplo group labels.

Parameters:
index_outResult parameter.
index_1Index of haplo label to find the common ancestor of.
index_2Index of haplo label to find the common ancestor of.
Returns:
A value of Haplo_ancestor_type.

Definition at line 608 of file haplo_groups.c.

Haplo_ancestor_type find_ancestor_index_of_set ( uint32_t *  index_out,
const Vector_u32 indices 
)

Finds the lowest common ancestor between a set of haplo group labels.

Parameters:
index_outResult parameter.
indicesSet of indices to find the common ancestor of.
Returns:
A value of Haplo_ancestor_type.

Definition at line 639 of file haplo_groups.c.