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

Fix compound key in hail #1127

Merged
merged 3 commits into from
Jan 31, 2025
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.35.3
current_version = 1.35.4
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
contents: read

env:
VERSION: 1.35.3
VERSION: 1.35.4

jobs:
docker:
Expand Down
11 changes: 4 additions & 7 deletions cpg_workflows/scripts/vep_json_to_ht.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,11 @@ def vep_json_to_ht(vep_result_paths: list[str], out_path: str):

ht = hl.import_table(paths=vep_result_paths, no_header=True, types={'f0': json_schema})
ht = ht.transmute(vep=ht.f0)
# Can't use ht.vep.start for start because it can be modified by VEP (e.g. it
# happens for indels). So instead parsing POS from the original VCF line stored
# as ht.vep.input field.
original_vcf_line = ht.vep.input
start = hl.parse_int(original_vcf_line.split('\t')[1])
chrom = ht.vep.seq_region_name
ht = ht.annotate(locus=hl.locus(chrom, start))
# we're using split multiallelics, so we need to compound key on chr/pos/ref/alt
ht = ht.annotate(
locus=hl.locus(ht.vep.seq_region_name, hl.parse_int(ht.vep.input.split('\t')[1])),
alleles=ht.vep.allele_string.split('/'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it easy to make this split on '/' OR '|'

Given our push to LR we are going to start seeing phased VCFs more and more so it would be good to build that into our muscle memory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A split on one of two different separators isn't explicitly available as a hail method, but we can do a replace for | -> /, then split on the latter 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bit deal for this PR in particular - just one of those footguns that makes me nervous about basic string parsing a VCF.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll bookmark this and have a look for some phased calls in the final MT. I think this might be fine as this is the Alleles string, but the phasing is in the GT field. I would expect that even for 0|1 the alleles being passed to VEP are still in A/T format, with the option of being A/C/T for multiallelics

)
ht = ht.key_by(ht.locus, ht.alleles)
ht.write(out_path, overwrite=True)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
setup(
name='cpg_workflows',
# This tag is automatically updated by bumpversion
version='1.35.3',
version='1.35.4',
description='CPG workflows for Hail Batch',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down