Skip to content

mecfs_bio.build_system.task.pipes.compute_beta_pipe

Classes:

ComputeBetaIfNeededPipe

Bases: DataProcessingPipe

Methods:

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/compute_beta_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    schema = x.collect_schema()
    if GWASLAB_BETA_COL not in schema.keys():
        x = ComputeBetaPipe().process(x)
    return x

ComputeBetaPipe

Bases: DataProcessingPipe

Methods:

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/compute_beta_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    schema = x.collect_schema()
    assert GWASLAB_BETA_COL not in schema.keys()
    x = x.with_columns(
        narwhals.col(GWASLAB_ODDS_RATIO_COL).log().alias(GWASLAB_BETA_COL)
    )
    return x