Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic liftover #190

Closed
lfrancioli opened this issue Mar 9, 2020 · 5 comments
Closed

Generic liftover #190

lfrancioli opened this issue Mar 9, 2020 · 5 comments
Assignees

Comments

@lfrancioli
Copy link
Contributor

Right now much of the code in utils.liftover is specific (or has specific options) for gnomad; specific parts should be moved to gnomad_qc.v2 and all there should be generic.

I also think that checkpointing should be taken out of e.g. lift_data since it may not be desirable in all situations (e.g very small table)

Finally, docstring needs work, e.g. :param rg: Reference genome --> is this the old or new reference?

@lfrancioli
Copy link
Contributor Author

lfrancioli commented Mar 9, 2020

Something like this may be generally useful:

def liftover_expr(
        locus: hl.expr.LocusExpression,
        alleles: hl.expr.ArrayExpression,
        destination_ref: hl.ReferenceGenome
) -> hl.expr.StructExpression:

    lifted_over_locus=hl.liftover(locus, destination_ref, include_strand=True)
    lifted_over_alleles=alleles.map(
        lambda a: hl.if_else(lifted_over_locus.is_negative_strand,  hl.reverse_complement(a), a)
    )
    return hl.struct(
        locus=lifted_over_locus.result,
        alleles=lifted_over_alleles
    )

Also, something else to consider:

        bad_liftover=(
            hl.is_missing(lifted_over_locus) |
            (lifted_over_locus.sequence_context() != lifted_over_alleles[0][0])
        )

@nawatts
Copy link
Contributor

nawatts commented Mar 9, 2020

Related to #162

@ch-kr
Copy link
Contributor

ch-kr commented Aug 4, 2020

Finally opened a PR for this: #246

@nawatts
Copy link
Contributor

nawatts commented Aug 17, 2020

Now that #246 is merged, is this issue resolved?

@lfrancioli
Copy link
Contributor Author

Yup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants