gnomad.utils.gen_stats

gnomad.utils.gen_stats.to_phred(linear_expr)

Compute the phred-scaled value of the linear-scale input.

gnomad.utils.gen_stats.from_phred(...)

Compute the linear-scale value of the phred-scaled input.

gnomad.utils.gen_stats.get_median_and_mad_expr(...)

Compute the median and median absolute deviation (MAD) for the given expression.

gnomad.utils.gen_stats.merge_stats_counters_expr(stats)

Merge multiple stats counters, assuming that they were computed on non-overlapping data.

gnomad.utils.gen_stats.to_phred(linear_expr)[source]

Compute the phred-scaled value of the linear-scale input.

Parameters:

linear_expr (NumericExpression) – input

Return type:

Float64Expression

Returns:

Phred-scaled value

gnomad.utils.gen_stats.from_phred(phred_score_expr)[source]

Compute the linear-scale value of the phred-scaled input.

Parameters:

phred_score_expr (NumericExpression) – phred-scaled value

Return type:

Float64Expression

Returns:

linear-scale value of the phred-scaled input.

gnomad.utils.gen_stats.get_median_and_mad_expr(metric_expr, k=1.4826)[source]

Compute the median and median absolute deviation (MAD) for the given expression.

..note:

The default value of k assumes normally distributed data.
Parameters:
  • metric_expr (ArrayNumericExpression) – Expression to compute median and MAD for

  • k (float) – The scaling factor for MAD calculation. Default assumes normally distributed data.

Return type:

StructExpression

Returns:

Struct with median and MAD

gnomad.utils.gen_stats.merge_stats_counters_expr(stats)[source]

Merge multiple stats counters, assuming that they were computed on non-overlapping data.

Examples: - Merge stats computed on indel and snv separately - Merge stats computed on bi-allelic and multi-allelic variants separately - Merge stats computed on autosomes and sex chromosomes separately

Parameters:

stats (ArrayExpression) – An array of stats counters to merge

Return type:

StructExpression

Returns:

Merged stats Struct