Skip to content

Commit

Permalink
check for constant gene impairments
Browse files Browse the repository at this point in the history
  • Loading branch information
bfclarke committed Oct 30, 2024
1 parent 229e059 commit e11a44c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions deeprvat/deeprvat/associate.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,19 @@ def make_regenie_input_(
samples=list(sample_ids.astype(str)),
metadata="Pseudovariants containing DeepRVAT gene impairment scores. One pseudovariant per gene.",
) as f:
skipped_genes = 0
for i in trange(n_genes):
varid = f"pseudovariant_gene_{ensgids[i]}"
this_burdens = burdens[:, i]
if np.all(this_burdens == this_burdens[0]):
# burdens are constant, cannot perform association testing
logger.warning(
f"Gene impairment scores for gene {i} ({ensgids[i]}) "
"are all constant. Gene will not be written to BGEN "
"and will be skipped during association testing"
)
skipped_genes += 1
continue

# Rescale scores to fill out range [0, 1] (making dosages in [0, 2])
min_burden = np.min(this_burdens)
Expand All @@ -478,6 +488,11 @@ def make_regenie_input_(
bit_depth=16,
)

if skipped_genes > 0:
logger.warning(
f"Skipped {skipped_genes} with constant gene impairment scores"
)


@cli.command()
@click.option("--debug", is_flag=True)
Expand Down

0 comments on commit e11a44c

Please sign in to comment.