Debian Codegraph @

samtools/stats_isize.h

raw symbols SCIP
1 /* stats_isize.h -- generalised insert size calculation for samtools stats.
2
3 Copyright (C) 2014 Genome Research Ltd.
4
5 Author: Nicholas Clarke <[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 #include <htslib/khash.h>
26 #include <stdint.h>
27
28 typedef struct
29 {
30 int total;
31 uint64_t *isize_inward, *isize_outward, *isize_other;
32 }
33 isize_dense_data_t;
34
35 typedef struct
36 {
37 uint64_t isize_inward, isize_outward, isize_other;
38 }
39 isize_sparse_record_t;
40
41 KHASH_MAP_INIT_INT(m32, isize_sparse_record_t *)
42
43 typedef struct
44 {
45 int max;
46 khash_t(m32) *array;
47 }
48 isize_sparse_data_t;
49
50 typedef union {
51 isize_sparse_data_t *sparse;
52 isize_dense_data_t *dense;
53 } isize_data_t;
54
55 // Insert size structure
56 typedef struct
57 {
58 isize_data_t data;
59
60 // Maximum
61 int (*nitems)(isize_data_t);
62
63 // Fetch the number of inserts of a given size
64 uint64_t (*inward)(isize_data_t, int);
65 uint64_t (*outward)(isize_data_t, int);
66 uint64_t (*other)(isize_data_t, int);
67
68 // Set the number of inserts of a given size
69 void (*set_inward)(isize_data_t, int, uint64_t);
70 void (*set_outward)(isize_data_t, int, uint64_t);
71 void (*set_other)(isize_data_t, int, uint64_t);
72
73 // Increment the number of inserts of a given size
74 void (*inc_inward)(isize_data_t, int);
75 void (*inc_outward)(isize_data_t, int);
76 void (*inc_other)(isize_data_t, int);
77
78 // Free this structure
79 void (*isize_free)(isize_data_t);
80 }
81 isize_t;
82
83 isize_t *init_isize_t(int bound);