projects
/
samtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bcftools.1 and samtools.1 were merged in upstream release 0.1.17.
[samtools.git]
/
bedidx.c
diff --git
a/bedidx.c
b/bedidx.c
index 92978318d4ccfbbabeeddd150458245f669062d8..34f0f2fb3ba0e40aaab31e4c8eca4140e4a5d458 100644
(file)
--- a/
bedidx.c
+++ b/
bedidx.c
@@
-4,6
+4,9
@@
#include <stdio.h>
#include <zlib.h>
#include <stdio.h>
#include <zlib.h>
+#include "ksort.h"
+KSORT_INIT_GENERIC(uint64_t)
+
#include "kseq.h"
KSTREAM_INIT(gzFile, gzread, 8192)
#include "kseq.h"
KSTREAM_INIT(gzFile, gzread, 8192)
@@
-53,6
+56,7
@@
void bed_index(void *_h)
if (kh_exist(h, k)) {
bed_reglist_t *p = &kh_val(h, k);
if (p->idx) free(p->idx);
if (kh_exist(h, k)) {
bed_reglist_t *p = &kh_val(h, k);
if (p->idx) free(p->idx);
+ ks_introsort(uint64_t, p->n, p->a);
p->idx = bed_index_core(p->n, p->a, &p->m);
}
}
p->idx = bed_index_core(p->n, p->a, &p->m);
}
}
@@
-115,8
+119,10
@@
void *bed_read(const char *fn)
if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
beg = atoi(str->s); // begin
if (dret != '\n') {
if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
beg = atoi(str->s); // begin
if (dret != '\n') {
- if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0]))
+ if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0]))
{
end = atoi(str->s); // end
end = atoi(str->s); // end
+ if (end < beg) end = -1;
+ }
}
}
}
}
}
}