bwa_perf/util.h

41 lines
1.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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)
#define xopen(fn, mode) err_xopen_core(__func__, fn, mode)
double realtime(void);
// 在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);
// 打开文件流
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);
#endif