Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add descriptions for the fixed fields #262

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bio2zarr/vcf2zarr/vcz.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ def inspect(path):

DEFAULT_ZARR_COMPRESSOR = numcodecs.Blosc(cname="zstd", clevel=7)

_fixed_field_descriptions = {
"variant_contig": "An identifier from the reference genome or an angle-bracketed ID"
" string pointing to a contig in the assembly file",
"variant_position": "The reference position",
"variant_id": "List of unique identifiers where applicable",
"variant_allele": "List of the reference and alternate alleles",
"variant_quality": "Phred-scaled quality score",
"variant_filter": "Filter status of the variant",
}


@dataclasses.dataclass
class ZarrArraySpec:
Expand All @@ -46,6 +56,9 @@ class ZarrArraySpec:
filters: list

def __post_init__(self):
if self.name in _fixed_field_descriptions:
self.description = self.description or _fixed_field_descriptions[self.name]

# Ensure these are tuples for ease of comparison and consistency
self.shape = tuple(self.shape)
self.chunks = tuple(self.chunks)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vcz.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def test_variant_contig(self, schema):
"shape": (9,),
"chunks": (10000,),
"dimensions": ("variants",),
"description": "",
"description": "An identifier from the reference genome or an "
"angle-bracketed ID string pointing to a contig in the assembly file",
"vcf_field": None,
"compressor": {
"id": "blosc",
Expand Down
Loading