def liftover_using_gnomad_map(ht, data_type): """ Liftover a gnomAD table using already-established liftover file. Warning: shuffles! :param ht: Input Hail table :param data_type: one of "exomes" or "genomes" which to map across :return: Lifted over table """ from gnomad.resources.grch37.gnomad import liftover lift_ht = liftover(data_type).ht() ht = ht.key_by(original_locus=ht.locus, original_alleles=ht.alleles).drop('locus', 'alleles') return lift_ht.annotate(**ht[(lift_ht.original_locus, lift_ht.original_alleles)]).key_by( 'locus', 'alleles')
def liftover_using_gnomad_map(ht: hl.Table, data_type: str): """ Liftover a gnomAD v2 table using already-established liftover file. .. note:: This function shuffles! :param ht: Input Hail Table. :param data_type: Which gnomAD data type to map across. One of "exomes" or "genomes". :return: Lifted over Table """ from gnomad.resources.grch37.gnomad import liftover logger.warning( "This function will trigger a shuffle! Pre-emptibles may not work.") lift_ht = liftover(data_type).ht() ht = ht.key_by(original_locus=ht.locus, original_alleles=ht.alleles).drop("locus", "alleles") return lift_ht.annotate(**ht[(lift_ht.original_locus, lift_ht.original_alleles)]).key_by( "locus", "alleles")