mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-10-10 00:10:56 +08:00
smaller cigar size
This commit is contained in:
+14
-2
@@ -1804,10 +1804,13 @@ inline int move_gap_greedy(char* path, int path_i, int path_length, char* x, int
|
|||||||
inline void generate_cigar(char* path, int path_length, window_list *idx, window_list_alloc *res, int* start, int* end, unsigned int* old_error,
|
inline void generate_cigar(char* path, int path_length, window_list *idx, window_list_alloc *res, int* start, int* end, unsigned int* old_error,
|
||||||
char* x, int x_len, char* y)
|
char* x, int x_len, char* y)
|
||||||
{
|
{
|
||||||
|
// uint8_t debug_c; uint32_t debug_c_len;
|
||||||
idx->cidx = res->c.n;
|
idx->cidx = res->c.n;
|
||||||
if ((*old_error) == 0) {
|
if ((*old_error) == 0) {
|
||||||
push_cigar_cell(res, 0, idx->x_end + 1 - idx->x_start);
|
push_cigar_cell(res, 0, idx->x_end + 1 - idx->x_start);
|
||||||
idx->clen = res->c.n - idx->cidx;
|
idx->clen = res->c.n - idx->cidx;
|
||||||
|
// get_cigar_cell(idx, res, idx->clen-1, &debug_c, &debug_c_len);
|
||||||
|
// assert(debug_c==0 && debug_c_len==(idx->x_end + 1 - idx->x_start));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1887,7 +1890,11 @@ inline void generate_cigar(char* path, int path_length, window_list *idx, window
|
|||||||
pre_c = 5; pre_cl = 0;
|
pre_c = 5; pre_cl = 0;
|
||||||
for (i = path_length - 1; i >= 0; i--) {
|
for (i = path_length - 1; i >= 0; i--) {
|
||||||
if (pre_c != path[i]) {
|
if (pre_c != path[i]) {
|
||||||
if (pre_cl != 0) push_cigar_cell(res, pre_c, pre_cl);
|
if (pre_cl != 0) {
|
||||||
|
push_cigar_cell(res, pre_c, pre_cl);
|
||||||
|
// get_cigar_cell(idx, res, res->c.n - idx->cidx - 1, &debug_c, &debug_c_len);
|
||||||
|
// assert(debug_c==pre_c && debug_c_len==pre_cl);
|
||||||
|
}
|
||||||
pre_c = path[i]; pre_cl = 1;
|
pre_c = path[i]; pre_cl = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1895,7 +1902,12 @@ inline void generate_cigar(char* path, int path_length, window_list *idx, window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pre_cl != 0) push_cigar_cell(res, pre_c, pre_cl);
|
if (pre_cl != 0) {
|
||||||
|
push_cigar_cell(res, pre_c, pre_cl);
|
||||||
|
// get_cigar_cell(idx, res, res->c.n - idx->cidx -1, &debug_c, &debug_c_len);
|
||||||
|
// assert(debug_c==pre_c && debug_c_len==pre_cl);
|
||||||
|
}
|
||||||
|
|
||||||
idx->clen = res->c.n - idx->cidx;
|
idx->clen = res->c.n - idx->cidx;
|
||||||
// if(verify_cigar(x, x_len, y, (*end) - (*start) + 1, &(result->cigar), *old_error))
|
// if(verify_cigar(x, x_len, y, (*end) - (*start) + 1, &(result->cigar), *old_error))
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -1251,14 +1251,14 @@ inline int if_exact_match(char* x, long long xLen, char* y, long long yLen, long
|
|||||||
|
|
||||||
inline void get_cigar_cell(window_list *idx, window_list_alloc *cc, uint32_t i, uint8_t *c, uint32_t *len)
|
inline void get_cigar_cell(window_list *idx, window_list_alloc *cc, uint32_t i, uint8_t *c, uint32_t *len)
|
||||||
{
|
{
|
||||||
uint32_t p = cc->c.a[idx->cidx+i];
|
uint16_t p = cc->c.a[idx->cidx+i];
|
||||||
(*c) = (uint8_t)(p>>30); (*len) = (p<<2)>>2;
|
(*c) = (uint8_t)(p>>14); (*len) = (p&((uint16_t)0x3fff));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void push_cigar_cell(window_list_alloc *res, uint8_t c, uint32_t len)
|
inline void push_cigar_cell(window_list_alloc *res, uint8_t c, uint32_t len)
|
||||||
{
|
{
|
||||||
uint32_t p = c; p <<= 30; p += len;
|
uint16_t p = c; p <<= 14; p += (uint16_t)len;
|
||||||
kv_push(uint32_t, res->c, p);
|
kv_push(uint16_t, res->c, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FORWARD_KSW 0
|
#define FORWARD_KSW 0
|
||||||
|
|||||||
+3
-11
@@ -44,29 +44,21 @@ typedef struct
|
|||||||
uint64_t end_pos;
|
uint64_t end_pos;
|
||||||
} k_mer_pos_list;
|
} k_mer_pos_list;
|
||||||
|
|
||||||
// typedef struct
|
|
||||||
// {
|
|
||||||
// int C_L[CIGAR_MAX_LENGTH];
|
|
||||||
// char C_C[CIGAR_MAX_LENGTH];
|
|
||||||
// int length;
|
|
||||||
// } CIGAR;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
///the begining and end of a window, instead of the whole overlap
|
///the begining and end of a window, instead of the whole overlap
|
||||||
int32_t x_start, x_end;
|
int32_t x_start, x_end;
|
||||||
int32_t y_start, y_end;
|
int32_t y_start, y_end;
|
||||||
int32_t extra_begin, extra_end;
|
int16_t extra_begin, extra_end;
|
||||||
int32_t error, error_threshold;
|
int16_t error, error_threshold;
|
||||||
uint32_t cidx, clen;
|
uint32_t cidx, clen;
|
||||||
//CIGAR cigar;
|
|
||||||
} window_list;
|
} window_list;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
size_t n, m;
|
size_t n, m;
|
||||||
window_list *a;
|
window_list *a;
|
||||||
kvec_t(uint32_t) c;
|
kvec_t(uint16_t) c;
|
||||||
} window_list_alloc;
|
} window_list_alloc;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
Reference in New Issue
Block a user