Skip to content

Commit 3b1515c

Browse files
authored
backwards compatible entries format (#1215)
1 parent f0e8e60 commit 3b1515c

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

v03_pipeline/lib/misc/clickhouse.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -649,23 +649,28 @@ def insert_new_entries(
649649
if 'geneId_ids' in dst_cols and 'geneIds' in src_cols:
650650
common = [c for c in common if c not in ('geneId_ids', 'geneIds')]
651651
common.append('geneId_ids')
652-
overrides = {
653-
'geneId_ids': (
654-
f"""
655-
arrayFilter(
656-
x -> x IS NOT NULL,
657-
arrayMap(
658-
g -> dictGetOrNull(
659-
{Env.CLICKHOUSE_DATABASE}.`seqrdb_gene_ids`,
660-
'seqrdb_id',
661-
g
662-
),
663-
geneIds
664-
)
652+
overrides['geneId_ids'] = f"""
653+
arrayFilter(
654+
x -> x IS NOT NULL,
655+
arrayMap(
656+
g -> dictGetOrNull(
657+
{Env.CLICKHOUSE_DATABASE}.`seqrdb_gene_ids`,
658+
'seqrdb_id',
659+
g
660+
),
661+
geneIds
665662
)
666-
"""
667-
),
668-
}
663+
)
664+
"""
665+
666+
if (
667+
'is_gnomad_gt_5_percent' in dst_cols
668+
and 'is_gnomad_gt_5_percent' not in src_cols
669+
):
670+
common.append('is_gnomad_gt_5_percent')
671+
overrides['is_gnomad_gt_5_percent'] = f"""
672+
dictGetOrDefault({ClickhouseReferenceDataset.GNOMAD_GENOMES.search_path(table_name_builder)}, 'filter_af', key, 0) > 0.05
673+
"""
669674
dst_list = ', '.join(common)
670675
src_list = ', '.join([overrides.get(c, c) for c in common])
671676
logged_query(

v03_pipeline/lib/tasks/exports/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def get_entries_export_fields(
152152
False,
153153
),
154154
}
155-
if dataset_type == DatasetType.SNV_INDEL
155+
if dataset_type == DatasetType.SNV_INDEL and hasattr(ht, 'gnomad_genomes')
156156
else {}
157157
),
158158
**(

0 commit comments

Comments
 (0)