2024-01-25 15:40:57 +08:00
|
|
|
|
#ifndef COMMON_H_
|
|
|
|
|
|
#define COMMON_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
|
|
typedef uint64_t bwtint_t;
|
|
|
|
|
|
|
|
|
|
|
|
#define xassert(cond, msg) \
|
|
|
|
|
|
if ((cond) == 0) \
|
|
|
|
|
|
_err_fatal_simple_core(__func__, msg)
|
|
|
|
|
|
|
2024-01-27 00:42:47 +08:00
|
|
|
|
#define xopen(fn, mode) err_xopen_core(__func__, fn, mode)
|
|
|
|
|
|
|
|
|
|
|
|
double realtime(void);
|
2024-01-25 15:40:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 在fm-indexv(或者bwt)查找过程中,记录结果
|
|
|
|
|
|
struct bwtintv_t
|
|
|
|
|
|
{
|
|
|
|
|
|
bwtint_t x[3], info; // x[0]表示正链位置,x[1]表示互补链位置,x[2]表示间隔长度,info 表示read的起始结束位置
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 读取二进制数据
|
|
|
|
|
|
bwtint_t fread_fix(FILE *fp, bwtint_t size, void *a);
|
|
|
|
|
|
// 给出问题信息并终止程序
|
|
|
|
|
|
void _err_fatal_simple_core(const char *func, const char *msg);
|
|
|
|
|
|
|
|
|
|
|
|
// base转成2bit值
|
|
|
|
|
|
int bval(char b);
|
|
|
|
|
|
// 互补碱基值
|
|
|
|
|
|
int cbval(char b);
|
2024-01-27 00:42:47 +08:00
|
|
|
|
// 打开文件流
|
|
|
|
|
|
FILE *err_xopen_core(const char *func, const char *fn, const char *mode);
|
|
|
|
|
|
// 写二进制文件
|
|
|
|
|
|
size_t err_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
|
|
|
|
|
// 刷新文件流
|
|
|
|
|
|
int err_fflush(FILE *stream);
|
|
|
|
|
|
// 关闭文件流
|
|
|
|
|
|
int err_fclose(FILE *stream);
|
2024-01-25 15:40:57 +08:00
|
|
|
|
|
|
|
|
|
|
#endif
|