forked from aquaskyline/16GT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSNP_Meta.h
175 lines (141 loc) · 3.39 KB
/
SNP_Meta.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#ifndef _SNP_META_H_
#define _SNP_META_H_
#include <stdio.h>
#include <stdlib.h>
#include "definitions.h"
#define ALPHABET_SIZE 4
#define MAX_SEQ_NAME_LENGTH 256
#define SNP_META_WINDOW_SIZE (100)
#define MAX_PATTERN_LENGTH 1024
#define GENOTYPE_16
#ifdef GENOTYPE_10
#define GENOTYPE_NUM 10
#define COUNTER_NUM (ALPHABET_SIZE)
#endif
#ifdef GENOTYPE_16
#define GENOTYPE_NUM 16
#define COUNTER_NUM (ALPHABET_SIZE + 2)
#endif
#define UNIDENTIFIED_GENOTYPE GENOTYPE_NUM
typedef struct InputStat
{
unsigned int W[COUNTER_NUM];
unsigned int F[COUNTER_NUM];
unsigned int R[COUNTER_NUM];
unsigned int outW[COUNTER_NUM];
unsigned int outF[COUNTER_NUM];
unsigned int outR[COUNTER_NUM];
} InputStat;
typedef struct GenotypeInputStat
{
unsigned short W[COUNTER_NUM];
} GenotypeInputStat;
typedef struct OutputStat
{
float Genotype_Likelihood[GENOTYPE_NUM];
float Strand_Bias[ALPHABET_SIZE];
float Base_Quality_Bias[ALPHABET_SIZE];
} OutputStat;
#pragma pack(1)
typedef struct MetaReference
{
unsigned int amb;
char refChar;
char chrName[MAX_SEQ_NAME_LENGTH + 1];
unsigned long long chrPos;
} MetaReference;
#pragma pack()
typedef InputStat MetaSnpCounter;
typedef struct GenotypeLikelihood
{
double likelihood[GENOTYPE_NUM];
} GenotypeLikelihood;
typedef struct StrandBias
{
float bias[ALPHABET_SIZE];
} StrandBias;
typedef struct BaseQualityBias
{
float bias[ALPHABET_SIZE];
} BaseQualityBias;
typedef struct ReadPositionBias
{
float lrRatio;
} DeltaStrandCount;
typedef struct AverageStrandCount
{
float lrRatio;
} AverageStrandCount;
struct LeftRightFloatCount
{
float left;
float right;
};
struct LeftRightShortCount
{
unsigned short left;
unsigned short right;
};
struct LeftRightCharCount
{
unsigned char left;
unsigned char right;
};
typedef struct LeftRightFloatCount GCCount;
typedef struct LeftRightFloatCount AverageDepth;
typedef struct LeftRightFloatCount ReadQuality;
typedef struct LeftRightCharCount GCount;
typedef struct SnpCallingInfo
{
double pD;
int genotype;
int secondGenotype;
double flh[GENOTYPE_NUM];
double bestD;
double secondD;
float rfProb;
int rfMode;
} SnpCallingInfo;
typedef struct IncExcList
{
unsigned int amb;
char refChar;
char altChar[5];
} IncExcList;
#pragma pack(1)
typedef struct MetaWindowInfo
{
unsigned int weightedCount;
unsigned int posStrandCount;
unsigned int negStrandCount;
unsigned char gcStrandCount;
unsigned char gStrandCount;
unsigned short polyrun;
unsigned int indelHqCount;
unsigned int indelLqCount;
char isValid;
char preBase;
} MetaWindowInfo;
#pragma pack()
typedef struct IndelInfo
{
unsigned char *array;
unsigned int size;
unsigned int limit;
} IndelInfo;
__inline__ void checkIndelInfoSpace ( IndelInfo *indelInfo, unsigned int nextSize )
{
if ( indelInfo->size + nextSize > indelInfo->limit )
{
indelInfo->limit *= 2;
indelInfo->array = ( unsigned char * ) realloc ( indelInfo->array, indelInfo->limit * sizeof(unsigned char) );
}
}
__inline__ void jumpIndelInfoIndex ( IndelInfo *indelInfo, unsigned int &indelInfoIndex )
{
indelInfoIndex++;
unsigned char indelLength = indelInfo->array[indelInfoIndex++];
indelInfoIndex += ( indelLength + 3 ) / 4;
indelInfoIndex += 4;
}
#endif