bwa_perf/util.h

56 lines
1.5 KiB
C
Raw Permalink 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>
extern double t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14;
extern long f1, f2, f3, f4, f5;
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);
typedef struct
{
int qs; // query start
int qe; // query end [)
int reverse; // 反向链
uint32_t rs; // 参考基因的起始点(包含)
} ref_match_t;
// 在fm-indexv(或者bwt)查找过程中,记录结果
struct bwtintv_t
{
bwtint_t x[3], info; // x[0]表示正链位置x[1]表示互补链位置x[2]表示间隔长度info 表示read的起始结束位置
int num_match;
ref_match_t rm[2];
};
// 读取单个数据
size_t err_fread_noeof(void *ptr, size_t size, size_t nmemb, FILE *stream);
// 读取二进制数据
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