gnomad.utils.liftover

gnomad.utils.liftover.GRCH37_to_GRCH38_CHAIN

Path to chain file required to lift data from GRCh37 to GRCh38.

gnomad.utils.liftover.GRCH38_TO_GRCH37_CHAIN

Path to chain file required to lift data from GRCh38 to GRCh37.

gnomad.utils.liftover.get_liftover_genome(t)

Infer reference genome build of input data and assume destination reference genome build.

gnomad.utils.liftover.liftover_expr(locus, ...)

Generate struct liftover expression.

gnomad.utils.liftover.default_lift_data(t[, ...])

Lift input Table or MatrixTable from one reference build to another.

gnomad.utils.liftover.liftover_using_gnomad_map(ht, ...)

Liftover a gnomAD v2 table using already-established liftover file.

gnomad.utils.liftover.GRCH37_to_GRCH38_CHAIN = 'gs://hail-common/references/grch37_to_grch38.over.chain.gz'

Path to chain file required to lift data from GRCh37 to GRCh38.

gnomad.utils.liftover.GRCH38_TO_GRCH37_CHAIN = 'gs://hail-common/references/grch38_to_grch37.over.chain.gz'

Path to chain file required to lift data from GRCh38 to GRCh37.

gnomad.utils.liftover.get_liftover_genome(t)[source]

Infer reference genome build of input data and assume destination reference genome build.

Adds liftover chain to source reference genome and sequence to destination reference genome. Returns tuple containing both reference genomes in preparation for liftover.

Parameters:

t (Union[MatrixTable, Table]) – Input Table or MatrixTable.

Return type:

Tuple[ReferenceGenome, ReferenceGenome]

Returns:

Tuple of source reference genome (with liftover chain added) and destination reference genome (with sequence loaded)

gnomad.utils.liftover.liftover_expr(locus, alleles, destination_reference)[source]

Generate struct liftover expression.

Struct contains:
  • locus: Liftover coordinates

  • alleles: Liftover alleles

  • original_locus: Locus prior to liftover

  • original_alleles: Alleles prior to liftover

  • locus_fail_liftover: Whether the locus failed liftover

  • ref_allele_mismatch: Whether the allele at index 0 of alleles (lifted over reference allele)

    doesn’t match the allele at that position in the destination reference

Parameters:
Return type:

StructExpression

Returns:

Struct containing expressions for lifted over locus/alleles as well as original locus/alleles.

gnomad.utils.liftover.default_lift_data(t, remove_failed_sites=True)[source]

Lift input Table or MatrixTable from one reference build to another.

Parameters:
  • t (Union[MatrixTable, Table]) – Table or MatrixTable.

  • remove_failed_sites (bool) –

Return type:

Union[MatrixTable, Table]

Returns:

Table or MatrixTable with liftover annotations.

gnomad.utils.liftover.liftover_using_gnomad_map(ht, data_type)[source]

Liftover a gnomAD v2 table using already-established liftover file.

Note

This function shuffles!

Parameters:
  • ht (Table) – Input Hail Table.

  • data_type (str) – Which gnomAD data type to map across. One of “exomes” or “genomes”.

Returns:

Lifted over Table