Skip to content

Commit

Permalink
#506 - vcf allows for unknown QUAL field
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermann Romanek committed Nov 4, 2024
1 parent a0490a8 commit 4a1a918
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sniffles/sv.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def call(self, config, task) -> Optional[SVCall]:
id=f"{first_cand.svtype}.{task.sv_id:X}M{task.id:X}",
ref="N",
alt=svcall_alt,
qual=round(util.mean(int(cand.qual) for cand in self.candidates)),
qual=util.mean_or_none_round(int(cand.qual) for cand in self.candidates if cand.qual is not None),
filter="PASS" if n_samples != 1 else first_cand.filter,
info=dict() if n_samples != 1 else first_cand.info,
svtype=first_cand.svtype,
Expand Down
6 changes: 3 additions & 3 deletions src/sniffles/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ def write_call(self, call):
elif call.svtype == 'BND' and call.alt != '<BND>':
call.alt = (call.ref + call.alt[1:]) if call.alt.startswith('N') else call.alt[:-1] + call.ref

call.qual = max(0, min(60, call.qual))
call.qual = max(0, min(60, call.qual)) if call.qual is not None else None

self.write_raw("\t".join(str(v) for v in [call.contig, pos, self.config.id_prefix + call.id, call.ref,
call.alt, call.qual, call.filter, info_str, self.genotype_format] +
call.alt, call.qual if call.qual is not None else '.', call.filter, info_str, self.genotype_format] +
sample_genotypes))
self.call_count += 1

Expand Down Expand Up @@ -325,7 +325,7 @@ def read_svs_iter(self):
id=line_index,
ref=REF,
alt=ALT,
qual=int(QUAL),
qual=int(QUAL) if QUAL != '.' else None,
filter=FILTER,
info=info_dict,
svtype=None,
Expand Down

0 comments on commit 4a1a918

Please sign in to comment.