Skip to content
Merged

Dev #5364

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
308 commits
Select commit Hold shift + click to select a range
f3afb34
remove family samples selector
hanars Feb 13, 2026
ba53408
scope down family samples selector
hanars Feb 13, 2026
bde77c4
remove final samples seelctor
hanars Feb 13, 2026
e7c8e7b
fix bug with partial load families
hanars Feb 13, 2026
baacd0a
fix test
hanars Feb 13, 2026
302d183
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sam…
hanars Feb 17, 2026
a8f88c5
better selectors
hanars Feb 17, 2026
86e40c5
properly handle project agg val
hanars Feb 17, 2026
33ed4e6
Merge branch 'es-deprecation' of https://github.com/broadinstitute/se…
hanars Feb 25, 2026
b2555d7
Merge branch 'es-deprecation' of https://github.com/broadinstitute/se…
hanars Feb 26, 2026
5c15bfc
clean up
hanars Feb 26, 2026
9950a56
fix tests
hanars Feb 26, 2026
afa8051
helper clean up
hanars Feb 26, 2026
a0ac95c
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sin…
hanars Mar 3, 2026
6eab119
cleanup shared helper
hanars Mar 3, 2026
eb2982b
codacy
hanars Mar 3, 2026
e00de7d
Merge branch 'dev' of https://github.com/broadinstitute/seqr into es-…
hanars Mar 3, 2026
f256a31
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sam…
hanars Mar 3, 2026
ea2cdba
fixx typo
hanars Mar 3, 2026
28a5703
Merge branch 'dev' of https://github.com/broadinstitute/seqr into es-…
hanars Mar 4, 2026
6b7ea89
condense variant looku test
hanars Mar 4, 2026
ab2420e
condense single search test
hanars Mar 4, 2026
cbd42ae
clean up
hanars Mar 4, 2026
186a05a
Merge branch 'dev' of https://github.com/broadinstitute/seqr into es-…
hanars Mar 5, 2026
d016655
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sin…
hanars Mar 5, 2026
2a6d509
move coe invalid search tests;
hanars Mar 5, 2026
a853b5a
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sin…
hanars Mar 5, 2026
f6e0aec
move some invalid search tests
hanars Mar 5, 2026
c87d5da
Merge pull request #5314 from broadinstitute/es-conditional-deprecation
hanars Mar 5, 2026
974ec01
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sin…
hanars Mar 5, 2026
3a0b802
Merge branch 'single-backend-decorator-deprecation' of https://github…
hanars Mar 5, 2026
c7f5e68
delete es code
hanars Mar 5, 2026
6a668af
improve coverage
hanars Mar 5, 2026
d3dfc5a
Merge branch 'es-search-deprecation' of https://github.com/broadinsti…
hanars Mar 5, 2026
41988c9
remove unused import
hanars Mar 5, 2026
d985930
move some invalid search tests
hanars Mar 5, 2026
7b94453
Merge branch 'single-backend-decorator-deprecation' of https://github…
hanars Mar 5, 2026
3fe0f3b
settings and kibana clean up
hanars Mar 5, 2026
a008055
remove es python packages
hanars Mar 5, 2026
0453e25
handle invalid tissue and report all errors per sample
hanars Mar 5, 2026
6818a88
Merge branch 'es-search-deprecation' of https://github.com/broadinsti…
hanars Mar 5, 2026
01e98a4
move invalid search tests
hanars Mar 5, 2026
40237c2
deprecate skip_genotype_filter
hanars Mar 5, 2026
201938f
test pagination
hanars Mar 5, 2026
203f773
annotation test move;
hanars Mar 5, 2026
d0ff2ce
test exclude sv behavior
hanars Mar 5, 2026
2f269bd
move cache tests
hanars Mar 6, 2026
4556320
remove old utils tests
hanars Mar 6, 2026
3886a86
Merge pull request #5334 from broadinstitute/remove-es-requirements
hanars Mar 6, 2026
25016f0
Merge pull request #5333 from broadinstitute/es-settings-cleanup
hanars Mar 6, 2026
803da0e
Merge pull request #5332 from broadinstitute/es-search-deprecation
hanars Mar 6, 2026
923be9c
pr feedback
hanars Mar 6, 2026
ac8b0eb
Merge pull request #5324 from broadinstitute/single-backend-decorator…
hanars Mar 6, 2026
93bce35
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sea…
hanars Mar 6, 2026
b09f3b7
fix tests
hanars Mar 6, 2026
bf966a1
Merge pull request #5336 from broadinstitute/invalid-rna-tissue
hanars Mar 6, 2026
b56de27
first pass
hanars Mar 6, 2026
c71d218
fix helpers
hanars Mar 9, 2026
f847aed
test empty
hanars Mar 9, 2026
a21e66a
gene lookup test update
hanars Mar 9, 2026
5662f5c
adjust searches for missed discoveries
hanars Mar 9, 2026
3c964cf
adjust multi dt quality filter
hanars Mar 9, 2026
9097a72
fix per gene behavior for mane vs canonical
hanars Mar 9, 2026
f519405
fix tests
hanars Mar 9, 2026
f4ed4da
clean up
hanars Mar 9, 2026
6f9dc82
fix check auth behavior
hanars Mar 9, 2026
f91cee3
gene counts test
hanars Mar 10, 2026
d146cfe
37 tests
hanars Mar 10, 2026
540f984
Merge pull request #5339 from broadinstitute/seqr-priority-adjustments-2
hanars Mar 10, 2026
b95d055
Merge pull request #5326 from broadinstitute/samples-to-dataset-selec…
hanars Mar 10, 2026
bf4b11d
Merge pull request #5338 from broadinstitute/search-util-test-cleanup
hanars Mar 10, 2026
db3ec46
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sea…
hanars Mar 10, 2026
a9908a7
handle individuals with no loaded data
hanars Mar 10, 2026
6e66268
Merge pull request #5342 from broadinstitute/family-datasets-ui-error
hanars Mar 10, 2026
70184ce
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sea…
hanars Mar 10, 2026
0dbe5d5
standard search test
hanars Mar 10, 2026
8b76202
add efaults
hanars Mar 10, 2026
9278aab
mmore test updates
hanars Mar 10, 2026
1ede9c6
fix exclude previous tests
hanars Mar 10, 2026
9946575
more test updates
hanars Mar 10, 2026
41a33b6
invalid search tests
hanars Mar 10, 2026
e22199d
codacy and test fixes
hanars Mar 10, 2026
bbe9806
fix test
hanars Mar 10, 2026
312a718
test pagination
hanars Mar 10, 2026
c6c4b2d
codacy
hanars Mar 10, 2026
2da5234
move error searches
hanars Mar 11, 2026
d63ee66
add test for search context
hanars Mar 11, 2026
b22c64a
test context
hanars Mar 11, 2026
33c9816
test project families context
hanars Mar 11, 2026
0f1caaf
omim interval context
hanars Mar 11, 2026
7f597e3
test export
hanars Mar 11, 2026
8b84a2f
test tag export
hanars Mar 11, 2026
e48a41e
test updates
hanars Mar 11, 2026
53508b1
caceh mock clean up
hanars Mar 11, 2026
07cda35
chore: clinvar send invalid enumerated values to slack (#5344)
bpblanken Mar 11, 2026
19c94be
test discovery tags
hanars Mar 11, 2026
aab0f63
test all project search
hanars Mar 11, 2026
cf1a66e
more test merging
hanars Mar 11, 2026
9010c0c
move single variants handle test
hanars Mar 11, 2026
38911e5
clean up
hanars Mar 11, 2026
ea1d9cd
fix test
hanars Mar 11, 2026
ea0a403
clean up
hanars Mar 11, 2026
b22d128
more variant lookup clean up
hanars Mar 12, 2026
74ea1f8
better helper function
hanars Mar 12, 2026
e0fe5bb
sv lookup test
hanars Mar 13, 2026
acf5b86
fix lookup test
hanars Mar 13, 2026
715286d
clean up
hanars Mar 13, 2026
b96dea9
update lookup test;
hanars Mar 13, 2026
86eb8c9
add lookup test coverage
hanars Mar 13, 2026
b019db3
cache test
hanars Mar 13, 2026
8204115
clean up
hanars Mar 13, 2026
6c1dd30
cleaner helper function for all variant query
hanars Mar 13, 2026
fc47e90
clean uo es configs
hanars Mar 13, 2026
6015b11
cleaner format export logic
hanars Mar 13, 2026
ace51cd
clean up
hanars Mar 13, 2026
4ebc95f
export geen symbol
hanars Mar 13, 2026
7ab31ae
clean up
hanars Mar 13, 2026
b814068
codacy
hanars Mar 13, 2026
1211c37
codacy
hanars Mar 13, 2026
b6bbbd7
codacy complexity
hanars Mar 13, 2026
2d5a936
readability
hanars Mar 13, 2026
90037c8
Bump pyjwt from 2.8.0 to 2.12.0
dependabot[bot] Mar 14, 2026
536a16b
Merge pull request #5346 from broadinstitute/dependabot/pip/pyjwt-2.12.0
hanars Mar 16, 2026
2f4025b
flag missing coverage;
hanars Mar 16, 2026
ba6b14c
properly test hgmd sort
hanars Mar 16, 2026
0e71a8c
properly test body for exclude previous
hanars Mar 16, 2026
a0021a0
clean up
hanars Mar 16, 2026
8a4eede
test delete gcnv data
hanars Mar 16, 2026
00d7d93
clean up
hanars Mar 16, 2026
7855f52
api cleanup
hanars Mar 16, 2026
e903737
remove handling for multi genome build searches
hanars Mar 16, 2026
390a93e
clean up
hanars Mar 16, 2026
3aa89f9
deprecate no key multi gene discovery variants
hanars Mar 16, 2026
d9f73b4
clean up
hanars Mar 16, 2026
d1d0743
fixture clean up
hanars Mar 16, 2026
59bfb89
fix set key tests
hanars Mar 16, 2026
9da73b9
remove inaccurate docstring
hanars Mar 16, 2026
d31a3e7
restore gene lookup page;
hanars Mar 16, 2026
e186172
top level variant lookup
hanars Mar 16, 2026
5130a0f
add gene lookup page
hanars Mar 16, 2026
7b59e33
handle both pages
hanars Mar 16, 2026
5c7db3e
format gene search data properly
hanars Mar 16, 2026
476f412
better helper message
hanars Mar 16, 2026
77adc55
clean up
hanars Mar 16, 2026
13675da
unnest send email route
hanars Mar 16, 2026
983368e
Merge pull request #5343 from broadinstitute/search-test-cleanup
hanars Mar 16, 2026
7dacf41
Merge pull request #5345 from broadinstitute/export-search-cleanup
hanars Mar 16, 2026
9683443
Merge branch 'dev' of https://github.com/broadinstitute/seqr into top…
hanars Mar 16, 2026
b677ec5
fix duplicate key
hanars Mar 16, 2026
77ec338
pr feedback
hanars Mar 16, 2026
d12a937
Merge branch 'top-level-search-pages' of https://github.com/broadinst…
hanars Mar 16, 2026
4e013c6
inline sample parsign and validation
hanars Mar 16, 2026
f0c22a5
dataset type cleanup
hanars Mar 17, 2026
7fb1e54
clean up
hanars Mar 17, 2026
a42b283
clean up
hanars Mar 17, 2026
f69f570
clean up
hanars Mar 17, 2026
a0c445b
clean up
hanars Mar 17, 2026
c0b061c
move search excpetion
hanars Mar 17, 2026
6e3acf2
clean up
hanars Mar 17, 2026
6ebfb4b
clean up
hanars Mar 17, 2026
e25d0b9
fix tests
hanars Mar 17, 2026
6058f1e
clean up
hanars Mar 17, 2026
92dd74d
add error handling for unmapped clickhouse lookup samples
hanars Mar 17, 2026
003b558
pr comment feedback
hanars Mar 17, 2026
adf22dd
Merge pull request #5352 from broadinstitute/no-lookup-sample-error-h…
hanars Mar 17, 2026
6164a63
move sample logic into clickhouse search
hanars Mar 17, 2026
2131ad4
clean up
hanars Mar 17, 2026
71e6317
fix comp het type validation
hanars Mar 17, 2026
49fdf6a
fix args
hanars Mar 17, 2026
cec21dc
codacy
hanars Mar 17, 2026
d30860c
codacy
hanars Mar 18, 2026
4876873
Apply suggestions from code review
hanars Mar 18, 2026
2d366f6
Revert "Apply suggestions from code review"
hanars Mar 18, 2026
71c16e7
properly apply code review
hanars Mar 18, 2026
5d6a6e0
add high splice ai x linked prioritized searches
hanars Mar 18, 2026
8b65d13
fix family search ui error
hanars Mar 18, 2026
6d14bfc
Merge pull request #5353 from broadinstitute/prioirtixed-x-linked-spl…
hanars Mar 18, 2026
296f808
separate manual variant creation endpoint
hanars Mar 18, 2026
084b6ba
implement manual vvariant creation from unparsed
hanars Mar 18, 2026
44e462e
clean up parsing json
hanars Mar 18, 2026
15b841b
Merge pull request #5354 from broadinstitute/family-search-ui-error
hanars Mar 18, 2026
3e4fa0c
fix genes
hanars Mar 18, 2026
2a1a728
bulk save gregor variants;
hanars Mar 18, 2026
11c960d
fix summary data bulk
hanars Mar 18, 2026
c1e395e
test manual variants
hanars Mar 18, 2026
e7f00eb
fix test
hanars Mar 18, 2026
31ade91
fix tests
hanars Mar 18, 2026
8613f29
move search variant logic to tighter scope
hanars Mar 19, 2026
bb96d70
explicitly se saved variant json for parsing
hanars Mar 19, 2026
0b58377
better heloer separation
hanars Mar 19, 2026
9e7ca36
Apply suggestions from code review
hanars Mar 19, 2026
f96c90a
pr feedback
hanars Mar 19, 2026
5702bb8
Merge branch 'saved-variant-detail-fields' of https://github.com/broa…
hanars Mar 19, 2026
60d639f
add and populate saved variant summary cols
hanars Mar 19, 2026
c5d9124
fix sleected transcript fallback
hanars Mar 19, 2026
6211441
clean up
hanars Mar 19, 2026
b14f95e
clean up
hanars Mar 19, 2026
94909aa
Merge pull request #5348 from broadinstitute/coverage-cleanup
hanars Mar 19, 2026
06f9dbb
Merge pull request #5349 from broadinstitute/saved-variant-fixture-cl…
hanars Mar 19, 2026
756ce65
Merge pull request #5350 from broadinstitute/top-level-search-pages
hanars Mar 19, 2026
aaf15b2
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sav…
hanars Mar 19, 2026
09abc6b
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sea…
hanars Mar 19, 2026
a1df860
Merge branch 'saved-variant-detail-fields' of https://github.com/broa…
hanars Mar 19, 2026
b518f6b
use model fields instead of clickhouse
hanars Mar 19, 2026
d888271
update fixtures
hanars Mar 19, 2026
e9d3f22
clean up saved variant json usage
hanars Mar 19, 2026
d8e1e7a
remove unused imports
hanars Mar 19, 2026
2638c66
actually save new fields
hanars Mar 19, 2026
a1ee74b
properly update main transcript
hanars Mar 19, 2026
7a4cdfd
fix definition error
hanars Mar 20, 2026
b84e217
fix fixtures
hanars Mar 20, 2026
76d7492
report metadata adjustments
hanars Mar 20, 2026
a9eed9f
fix set key tests
hanars Mar 20, 2026
6043b70
fix discovery genes;
hanars Mar 20, 2026
527e652
clean up
hanars Mar 20, 2026
f568328
clean up
hanars Mar 20, 2026
d869961
first pass caid clean up
hanars Mar 20, 2026
3dc804a
fix report clickhouse metadata
hanars Mar 20, 2026
e9336e8
fix test
hanars Mar 20, 2026
26927f0
clean up
hanars Mar 20, 2026
2ad5a03
fix migration
hanars Mar 20, 2026
5b583a2
Apply suggestions from code review
hanars Mar 20, 2026
2eb7b6c
clean up caching
hanars Mar 20, 2026
2ad3226
move constants
hanars Mar 20, 2026
89a0222
move file
hanars Mar 20, 2026
15f4ca2
fix test
hanars Mar 20, 2026
eda07f1
undo signature change
hanars Mar 20, 2026
ce68243
clean up
hanars Mar 20, 2026
75393ff
Merge pull request #5351 from broadinstitute/search-sample-clean-up
hanars Mar 23, 2026
b050788
Merge pull request #5359 from broadinstitute/search-constants-clean-up
hanars Mar 23, 2026
cff691e
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sav…
hanars Mar 23, 2026
3b21819
Merge branch 'saved-variant-detail-fields' of https://github.com/broa…
hanars Mar 23, 2026
cee669f
Merge branch 'saved-variant-model-fields' of https://github.com/broad…
hanars Mar 23, 2026
bb04e68
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sea…
hanars Mar 23, 2026
4877f9f
shared helper for single variant search
hanars Mar 24, 2026
d45732f
shared search helper
hanars Mar 24, 2026
7f79019
update liogging tests
hanars Mar 24, 2026
c620a4d
update liogging tests
hanars Mar 24, 2026
e004f10
fix log tests
hanars Mar 24, 2026
3b23ad7
fix log tests
hanars Mar 24, 2026
5f95dd0
fix multi dt searches
hanars Mar 24, 2026
508f76b
Merge pull request #5356 from broadinstitute/saved-variant-model-fields
hanars Mar 25, 2026
961980d
Merge pull request #5355 from broadinstitute/saved-variant-detail-fields
hanars Mar 25, 2026
7a0782c
Merge pull request #5358 from broadinstitute/search-cache-cleanup
hanars Mar 25, 2026
0de3e9a
Merge branch 'dev' of https://github.com/broadinstitute/seqr into sha…
hanars Mar 25, 2026
5718a9b
fix merge conflict
hanars Mar 25, 2026
903b963
Merge pull request #5361 from broadinstitute/shared-search-helper-func
hanars Mar 25, 2026
31838d5
Bump picomatch from 2.3.1 to 2.3.2 in /ui
dependabot[bot] Mar 25, 2026
e0f021e
Merge pull request #5362 from broadinstitute/dependabot/npm_and_yarn/…
hanars Mar 26, 2026
fdeb182
remove unused import
hanars Mar 26, 2026
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
5 changes: 3 additions & 2 deletions clickhouse_search/backend/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from clickhouse_search.backend.fields import NestedField


class Array(Func):
function = 'array'

Expand Down Expand Up @@ -124,9 +125,9 @@ def as_sql(self, compiler, connection, *args, **kwargs):


class ArrayIndex(IndexTransform):
def __init__(self, index, *args, **kwargs):
def __init__(self, index, *args, base_field=None, **kwargs):
super().__init__(index+1, None, *args, **kwargs)
self.base_field = self.source_expressions[0].output_field.base_field
self.base_field = base_field or self.source_expressions[0].output_field.base_field


@ArrayField.register_lookup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from seqr.models import Individual

VCF_FILE_EXTENSIONS = ('.vcf', '.vcf.gz', '.vcf.bgz')

MAX_VARIANTS = 10000
MAX_EXPORT_VARIANTS = 1000
MAX_NO_LOCATION_COMP_HET_FAMILIES = 100

XPOS_SORT_KEY = 'xpos'
PATHOGENICTY_SORT_KEY = 'pathogenicity'
Expand Down Expand Up @@ -65,7 +61,6 @@
SV_CONSEQUENCES_FIELD = 'structural_consequence'
SV_TYPE_FILTER_FIELD = 'structural'
SV_ANNOTATION_TYPES = {SV_CONSEQUENCES_FIELD, SV_TYPE_FILTER_FIELD, NEW_SV_FIELD}
ALL_DATA_TYPES = 'ALL'

CLINVAR_KEY = 'clinvar'
CLINVAR_PATH_FILTER = 'pathogenic'
Expand Down
24 changes: 24 additions & 0 deletions clickhouse_search/fixtures/clickhouse_saved_variants.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,30 @@
[1, ["frameshift_variant"], "ENSG00000228198"]
]
}
}, {
"model": "clickhouse_search.variantdetailsgrch37snvindel",
"pk": 113,
"fields": {
"key": 113,
"variant_id": "15-62456358-A-C",
"rsid": null,
"caid": null,
"lifted_over_chrom": null,
"lifted_over_pos": null,
"transcripts": []
}
}, {
"model": "clickhouse_search.variantdetailsgrch37snvindel",
"pk": 114,
"fields": {
"key": 114,
"variant_id": "15-62456406-G-A",
"rsid": null,
"caid": null,
"lifted_over_chrom": null,
"lifted_over_pos": null,
"transcripts": []
}
}, {
"model": "clickhouse_search.entriesgrch37snvindel",
"pk": 101,
Expand Down
44 changes: 40 additions & 4 deletions clickhouse_search/fixtures/clickhouse_search.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
"sorted_motif_feature_consequences": [],
"sorted_regulatory_feature_consequences": []
}
}, {
"model": "clickhouse_search.variantssnvindel",
"pk": 23,
"fields": {
"key": 23,
"sorted_transcript_consequences": [
[null, 1, ["missense_variant"], false, null, "ENSG00000227232", false],
[null, 1, ["intron_variant"], false, null, "ENSG00000268903", false]
],
"sorted_motif_feature_consequences": [],
"sorted_regulatory_feature_consequences": []
}
}, {
"model": "clickhouse_search.keylookupsnvindel",
"pk": "1-10439-AC-A",
Expand Down Expand Up @@ -125,6 +137,12 @@
"key": 22
}
}, {
"model": "clickhouse_search.keylookupsnvindel",
"pk": "21-3343353-GAGA-G",
"fields": {
"key": 23
}
},{
"model": "clickhouse_search.clinvarallvariantssnvindel",
"pk": "1-10439-AC-A",
"fields": {
Expand Down Expand Up @@ -860,6 +878,24 @@
["NA21654", 0, 0, 0, 24]
]
}
}, {
"model": "clickhouse_search.entriessnvindel",
"pk": 23,
"fields": {
"key": 23,
"project_guid": "R0001_1kg",
"family_guid": "F000001_1",
"sample_type": "WES",
"xpos": 21003343353,
"is_gnomad_gt_5_percent": false,
"is_annotated_in_any_gene": true,
"geneId_ids": [2],
"filters": [],
"sign": 1,
"calls": [
["NA19678", 1, 0, 0.16, 45]
]
}
}, {
"model": "clickhouse_search.variantsgrch37snvindel",
"pk": 10,
Expand Down Expand Up @@ -1418,9 +1454,9 @@
"geneId_ids": [76],
"sign": 1,
"calls": [
["NA21234", 2, 0, 99, false, true, null],
["NA21987", 1, 1, 99, false, false, 2],
["NA21654", 1, 1, 99, false, false, 2]
["NA21654", 1, 1, 99, false, false, 2],
["NA21234", 2, 0, 99, false, true, null]
]
}
}, {
Expand Down Expand Up @@ -1589,9 +1625,9 @@
"filters": [],
"sign": 1,
"calls": [
["HG00731", 1, 3, 28, false, 38721781, 38735703, 7, ["ENSG00000275023", "ENSG00000277258", "ENSG00000277972"], false, true, false],
["HG00733", 1, 3, 29, false, 38721781, 38734440, 7, ["ENSG00000275023", "ENSG00000277258", "ENSG00000277972"], false, true, false],
["HG00732", null, null, null, null, null, null, null, [], null, null, null],
["HG00733", 1, 3, 29, false, 38721781, 38734440, 7, ["ENSG00000275023", "ENSG00000277258", "ENSG00000277972"], false, true, false]
["HG00731", 1, 3, 28, false, 38721781, 38735703, 7, ["ENSG00000275023", "ENSG00000277258", "ENSG00000277972"], false, true, false]
]
}
}, {
Expand Down
43 changes: 43 additions & 0 deletions clickhouse_search/fixtures/clickhouse_transcripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,48 @@
]
]
}
}, {
"model": "clickhouse_search.variantdetailssnvindel",
"pk": 23,
"fields": {
"key": 23,
"variant_id": "21-3343353-GAGA-G",
"rsid": null,
"caid": null,
"lifted_over_chrom": null,
"lifted_over_pos": null,
"sorted_motif_feature_consequences": [],
"sorted_regulatory_feature_consequences": [],
"transcripts": [
[
[null], "T/I", "protein_coding", 1, "aCc/aTc", ["missense_variant"], [1, 12], "ENSG00000227232",
"ENST00000257261.10:c.131C>T", "ENSP00000257261.6:p.Thr44Ile", [null, null], [null, []], "missense_variant",
null, null, "NM_001281501.1", [false], "ENST00000257261", 0, [null, null, null, [
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null
], null]
],
[
[null], null, "protein_coding", null, null, ["intron_variant"], [null, null], "ENSG00000268903",
"ENST00000426137.1:c.-64+100G>A", null, [1, 5], [null, []], "intron_variant", null, null, null, [false],
"ENST00000426137", 0, [null, null, null, [
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null
], null]
]
]
}
}, {
"model": "clickhouse_search.variantdetailssnvindel",
"pk": 100,
"fields": {
"key": 100,
"variant_id": "1-248367227-TC-T",
"rsid": null,
"caid": null,
"lifted_over_chrom": null,
"lifted_over_pos": null,
"sorted_motif_feature_consequences": [],
"sorted_regulatory_feature_consequences": [],
"transcripts": []
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def parse_positions(classified_record_node: xml.etree.ElementTree.Element) -> di
}
return positions

def parse_pathogenicity_and_assertions(classified_record_node: xml.etree.ElementTree.Element) -> [str, list[str]]:
def parse_pathogenicity_and_assertions(classified_record_node: xml.etree.ElementTree.Element, allele_id: int, unenumerated_value_alerts: list) -> [str, list[str]]:
pathogenicity_node = classified_record_node.find(
'Classifications/GermlineClassification/Description',
)
Expand Down Expand Up @@ -133,15 +133,23 @@ def parse_pathogenicity_and_assertions(classified_record_node: xml.etree.Element
assertions = [a.strip() for a in pathogenicity_string.split(';')]

enumerated_assertions = set(CLINVAR_ASSERTIONS)
filtered_assertions = []
for assertion in assertions:
if assertion not in enumerated_assertions:
raise CommandError(f'Found an un-enumerated clinvar assertion: {assertion}')

return pathogenicity, assertions
unenumerated_value_alerts.append({
'type': 'Assertion',
'allele_id': allele_id,
'value': assertion,
})
else:
filtered_assertions.append(assertion)
return pathogenicity, filtered_assertions

def parse_conflicting_pathogenicities(
classified_record_node: xml.etree.ElementTree.Element,
pathogenicity: str,
allele_id: int,
unenumerated_value_alerts: list,
) -> list[[str, int]]:
if pathogenicity == CLINVAR_CONFLICTING_CLASSICATIONS_OF_PATHOGENICITY:
conflicting_pathogenicities_node = classified_record_node.find(
Expand All @@ -159,10 +167,17 @@ def parse_conflicting_pathogenicities(
conflicting_pathogenicities_node.text
)
enumerated_pathogenicities = set(CLINVAR_PATHOGENICITIES)
for (pathogenicity, _) in conflicting_pathogenicities:
filtered_pathogenicities = []
for (pathogenicity, count) in conflicting_pathogenicities:
if pathogenicity not in enumerated_pathogenicities:
raise CommandError(f'Found an un-enumerated conflicting pathogenicity: {pathogenicity}')
return conflicting_pathogenicities
unenumerated_value_alerts.append({
'type': 'Conflicting Pathogenicity',
'allele_id': allele_id,
'value': pathogenicity,
})
else:
filtered_pathogenicities.append((pathogenicity, count))
return filtered_pathogenicities

def parse_gold_stars(classified_record_node: xml) -> Optional[int]:
review_status_node = classified_record_node.find(
Expand All @@ -189,7 +204,7 @@ def parse_submitters_and_conditions(classified_record_node: xml) -> [list[str],
})
return submitters, conditions

def extract_variant_info(elem: xml.etree.ElementTree.Element, new_version: str) -> tuple[models.ClickhouseModel, models.ClickhouseModel, models.ClickhouseModel]:
def extract_variant_info(elem: xml.etree.ElementTree.Element, new_version: str, unenumerated_value_alerts: Optional[list] = None) -> tuple[models.ClickhouseModel, models.ClickhouseModel, models.ClickhouseModel]:
# Cannot use regular bool-falseyness here, as:
# "An element with no child elements (even if it exists and has text) will be falsey."
classified_record_node = elem.find('ClassifiedRecord')
Expand All @@ -202,8 +217,8 @@ def extract_variant_info(elem: xml.etree.ElementTree.Element, new_version: str)
if not positions:
return None, None, None

pathogenicity, assertions = parse_pathogenicity_and_assertions(classified_record_node)
conflicting_pathogenicities = parse_conflicting_pathogenicities(classified_record_node, pathogenicity)
pathogenicity, assertions = parse_pathogenicity_and_assertions(classified_record_node, allele_id, unenumerated_value_alerts)
conflicting_pathogenicities = parse_conflicting_pathogenicities(classified_record_node, pathogenicity, allele_id, unenumerated_value_alerts)
gold_stars = parse_gold_stars(classified_record_node)
submitters, conditions = parse_submitters_and_conditions(classified_record_node)
# Note: this manipulation to an enumerated pathogenicty happens after we parse conflicting pathogenicities.
Expand Down Expand Up @@ -247,6 +262,7 @@ def handle(self, *args, **options):
ClinvarAllVariantsSnvIndel: [],
ClinvarAllVariantsMito: [],
}
unenumerated_value_alerts = []
new_version = None
with tempfile.TemporaryDirectory() as tmpdir:
with requests.get(WEEKLY_XML_RELEASE, stream=True, timeout=10) as r, \
Expand Down Expand Up @@ -276,7 +292,7 @@ def handle(self, *args, **options):
)
# Handle parsing variants
if event == 'end' and elem.tag == 'VariationArchive' and new_version:
for obj in extract_variant_info(elem, new_version):
for obj in extract_variant_info(elem, new_version, unenumerated_value_alerts):
for model, batch in model_to_batch.items():
if isinstance(obj, model):
batch.append(obj)
Expand Down Expand Up @@ -316,4 +332,10 @@ def handle(self, *args, **options):
version=new_version
)
slack_message = f'Successfully updated Clinvar ClickHouse tables to {new_version}.'
if unenumerated_value_alerts:
slack_message += f'\n\nFound {len(unenumerated_value_alerts)} unenumerated value(s) during parsing:'
for alert in unenumerated_value_alerts[:10]:
slack_message += f"\n- {alert['type']}: '{alert['value']}' (Allele ID: {alert['allele_id']})"
if len(unenumerated_value_alerts) > 10:
slack_message += f"\n• ... and {len(unenumerated_value_alerts) - 10} more"
safe_post_to_slack(SEQR_SLACK_DATA_ALERTS_NOTIFICATION_CHANNEL, slack_message)
Loading
Loading