Skip to content

mecfs_bio.build_system.task.pipes.compute_p_pipe

Classes:

ComputePIfNeededPipe

Bases: DataProcessingPipe

Methods:

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/compute_p_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    schema = x.collect_schema()
    if GWASLAB_P_COL in schema:
        return x
    return ComputePPipe().process(x)

ComputePPipe

Bases: DataProcessingPipe

Methods:

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/compute_p_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    schema = x.collect_schema()
    assert GWASLAB_P_COL not in schema
    assert GWASLAB_MLOG10P_COL in schema
    return x.with_columns(
        (10 ** (-1 * narwhals.col(GWASLAB_MLOG10P_COL))).alias(GWASLAB_P_COL)
    )