[go: up one dir, main page]

File: model.h

package info (click to toggle)
andi 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 988 kB
  • sloc: ansic: 2,296; sh: 426; cpp: 99; makefile: 76; awk: 51
file content (67 lines) | stat: -rw-r--r-- 1,562 bytes parent folder | download | duplicates (2)
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
/** @file
 * @brief This header contains all structures and prototypes for creating a
 * mutation matrix and estimating distances trough an evolutionary model
 * thereof.
 */
#pragma once

#include <stdlib.h>

/**
 * This enum contains all possible mutations. The total number
 * of different possible mutations is MUTCOUNTS.
 */
enum {
	AtoA,
	AtoC,
	AtoG,
	AtoT,
	CtoA,
	CtoC,
	CtoG,
	CtoT,
	GtoA,
	GtoC,
	GtoG,
	GtoT,
	TtoA,
	TtoC,
	TtoG,
	TtoT,
	MUTCOUNTS
};

/** @brief The mutation matrix.
 *
 * We need to keep track of the different types of mutations between two
 * sequences. For this the following matrix is filled.
 *
 *  To   A  C  G  T
 * From
 *  A  (            )
 *  C  (            )
 *  G  (            )
 *  T  (            )
 *
 * The cells are absolute counts. Together with seq_len (the query length),
 * we can deduce the substitution rate and coverage.
 *
 * As libdivsufsort is 32 bit the sequence length is limited to (INT_MAX-1)/2.
 * We can thus use the same limit for the counts.
 */
typedef struct model {
	/** The absolute counts of mutation types. */
	unsigned int counts[MUTCOUNTS];
	/** The query length. */
	unsigned int seq_len;
} model;

void model_count_equal(model *, const char *, size_t);
void model_count(model *, const char *, const char *, size_t);
model model_average(const model *, const model *);
double model_coverage(const model *);
double estimate_RAW(const model *);
double estimate_JC(const model *);
double estimate_KIMURA(const model *);
double estimate_LOGDET(const model *);
model model_bootstrap(model);