| 1 | /* bedidx.h -- BED file indexing header file. |
| 2 | |
| 3 | Copyright (C) 2017 Genome Research Ltd. |
| 4 | |
| 5 | Author: Valeriu Ohan <[email protected]> |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | of this software and associated documentation files (the "Software"), to deal |
| 9 | in the Software without restriction, including without limitation the rights |
| 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | copies of the Software, and to permit persons to whom the Software is |
| 12 | furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice shall be included in |
| 15 | all copies or substantial portions of the Software. |
| 16 | |
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | DEALINGS IN THE SOFTWARE. */ |
| 24 | |
| 25 | #ifndef BEDIDX_H |
| 26 | #define BEDIDX_H |
| 27 | |
| 28 | #include "htslib/hts.h" |
| 29 | |
| 30 | #define LIDX_SHIFT 13 |
| 31 | #define ALL 0 |
| 32 | #define FILTERED 1 |
| 33 | |
| 34 | #define MIN(A,B) ( ( (A) < (B) ) ? (A) : (B) ) |
| 35 | #define MAX(A,B) ( ( (A) > (B) ) ? (A) : (B) ) |
| 36 | |
| 37 | void *bed_read(const char *fn); |
| 38 | void bed_destroy(void *_h); |
| 39 | int bed_overlap(const void *_h, const char *chr, hts_pos_t beg, hts_pos_t end); |
| 40 | void *bed_hash_regions(void *reg_hash, char **regs, int first, int last, int *op); |
| 41 | const char* bed_get(void *reg_hash, int index, int filter); |
| 42 | hts_reglist_t *bed_reglist(void *reg_hash, int filter, int *count_regs); |
| 43 | void bed_unify(void *_h); |
| 44 | |
| 45 | #endif |