Skip to content

Commit

Permalink
review update
Browse files Browse the repository at this point in the history
  • Loading branch information
vasudeva8 committed Feb 6, 2025
1 parent 51253f1 commit f4fef40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
13 changes: 1 addition & 12 deletions header.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int sam_hrecs_update_hashes(sam_hrecs_t *hrecs,
const char *name = NULL;
const char *altnames = NULL;
hts_pos_t len = -1;
int r, dup = 0;
int r;
khint_t k;

while (tag) {
Expand All @@ -154,12 +154,7 @@ static int sam_hrecs_update_hashes(sam_hrecs_t *hrecs,
name = tag->str+3;
} else if (tag->str[0] == 'L' && tag->str[1] == 'N') {
assert(tag->len >= 3);
hts_pos_t tmp = len;
len = strtoll(tag->str+3, NULL, 10);
if (tmp != -1 && tmp != len) {
//LN again with different value, discard
dup = 1;
}
} else if (tag->str[0] == 'A' && tag->str[1] == 'N') {
assert(tag->len >= 3);
altnames = tag->str+3;
Expand All @@ -178,12 +173,6 @@ static int sam_hrecs_update_hashes(sam_hrecs_t *hrecs,
return -1; // LN should be present, according to spec.
}

if (dup) {
hts_log_error("Header includes @SQ line \"%s\" with duplicate LN: tag", \
name);
return -1;
}

// Seen already?
k = kh_get(m_s2i, hrecs->ref_hash, name);
if (k < kh_end(hrecs->ref_hash)) {
Expand Down
17 changes: 5 additions & 12 deletions sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1911,12 +1911,6 @@ static sam_hdr_t *sam_hdr_sanitise(sam_hdr_t *h) {
cp[h->l_text] = '\0';
}

if (sam_hdr_fill_hrecs(h) < 0) {
//failed in parsing / validation
sam_hdr_destroy(h);
return NULL;
}

return h;
}

Expand Down Expand Up @@ -1971,14 +1965,13 @@ static sam_hdr_t *sam_hdr_create(htsFile* fp) {
q = r;
} else {
if (strncmp(q, "LN:", 3) == 0) {
hts_pos_t tmp = strtoll(q + 3, (char**)&q, 10);
if (ln != -1 && tmp != ln) {
//duplicate LN tag with different value
hts_log_error("111Header includes @SQ line \"%s\" with \
if (ln == -1) {
ln = strtoll(q + 3, (char**)&q, 10);
} else {
//ignore duplicate LN tags
hts_log_warning("Header includes @SQ line \"%s\" with \
duplicate LN: tag", sn);
goto error;
}
ln = tmp;
}
}

Expand Down

0 comments on commit f4fef40

Please sign in to comment.