Skip to content

Commit

Permalink
Add VCF detectedOriginalBuild meta-information
Browse files Browse the repository at this point in the history
  • Loading branch information
apriha committed Aug 26, 2024
1 parent 5132685 commit f66add4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/snps/io/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ def _write_vcf(self):
f'##detectedCompany="{self._snps.source}"',
]

if self._snps.build_original:
comment.append(f"##detectedOriginalBuild={self._snps.build_original}")

df = self._snps.snps

p = self._snps._parallelizer
Expand Down
14 changes: 14 additions & 0 deletions src/snps/snps.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(
self._phased = False
self._build = 0
self._build_detected = False
self._build_original = 0
self._output_dir = output_dir
self._resources = Resources(resources_dir=resources_dir)
self._parallelizer = Parallelizer(parallelize=parallelize, processes=processes)
Expand Down Expand Up @@ -103,6 +104,9 @@ def __init__(
self._build = d["build"]
self._build_detected = True if d["build"] else False

if self._build_detected:
self._build_original = self._build

if not self._snps.empty:
self.sort()

Expand Down Expand Up @@ -381,6 +385,16 @@ def build_detected(self):
"""
return self._build_detected

@property
def build_original(self):
"""Original build of SNPs, before any remapping.
Returns
-------
int
"""
return self._build_original

@property
def assembly(self):
"""Assembly of SNPs.
Expand Down

0 comments on commit f66add4

Please sign in to comment.