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

Support vars comply with seqr needs #361

Merged
merged 3 commits into from
Feb 21, 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
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 = 3.0.2
current_version = 3.0.3
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clinvar_runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
curl --fail --silent --show-error -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type:application/json" \
-d '{"output": "generate_clinvar_${{ steps.date.outputs.date }}", "dataset": "talos", "accessLevel": "full", "repo": "automated-interpretation-pipeline", "commit": "${{ github.sha }}", "cwd": "reanalysis", "script": ["./clinvar_runner.py"], "description": "Generate Latest Clinvar Summaries", "image": "australia-southeast1-docker.pkg.dev/cpg-common/images/cpg_aip:3.0.2", "config": {"workflow": {"sequencing_type": "genome"}, "cohorts": {"talos": {"clinvar_filter": ["victorian clinical genetics services, murdoch childrens research institute"]}}}, "wait": false}' \
-d '{"output": "generate_clinvar_${{ steps.date.outputs.date }}", "dataset": "talos", "accessLevel": "full", "repo": "automated-interpretation-pipeline", "commit": "${{ github.sha }}", "cwd": "reanalysis", "script": ["./clinvar_runner.py"], "description": "Generate Latest Clinvar Summaries", "image": "australia-southeast1-docker.pkg.dev/cpg-common/images/cpg_aip:3.0.3", "config": {"workflow": {"sequencing_type": "genome"}, "cohorts": {"talos": {"clinvar_filter": ["victorian clinical genetics services, murdoch childrens research institute"]}}}, "wait": false}' \
https://server-a2pko7ameq-ts.a.run.app
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
contents: read

env:
VERSION: 3.0.2
VERSION: 3.0.3

jobs:
docker:
Expand Down
29 changes: 22 additions & 7 deletions helpers/minimise_output_for_seqr.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ def coord_to_string(coord: dict) -> str:
return f"{coord['chrom']}-{coord['pos']}-{coord['ref']}-{coord['alt']}"


def main(input_file: str, output: str):
def main(input_file: str, output: str, ext_map: str | None = None):
"""
reads in the input file, shrinks it, and writes the output file


Args:
input_file (str):
output (str):
ext_map (str): optional mapping of internal to external IDs for seqr
"""

with open(input_file, encoding='utf-8') as f:
Expand All @@ -50,18 +52,24 @@ def main(input_file: str, output: str):
'metadata': {'categories': data.metadata.categories},
}
)
ext_map_dict = None
if ext_map:
with open(ext_map, encoding='utf-8') as f:
ext_map_dict = json.load(f)

for individual, details in data.results.items():
# optionally update to point to Seqr identities
if ext_map_dict:
individual = ext_map_dict.get(individual, individual)

lil_data.results[individual] = {}
for variant in details.variants:
var_data = variant.var_data
lil_data.results[individual][
var_data.coordinates.string_format
] = MiniVariant(
lil_data.results[individual][var_data.info['seqr_link']] = MiniVariant(
**{
'categories': variant.categories,
'support_vars': variant.support_vars,
'independent': variant.independent,
'support_vars': variant.support_vars
# 'independent': variant.independent,
}
)

Expand All @@ -73,6 +81,13 @@ def main(input_file: str, output: str):
parser = ArgumentParser()
parser.add_argument('input_file', help='the input file to process')
parser.add_argument('output_file', help='the output file to write to')
parser.add_argument(
'--external_map',
help='mapping of internal to external IDs for seqr',
default=None,
type=str,
required=False,
)
args = parser.parse_args()

main(input_file=args.input_file, output=args.output_file)
main(input_file=args.input_file, output=args.output_file, ext_map=args.external_map)
5 changes: 3 additions & 2 deletions reanalysis/moi_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def run(
genotypes=self.get_family_genotypes(
variant=principal, sample_id=sample_id
),
support_vars={partner_variant.coordinates.string_format},
support_vars={partner_variant.info['seqr_link']},
flags=principal.get_sample_flags(sample_id)
| partner_variant.get_sample_flags(sample_id),
independent=False,
Expand Down Expand Up @@ -1078,7 +1078,8 @@ def run(
genotypes=self.get_family_genotypes(
variant=principal, sample_id=sample_id
),
support_vars={partner.coordinates.string_format},
# needs to comply with Seqr
support_vars={partner.info['seqr_link']},
flags=principal.get_sample_flags(sample_id)
| partner.get_sample_flags(sample_id),
independent=False,
Expand Down
2 changes: 1 addition & 1 deletion reanalysis/reanalysis_global.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ default_memory = 'highmem'

[images]
gatk = 'australia-southeast1-docker.pkg.dev/cpg-common/images/gatk:4.2.6.1'
aip = 'australia-southeast1-docker.pkg.dev/cpg-common/images/cpg_aip:3.0.2'
aip = 'australia-southeast1-docker.pkg.dev/cpg-common/images/cpg_aip:3.0.3'
vep_110 = "australia-southeast1-docker.pkg.dev/cpg-common/images/vep_110:release_110.1"
cpg_workflows = "australia-southeast1-docker.pkg.dev/cpg-common/images/cpg_workflows:latest"

Expand Down
2 changes: 1 addition & 1 deletion reanalysis/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""

# Do not edit this file manually
__version__ = '3.0.2'
__version__ = '3.0.3'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def read_reqs(filename: str) -> list[str]:
name='automated-interpretation-pipeline',
description='CPG Variant Prioritisation',
long_description=readme,
version='3.0.2',
version='3.0.3',
author='Matthew Welland, CPG',
author_email=(
'[email protected], '
Expand Down
17 changes: 11 additions & 6 deletions test/test_moi_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_recessive_autosomal_comp_het_male_passes(peddy_ped):
ab_ratios={'male': 0.5},
depths={'male': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing1'},
transcript_consequences=[],
)
passing_variant2 = SmallVariant(
Expand All @@ -264,7 +264,7 @@ def test_recessive_autosomal_comp_het_male_passes(peddy_ped):
ab_ratios={'male': 0.5},
depths={'male': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing2'},
transcript_consequences=[],
)
comp_hets = {'male': {TEST_COORDS.string_format: [passing_variant2]}}
Expand All @@ -287,7 +287,7 @@ def test_recessive_autosomal_comp_het_male_passes_partner_flag(peddy_ped):
ab_ratios={'male': 0.5},
depths={'male': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing1'},
transcript_consequences=[],
)
passing_variant2 = SmallVariant(
Expand All @@ -296,7 +296,7 @@ def test_recessive_autosomal_comp_het_male_passes_partner_flag(peddy_ped):
ab_ratios={'male': 1.0},
depths={'male': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing2'},
transcript_consequences=[],
)
comp_hets = {'male': {TEST_COORDS.string_format: [passing_variant2]}}
Expand All @@ -305,6 +305,7 @@ def test_recessive_autosomal_comp_het_male_passes_partner_flag(peddy_ped):
assert len(results) == 1
assert results[0].reasons == {'Autosomal Recessive Comp-Het'}
assert results[0].flags == {'AB Ratio'}
assert results[0].support_vars == {'passing2'}


def test_recessive_autosomal_comp_het_female_passes(peddy_ped):
Expand All @@ -321,7 +322,7 @@ def test_recessive_autosomal_comp_het_female_passes(peddy_ped):
ab_ratios={'female': 0.5},
depths={'female': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing1'},
transcript_consequences=[],
)
passing_variant2 = SmallVariant(
Expand All @@ -330,7 +331,7 @@ def test_recessive_autosomal_comp_het_female_passes(peddy_ped):
ab_ratios={'female': 0.5},
depths={'female': 50},
boolean_categories=['categoryboolean1'],
info={'gene_id': 'TEST1', 'categoryboolean1': True},
info={'gene_id': 'TEST1', 'categoryboolean1': True, 'seqr_link': 'passing2'},
transcript_consequences=[],
)
comp_hets = {'female': {TEST_COORDS.string_format: [passing_variant2]}}
Expand All @@ -339,6 +340,7 @@ def test_recessive_autosomal_comp_het_female_passes(peddy_ped):
assert len(results) == 1
assert results[0].reasons == {'Autosomal Recessive Comp-Het'}
assert not results[0].flags
assert results[0].support_vars == {'passing2'}


def test_recessive_autosomal_comp_het_fails_no_ch_return(peddy_ped):
Expand Down Expand Up @@ -573,6 +575,7 @@ def test_x_recessive_female_het_passes(peddy_ped):
info={
'gene_id': 'TEST1',
'categorysample4': ['female'],
'seqr_link': 'passing1',
},
transcript_consequences=[],
)
Expand All @@ -585,6 +588,7 @@ def test_x_recessive_female_het_passes(peddy_ped):
info={
'gene_id': 'TEST1',
'categorysample4': ['female'],
'seqr_link': 'passing2',
},
transcript_consequences=[],
)
Expand All @@ -593,6 +597,7 @@ def test_x_recessive_female_het_passes(peddy_ped):
results = x_rec.run(passing_variant, comp_het=comp_hets)
assert len(results) == 1
assert results[0].reasons == {'X_RecessiveFemaleCompHet'}
assert results[0].support_vars == {'passing2'}


def test_het_de_novo_passes(peddy_ped):
Expand Down
Loading