exposed fasta/q reader to mappy

This commit is contained in:
Heng Li
2017-09-17 14:41:59 -04:00
parent e9c57f6d8b
commit c8a019fae8
5 changed files with 91 additions and 63 deletions

View File

@@ -2,7 +2,11 @@
#define CMAPPY_H
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include "minimap.h"
#include "kseq.h"
KSEQ_DECLARE(gzFile)
typedef struct {
const char *ctg;
@@ -36,4 +40,19 @@ static inline void mm_free_reg1(mm_reg1_t *r)
free(r->p);
}
static inline kseq_t *mm_fastx_open(const char *fn)
{
gzFile fp;
fp = fn && strcmp(fn, "-") != 0? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
return kseq_init(fp);
}
static inline void mm_fastx_close(kseq_t *ks)
{
gzFile fp;
fp = ks->f->f;
kseq_destroy(ks);
gzclose(fp);
}
#endif