INNER CODE UNIT · Python

assign_rank_expr

BortonWrightonLabs/DRAM · bin/combine_annotations.py:42

def assign_rank_expr(columns: list[str]) -> pl.Expr:
    kegg_score = (
        bit_score_expr("kegg_bitScore") if "kegg_bitScore" in columns else pl.lit(0)
    )
    uniref_score = (
        bit_score_expr("uniref_bitScore") if "uniref_bitScore" in columns else pl.lit(0)
    )
    motif_checks = [
        bit_score_expr(f"{db}_bitScore") > 60
        for db in ["pfam", "dbcan", "merops"]
        if f"{db}_bitScore" in columns
    ]
    motif_expr = pl.any_horizontal(motif_checks) if motif_checks else pl.lit(False)

    return (
        pl.when(kegg_score > 350)
        .then(pl.lit("A"))
        .when(uniref_score > 350)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…