56 lines
2.0 KiB
C
56 lines
2.0 KiB
C
/*********************************************************************************************
|
|
Description: stripped sw align functions in bwa-mem
|
|
|
|
Copyright : All right reserved by NCIC.ICT
|
|
|
|
Author : Zhang Zhonghai
|
|
Date : 2024/04/11
|
|
***********************************************************************************************/
|
|
#ifndef __ALIGN_H
|
|
#define __ALIGN_H
|
|
#include <stdio.h>
|
|
#include <emmintrin.h>
|
|
#include <immintrin.h>
|
|
#include "byte_alloc.h"
|
|
|
|
#define KSW_XBYTE 0x10000
|
|
#define KSW_XSTOP 0x20000
|
|
#define KSW_XSUBO 0x40000
|
|
#define KSW_XSTART 0x80000
|
|
|
|
typedef struct
|
|
{
|
|
int score; // best score
|
|
int te, qe; // target end and query end
|
|
int score2, te2; // second best score and ending position on the target
|
|
int tb, qb; // target start and query start
|
|
} kswr_t;
|
|
|
|
extern const kswr_t g_defr;
|
|
|
|
typedef struct _kswq_t
|
|
{
|
|
int qlen, slen;
|
|
uint8_t shift, mdiff, max, size;
|
|
__m128i *qp, *H0, *H1, *E, *Hmax;
|
|
} kswq_sse_t;
|
|
|
|
typedef struct _kswq_avx2_t {
|
|
int qlen, slen;
|
|
uint8_t shift, mdiff, max, size;
|
|
__m256i *qp, *H0, *H1, *E, *Hmax;
|
|
} kswq_avx2_t;
|
|
|
|
#define ALIGN_FUNC_NUM 4
|
|
|
|
kswq_sse_t *aln_sse_qinit(byte_mem_t *bmem, int size, int qlen, const uint8_t *query, int m, const int8_t *mat);
|
|
kswr_t align_sse_i16(byte_mem_t *bmem, kswq_sse_t *q, int tlen, const uint8_t *target, int _o_del, int _e_del, int _o_ins, int _e_ins, int xtra); // the first gap costs -(_o+_e)
|
|
kswr_t align_sse_u8(byte_mem_t *bmem, kswq_sse_t *q, int tlen, const uint8_t *target, int _o_del, int _e_del, int _o_ins, int _e_ins, int xtra);
|
|
kswq_avx2_t *aln_avx2_qinit(byte_mem_t *bmem, int size, int qlen, const uint8_t *query, int m, const int8_t *mat);
|
|
kswr_t align_avx2_u8(byte_mem_t *bmem, kswq_avx2_t *q, int tlen, const uint8_t *target, int _o_del, int _e_del, int _o_ins,
|
|
int _e_ins, int xtra);
|
|
kswr_t align_avx2_i16(byte_mem_t *bmem, kswq_avx2_t *q, int tlen, const uint8_t *target, int _o_del, int _e_del, int _o_ins,
|
|
int _e_ins, int xtra);
|
|
int main_align(int argc, char *argv[]);
|
|
#endif
|