Skip to content

Commit

Permalink
Report the location on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmar-van-den-Berg committed Dec 18, 2024
1 parent e664690 commit 97d8138
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Novel module
Bugfixes
========
* Fix a rare bug where different modules use the same multiqc file list.
* Fix a bug with filtering VEP records that contain multiple population
frequency records for a single variant.

Updates
=======
Expand Down
18 changes: 16 additions & 2 deletions includes/snv-indels/scripts/filter_vep.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ def _extract_frequencies(self) -> FrequenciesType:
if not frequencies:
frequencies = var["frequencies"]
elif var["frequencies"] != frequencies:
msg = "Multiple colocated variants with 'frequencies' entry encountered"
location = self.location
msg = f"Multiple colocated variants with 'frequencies' entry encountered on {location}"
raise RuntimeError(msg)

if len(frequencies) > 1:
msg = "'frequencies' entry from VEP should only contain a single key"
location = self.location
msg = f"'frequencies' entry with multiple keys encountered on {location}"
raise RuntimeError(msg)

return frequencies
Expand Down Expand Up @@ -162,6 +164,18 @@ def above_population_threshold(self, population: str, threshold: float) -> bool:
"""
return self.population_frequency(population) > threshold

@property
def location(self) -> str:
"""
Return a representation the location of the VEP record on the genome
"""
input = self.get("input")
if input is None:
return "unknown location"

chrom, pos = input.split("\t")[:2]
return f"{chrom}:{pos}"


def read_goi_file(fname: str) -> Tuple[Set[str], Set[str]]:
goi = set()
Expand Down

0 comments on commit 97d8138

Please sign in to comment.