| 1 | /*=========================================================================== |
| 2 | * |
| 3 | * PUBLIC DOMAIN NOTICE |
| 4 | * National Center for Biotechnology Information |
| 5 | * |
| 6 | * This software/database is a "United States Government Work" under the |
| 7 | * terms of the United States Copyright Act. It was written as part of |
| 8 | * the author's official duties as a United States Government employee and |
| 9 | * thus cannot be copyrighted. This software/database is freely available |
| 10 | * to the public for use. The National Library of Medicine and the U.S. |
| 11 | * Government have not placed any restriction on its use or reproduction. |
| 12 | * |
| 13 | * Although all reasonable efforts have been taken to ensure the accuracy |
| 14 | * and reliability of the software and data, the NLM and the U.S. |
| 15 | * Government do not and cannot warrant the performance or results that |
| 16 | * may be obtained by using this software or data. The NLM and the U.S. |
| 17 | * Government disclaim all warranties, express or implied, including |
| 18 | * warranties of performance, merchantability or fitness for any particular |
| 19 | * purpose. |
| 20 | * |
| 21 | * Please cite the author in any work or product based on this material. |
| 22 | * |
| 23 | * =========================================================================== |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef _h_unsupported_pileup_estimator_ |
| 28 | #define _h_unsupported_pileup_estimator_ |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | #ifndef _h_align_extern_ |
| 35 | #include <align/extern.h> |
| 36 | #endif |
| 37 | |
| 38 | #ifndef _h_klib_text_ |
| 39 | #include <klib/text.h> |
| 40 | #endif |
| 41 | |
| 42 | /*-------------------------------------------------------------------------- |
| 43 | * forwards |
| 44 | */ |
| 45 | struct VCursor; |
| 46 | |
| 47 | /*-------------------------------------------------------------------------- |
| 48 | * PilepuEstimator |
| 49 | */ |
| 50 | struct PilepuEstimator; |
| 51 | |
| 52 | /*-------------------------------------------------------------------------- |
| 53 | * MakePileupEstimator |
| 54 | * |
| 55 | * creates an PileupEstimator-object |
| 56 | * |
| 57 | * self [ OUT ] - the Estimator-object to be created |
| 58 | * |
| 59 | * source [ IN ] - the name of the accession |
| 60 | * ( can be NULL, but we need none-NULL cursors then! ) |
| 61 | * |
| 62 | * cursor_cache_size [ IN ] - the cache-size on the cursor's |
| 63 | * 0 ... pick default size |
| 64 | * not used if cursor ( below ) are given |
| 65 | * |
| 66 | * ref_cursor [ IN ] - cursor on the REFERENCE-table |
| 67 | * ( can be NULL, but we need a none-NULL source then! ) |
| 68 | * if the cursor is given it has to contain these columns: |
| 69 | * - SEQ_ID |
| 70 | * - SEQ_LEN |
| 71 | * - MAX_SEQ_LEN |
| 72 | * - PRIMARY_ALIGNMENT_IDS |
| 73 | * we expect this cursor to be opened |
| 74 | * |
| 75 | * align_cursor [ IN ] - cursor on the ALIGNMENT-table |
| 76 | * ( can be NULL, but we need a none-NULL source then! ) |
| 77 | * if the cursor is given it has to contain these columns: |
| 78 | * - REF_POS |
| 79 | * - REF_LEN |
| 80 | - READ_FILTER ( if user_read_filter == true ) |
| 81 | * we expect this cursor to be opened |
| 82 | * |
| 83 | * |
| 84 | * cutoff_value [ IN ] - how many alignments per touched REFERENCE-table |
| 85 | * are too much, it this value is reached while |
| 86 | * running the estimator - a value of MAX_UINT64 is |
| 87 | * returned as result. This should avoid the |
| 88 | * situation that collecting the estimation will |
| 89 | * take too long... |
| 90 | * 0 ... no cutoff-check performed |
| 91 | * |
| 92 | * use_read_filter [ IN ] - adds the READ_FILTER - column |
| 93 | * to the list of required columns for the |
| 94 | * align_cursor ( if used ) |
| 95 | * and uses the column to filter out alignments |
| 96 | * with SRA_READ_FILTER_REJECT or |
| 97 | * SRA_READ_FILTER_CRITERIA values in this |
| 98 | * column |
| 99 | * |
| 100 | */ |
| 101 | ALIGN_EXTERN rc_t CC MakePileupEstimator( struct PileupEstimator **self, |
| 102 | const char * source, |
| 103 | size_t cursor_cache_size, |
| 104 | const struct VCursor * ref_cursor, |
| 105 | const struct VCursor * align_cursor, |
| 106 | uint64_t cutoff_value, |
| 107 | bool use_read_filter ); |
| 108 | |
| 109 | /*-------------------------------------------------------------------------- |
| 110 | * ReleasePileupEstimator |
| 111 | * |
| 112 | * releases an PileupEstimator-object |
| 113 | * |
| 114 | */ |
| 115 | ALIGN_EXTERN rc_t CC ReleasePileupEstimator( struct PileupEstimator *self ); |
| 116 | |
| 117 | |
| 118 | /*-------------------------------------------------------------------------- |
| 119 | * RunPileupEstimator |
| 120 | * |
| 121 | * runs the PileupEstimator-object on a given slice |
| 122 | * |
| 123 | * self [ IN ] - the prepared PileupEstimator |
| 124 | * |
| 125 | * refname [ IN ] - the name of the reference ( matches values in SEQ_ID ) |
| 126 | * |
| 127 | * slice_start [ IN ] - the zero-based start-position of the slice on the reference |
| 128 | * |
| 129 | * slice_len [ IN ] - the length of the slice |
| 130 | * |
| 131 | * result [ OUT ] - how many alignment-bases would be loaded |
| 132 | */ |
| 133 | ALIGN_EXTERN rc_t CC RunPileupEstimator( struct PileupEstimator *self, |
| 134 | const String * refname, |
| 135 | uint64_t slice_start, |
| 136 | uint32_t slice_len, |
| 137 | uint64_t * result ); |
| 138 | |
| 139 | /* RunCoverage |
| 140 | * |
| 141 | * runs the PileupEstimator-object to enter the depth on each position |
| 142 | * of the requested slice into the coverage-vector |
| 143 | * |
| 144 | * self [ IN ] - the prepared PileupEstimator |
| 145 | * |
| 146 | * refname [ IN ] - the name of the reference ( matches values in SEQ_ID ) |
| 147 | * |
| 148 | * slice_start [ IN ] - the zero-based start-position of the slice on the reference |
| 149 | * |
| 150 | * slice_len [ IN ] - the length of the slice |
| 151 | * |
| 152 | * coverage [ OUT ] - the caller-allocated vector of coverage-depth's |
| 153 | * it has to have at least the length of the requested slice |
| 154 | */ |
| 155 | ALIGN_EXTERN rc_t CC RunCoverage( struct PileupEstimator *self, |
| 156 | const String * refname, |
| 157 | uint64_t slice_start, |
| 158 | uint32_t slice_len, |
| 159 | uint32_t * coverage ); |
| 160 | |
| 161 | /* EstimatorRefCount |
| 162 | * |
| 163 | * how many references are in the run given to the PileupEstimator |
| 164 | * |
| 165 | * self [ IN ] - the prepared PileupEstimator |
| 166 | * |
| 167 | * count [ OUT ] - the number of references |
| 168 | */ |
| 169 | ALIGN_EXTERN rc_t CC EstimatorRefCount( struct PileupEstimator *self, uint32_t * count ); |
| 170 | |
| 171 | |
| 172 | /* EstimatorRefInfo |
| 173 | * |
| 174 | * return information about one reference in the PileupEstimator |
| 175 | * |
| 176 | * self [ IN ] - the prepared PileupEstimator |
| 177 | * |
| 178 | * idx [ IN ] - index of the reference ( 0 ... count-1 ) |
| 179 | * |
| 180 | * refname [ OUT ] - pointer to String-struct, will be initialized, do not free |
| 181 | * |
| 182 | * reflen [ OUT ] - length of the reference |
| 183 | */ |
| 184 | ALIGN_EXTERN rc_t CC EstimatorRefInfo( struct PileupEstimator *self, |
| 185 | uint32_t idx, |
| 186 | String * refname, |
| 187 | uint64_t * reflen ); |
| 188 | |
| 189 | |
| 190 | #ifdef __cplusplus |
| 191 | } |
| 192 | #endif |
| 193 | |
| 194 | #endif /* _h_unsupported_pileup_estimator_ */ |