From 9348942203fc319b5322d473726d1820341c6483 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Wed, 17 Jun 2009 23:16:26 +0000 Subject: [PATCH] * samtools-0.1.4-13 (r351) * make faidx more tolerant to empty lines right before or after > lines * hope this does not introduce new bugs... --- bamtk.c | 2 +- faidx.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bamtk.c b/bamtk.c index b5afdf2..6c4626a 100644 --- a/bamtk.c +++ b/bamtk.c @@ -3,7 +3,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.4-13 (r350)" +#define PACKAGE_VERSION "0.1.4-14 (r351)" #endif int bam_taf2baf(int argc, char *argv[]); diff --git a/faidx.c b/faidx.c index 9302dfb..6b4514f 100644 --- 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); -- 2.39.5