sw_perf/utils.h

45 lines
1.1 KiB
C

/*********************************************************************************************
Description: Some useful functions
Copyright : All right reserved by NCIC.ICT
Author : Zhang Zhonghai
Date : 2023/08/25
***********************************************************************************************/
#ifndef __UTILS_H
#define __UTILS_H
#include <stdlib.h>
#include <stdint.h>
#include "kvec.h"
#undef MAX
#undef MIN
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define BUF_SIZE 1048576
typedef kvec_t(uint8_t) seq_t;
typedef kvec_t(seq_t) seq_v;
typedef kvec_t(int) qti_t; // query target info type
typedef kvec_t(qti_t) qti_v;
typedef struct { size_t m; uint8_t *addr; } buf_t;
extern const char *BASE;
extern unsigned char nst_nt4_table[256];
// 将碱基字符(ACGTN)转成int编码(0~4)
void base_char_to_int(char *str);
int read_qt_info(qti_v *qti_arr, buf_t *buf, int row_num_to_read, int info_num, FILE *fp);
int read_seq(seq_v *seq_arr, buf_t *buf, int row_num_to_read, FILE *fp);
#endif