]> git.donarmstrong.com Git - samtools.git/blobdiff - faidx.c
* samtools-0.1.4-13 (r351)
[samtools.git] / faidx.c
diff --git a/faidx.c b/faidx.c
index 9302dfb4d6480bb94295d65e7fc7fcf4c4644332..6b4514ffa2f24946bdfed2228c8044cd8268e692 100644 (file)
--- a/faidx.c
+++ b/faidx.c
@@ -66,6 +66,12 @@ faidx_t *fai_build_core(RAZF *rz)
        name = 0; l_name = m_name = 0;
        len = line_len = line_blen = -1; state = 0; l1 = l2 = -1; offset = 0;
        while (razf_read(rz, &c, 1)) {
+               if (c == '\n') { // an empty line
+                       if (state == 1) {
+                               offset = razf_tell(rz);
+                               continue;
+                       } else if ((state == 0 && len < 0) || state == 2) continue;
+               }
                if (c == '>') { // fasta header
                        if (len >= 0)
                                fai_insert_index(idx, name, len, line_len, line_blen, offset);