mirror of
https://github.com/lh3/minimap2.git
synced 2026-09-15 13:07:55 +08:00
exposed fasta/q reader to mappy
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user