forked from aquaskyline/MICA-aligner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMIC-DPCore.h
103 lines (82 loc) · 3.12 KB
/
MIC-DPCore.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
//
// MIC-DPCore.h
//
// MICA
//
// Copyright (C) 2012, HKU
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
///////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
/*
Modification History
Date : 18th September 2013
Author : shchan
Change : Added soft clipping
Date : 4th July 2013
Author : shchan
Change : New file.
*/
/////////////////////////////////////////////////////
#include "2bwt-flex/DPCore.h"
#ifndef __MIC_DPCORE_H__
#define __MIC_DPCORE_H__
#define MIC_DP_TRACE_M 1
#define MIC_DP_TRACE_I 2
#define MIC_DP_TRACE_D 3
#define MIC_DP_TRACE_S 0
#define MIC_DP_MAXREGIONLENGTH 2048 // must be multiple of 16
#define MIC_DP_MAXREADLENGTH 256 // must be multiple of 16
#define coord(i,j) (((i+j)*MIC_DP_MAXREADLENGTH) + (16*(i+j)) + (j+15))
#define MIC_DP_MATRIXLENGTH coord(MIC_DP_MAXREGIONLENGTH, MIC_DP_MAXREADLENGTH)
#define MIC_DP_MAXTRACELENGTH (MIC_DP_MAXREADLENGTH*2)
typedef struct DPParametersMIC {
int scoreMatch, scoreMismatch, scoreGapOpen, scoreGapExtend;
int maxLeftClip, maxRightClip, maxTotalClip;
double scoreThreshold;
} DPParametersMIC;
typedef struct DPArgumentsMIC {
char *regCode, *readCode;
unsigned regLength, readLength;
} DPArgumentsMIC;
typedef struct DPMatrixCellMIC {
unsigned scoreM : 11;
unsigned scoreI : 11;
unsigned scoreD : 5;
unsigned codeRef : 2;
unsigned codeRead : 2;
unsigned flag : 1;
} DPMatrixCellMIC;
typedef struct DPWorkMIC {
// working memory
DPMatrixCellMIC matrix[MIC_DP_MATRIXLENGTH];
char regBuffer[MIC_DP_MAXREGIONLENGTH];
// output
char trace[MIC_DP_MAXTRACELENGTH];
int traceLength;
int maxScore, maxScoreStartPos, maxScoreEndPos;
double scoreThreshold;
// constant for calculations
int scoreMatch, scoreMismatch, scoreGapOpen, scoreGapExtend;
int maxLeftClip, maxRightClip, maxTotalClip;
__m512i rMatch, rMismatch, rGapOpen, rGapExtend;
__m512i rMaskTraceM, rMaskTraceI, rMaskTraceD, rMaskCodeRef, rMaskCodeRead, rMaskFlag, rMaskScoreM, rMaskScoreI, rMaskScoreD;
} DPWorkMIC;
__attribute__((target(mic)))
void DPWorkInitMIC(const DPParametersMIC* dpp, DPWorkMIC* dpw);
__attribute__((target(mic)))
int DPMatrixFillMIC(const DPArgumentsMIC* dpa, DPWorkMIC* dpw);
#endif