Skip to content

Commit b8adf7e

Browse files
fixed a bug in merge_by_byte again
1 parent 9d7bc0a commit b8adf7e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/utils/format-reads.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,15 @@ merge_by_byte(const bam1_t *a, const bam1_t *b, bam1_t *c) {
526526
const auto b_seq = bam_get_seq(b);
527527
auto c_seq = bam_get_seq(c);
528528

529-
for (size_t i = 0; i < a_num_bytes; i++) {
530-
c_seq[i] = a_seq[i];
531-
}
529+
// for (size_t i = 0; i < a_num_bytes; i++) {
530+
// c_seq[i] = a_seq[i];
531+
// }
532+
memcpy(c_seq, a_seq, a_num_bytes);
533+
532534
// Here, c_seq looks either like aa aa aa aa
533535
// or like aa aa aa a-
534536
if (is_a_odd) {
537+
c_seq[a_num_bytes -1 ] &= 0xf0;
535538
c_seq[a_num_bytes - 1] |= is_b_odd ?
536539
byte_revcom_table[b_seq[b_num_bytes - 1]] :
537540
byte_revcom_table[b_seq[b_num_bytes - 1]] >> 4;

0 commit comments

Comments
 (0)