Commit a914023
committed
Fix sam_hdr_dup to cope with long refs.
The h->sdict hash is used to track references that are > 4Gb in size.
The dup code didn't copy this. This manifested itself as CRAM SQ
headers being truncated (read SAM hdr, dup, write as CRAM hdr).
To fix this a function was written that creates or updates the sdict
from the hrecs parsed header structs. It's possible this should be
called directly from the sam_hdr_create function (part of the SAM
format parser) instead of manually keeping track of sdict itself,
however doing so would require initialising the new header structs so
I haven't done this.
This is a general utility, so perhaps should be made a public part of
the header API. However IMO the new header API should hide this
nuance away and just return the correct data, also ensuring that
header updates work correctly and honour the text form.
Since c83c9e2 the header API also was using the 32-bit capped
target_len in preference to the parsed text from SQ LN fields when
they differed. I am assuming this was a decision in what takes
priority in BAM where the sequence names and lengths exist in both
text and binary form. This commit reverses this and makes the text
form always take priority. As this is at least required in some
scenarios (long references) it seems easier to simply make it apply in
all scenarios.1 parent 7e3234e commit a914023
3 files changed
+65
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
193 | 188 | | |
194 | 189 | | |
195 | 190 | | |
| |||
2485 | 2480 | | |
2486 | 2481 | | |
2487 | 2482 | | |
2488 | | - | |
2489 | | - | |
2490 | | - | |
2491 | | - | |
2492 | | - | |
2493 | | - | |
2494 | | - | |
2495 | | - | |
2496 | | - | |
2497 | | - | |
2498 | | - | |
2499 | | - | |
2500 | | - | |
2501 | | - | |
2502 | | - | |
2503 | | - | |
2504 | | - | |
2505 | | - | |
2506 | | - | |
2507 | 2483 | | |
2508 | 2484 | | |
2509 | 2485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
134 | 181 | | |
135 | 182 | | |
136 | 183 | | |
| |||
179 | 226 | | |
180 | 227 | | |
181 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
182 | 237 | | |
183 | 238 | | |
184 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
648 | 654 | | |
649 | 655 | | |
650 | 656 | | |
| |||
0 commit comments