Skip to content

mecfs_bio.build_system.task.pipes.drop_indels_pipe

Drop variants whose effect or non-effect allele is longer than one base.

Classes:

  • DropIndelsPipe –

    Keep only variants whose EA and NEA are both a single base.

DropIndelsPipe

Bases: DataProcessingPipe

Keep only variants whose EA and NEA are both a single base.

Useful ahead of genome-reference harmonization for datasets with very long structural-variant alleles that downstream SNP-based analyses do not use.

Methods:

process

process(x: LazyFrame) -> narwhals.LazyFrame
Source code in mecfs_bio/build_system/task/pipes/drop_indels_pipe.py
def process(self, x: narwhals.LazyFrame) -> narwhals.LazyFrame:
    return x.filter(
        (
            narwhals.col(GWASLAB_EFFECT_ALLELE_COL)
            .cast(narwhals.String)
            .str.len_chars()
            == 1
        )
        & (
            narwhals.col(GWASLAB_NON_EFFECT_ALLELE_COL)
            .cast(narwhals.String)
            .str.len_chars()
            == 1
        )
    )