forked from HongzheGuo/deBGA
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathLandauVishkin.h
133 lines (110 loc) · 3.93 KB
/
LandauVishkin.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
// Computes the edit distance between two strings and returns a CIGAR string for the edits.
#include <stdlib.h>
#include "bit_operation.h"
//#define LV_INI
#define LV_MP
#define bool int
#define _ASSERT assert
#define _uint64 uint64_t
#define CountTrailingZeroes(x, ans) do{ans = __builtin_ctzll(x);} while(0)
#define __min(a, b) (a<b?a:b)
#define MAX_K 720
//500
//410
//820
//65
//129
#define true 1
#define false 0
//short L[MAX_K+1][2*MAX_K +1];
short L[32][MAX_K+1][2*MAX_K +1];
short L_mis[32][MAX_K+1][2*MAX_K +1];
/*
typedef enum {
COMPACT_CIGAR_STRING = 0,
EXPANDED_CIGAR_STRING = 1,
COMPACT_CIGAR_BINARY = 2,
} CigarFormat;
*/
int InitiateLVCompute(short L[32][MAX_K+1][2*MAX_K+1], short thread_n);
int computeEditDistance(
const char* text, int textLen,
const char* pattern, int patternLen,
int k, short L[MAX_K+1][2*MAX_K+1]);
int computeEditDistanceWithCigar(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen, bool useM,
short L[MAX_K+1][2*MAX_K+1]);//CigarFormat format,
int computeEditDistance_s(
const char* text, int textLen,
const char* pattern, int patternLen,
int k, short L[MAX_K+1][2*MAX_K+1], int* s_position);
int computeEditDistanceWithCigar_s(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1]);// bool useM, CigarFormat format,
int computeEditDistanceWithCigar_s_nm(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], int* nm_score);
int computeEditDistance_mis(
const char* text, int textLen,
const char* pattern, int patternLen,
int k, short L[MAX_K+1][2*MAX_K+1], uint8_t* quality);
int computeEditDistance_mis_s(
const char* text, int textLen,
const char* pattern, int patternLen,
int k, short L[MAX_K+1][2*MAX_K+1], uint8_t* quality, int16_t* s_position);
int computeEditDistance_misboth(
const char* text, int textLen,
const char* pattern, int patternLen,
int k, short L[MAX_K+1][2*MAX_K+1], short L_mis[MAX_K+1][2*MAX_K+1], uint8_t* quality, uint16_t* mis_n);
int computeEditDistanceWithCigar_s_mis(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], uint8_t* quality);
int computeEditDistanceWithCigar_s_mis_left(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], uint8_t* quality, uint16_t* s_offset);
int computeEditDistanceWithCigar_s_left(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], uint16_t* s_offset);
//for mapping quality
int computeEditDistanceWithCigar_s_mp(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], float* mp_subs, float* sub_t);
int computeEditDistanceWithCigar_s_mis_mp(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], uint8_t* quality, float* mp_subs, float* sub_t);
int computeEditDistanceWithCigar_s_mis_left_mp(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], uint8_t* quality, uint16_t* s_offset, float* mp_subs, float* sub_t);
int computeEditDistanceWithCigar_s_nm_left(
const char* text, int textLen,
const char* pattern, int patternLen,
int k,
char *cigarBuf, int cigarBufLen,
short L[MAX_K+1][2*MAX_K+1], int* nm_score, uint16_t* s_offset);