utils ¶
Some utils function.
Functions:
-
add_id_part
–Compute and add id_part of polars.DataFrame.
-
add_recurrence
–Compute recurrence of variant.
-
fix_variants_path
–Fix variants path to match if variants are split or not.
-
get_list
–Replace list by value at index or null_value if index is out of bound.
-
list2string
–Convert list in string.
add_id_part ¶
add_id_part(
data: DataFrame, number_of_bits: int = 8
) -> DataFrame
Compute and add id_part of polars.DataFrame.
Source code in src/sake/utils.py
17 18 19 20 21 22 23 24 25 26 27 28 |
|
add_recurrence ¶
add_recurrence(data: DataFrame) -> DataFrame
Compute recurrence of variant.
Requirement: - id: variant id - gt: genotype
Source code in src/sake/utils.py
31 32 33 34 35 36 37 38 39 40 41 42 |
|
fix_variants_path ¶
fix_variants_path(
path: Path, target: str, chrom: str | None = None
) -> str
Fix variants path to match if variants are split or not.
Source code in src/sake/utils.py
65 66 67 68 69 70 71 |
|
get_list ¶
get_list(
data: DataFrame,
*,
columns: list[str],
index: int = 0,
null_value: Any = 0
) -> DataFrame
Replace list by value at index or null_value if index is out of bound.
Source code in src/sake/utils.py
52 53 54 55 56 57 58 59 60 61 62 |
|
list2string ¶
list2string(
data: DataFrame,
*,
columns: list[str],
separator: str = ","
) -> DataFrame
Convert list in string.
Source code in src/sake/utils.py
45 46 47 48 49 |
|