| 1 | /* bam_ampliconclip.h -- shared functions between amplicon clip/stats |
| 2 | |
| 3 | Copyright (C) 2020-2021 Genome Research Ltd. |
| 4 | |
| 5 | Author: James Bonfield <[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 BAM_AMPLICONCLIP_H |
| 26 | #define BAM_AMPLICONCLIP_H |
| 27 | |
| 28 | #include "htslib/khash.h" |
| 29 | |
| 30 | typedef struct { |
| 31 | int64_t left; |
| 32 | int64_t right; |
| 33 | char *name; |
| 34 | char *score; |
| 35 | int rev; |
| 36 | int64_t num_reads; |
| 37 | } bed_entry_t; |
| 38 | |
| 39 | typedef struct { |
| 40 | bed_entry_t *bp; |
| 41 | int64_t longest; |
| 42 | int length; |
| 43 | int size; |
| 44 | } bed_entry_list_t; |
| 45 | |
| 46 | KHASH_MAP_INIT_STR(bed_list_hash, bed_entry_list_t) |
| 47 | |
| 48 | #define BED_LIST_INIT {NULL, 0, 0, 0, {0}} |
| 49 | |
| 50 | |
| 51 | int load_bed_file_multi_ref(char *infile, int get_strand, |
| 52 | int sort_by_pos, khash_t(bed_list_hash) *bed_lists, |
| 53 | char ***ref_list, size_t *num_refs); |
| 54 | |
| 55 | void destroy_bed_hash(khash_t(bed_list_hash) *hash); |
| 56 | |
| 57 | |
| 58 | #endif /* BAM_AMPLICONCLIP_H */ |