File size: 543 Bytes
9c5a8e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Filters the alignment by removing all ids that occur multiple times."""
import polars as pl

alignment = pl.read_parquet("alignment.parquet")

# Selecting entries without hash collisions
good_da_ids = (
    alignment["da_id"].value_counts().filter(pl.col("counts") == 1)["da_id"]
)
good_sv_ids = (
    alignment["sv_id"].value_counts().filter(pl.col("counts") == 1)["sv_id"]
)

alignment = alignment.filter(
    pl.col("da_id").is_in(good_da_ids), pl.col("sv_id").is_in(good_sv_ids)
)

alignment.write_parquet("filtered_alignment.parquet")