]> git.kaiwu.me - klib.git/commitdiff
bugfix: empty fasta/q lines cause troubles
authorHeng Li <lh3@me.com>
Sun, 15 Apr 2012 15:06:13 +0000 (11:06 -0400)
committerHeng Li <lh3@me.com>
Sun, 15 Apr 2012 15:06:13 +0000 (11:06 -0400)
kseq.h

diff --git a/kseq.h b/kseq.h
index ab7f77ff366fbfabf1122295d5a93da94ad56573..a5cec7c289aeda5fe36edb2a828a9f669741d3a3 100644 (file)
--- a/kseq.h
+++ b/kseq.h
@@ -186,6 +186,7 @@ typedef struct __kstring_t {
                        seq->seq.s = (char*)malloc(seq->seq.m); \
                } \
                while ((c = ks_getc(ks)) != -1 && c != '>' && c != '+' && c != '@') { \
+                       if (c == '\n') continue; /* skip empty lines */ \
                        seq->seq.s[seq->seq.l++] = c; /* this is safe: we always have enough space for 1 char */ \
                        ks_getuntil2(ks, KS_SEP_LINE, &seq->seq, 0, 1); /* read the rest of the line */ \
                } \
@@ -217,7 +218,7 @@ typedef struct __kstring_t {
        } kseq_t;
 
 #define KSEQ_INIT2(SCOPE, type_t, __read)              \
-       KSTREAM_INIT(type_t, __read, 4096)                      \
+       KSTREAM_INIT(type_t, __read, 16384)                     \
        __KSEQ_TYPE(type_t)                                                     \
        __KSEQ_BASIC(SCOPE, type_t)                                     \
        __KSEQ_READ(SCOPE)