agglovar.bed.col
Utilities for managing columns.
Classes
Represents coordinate columns to use. |
|
Represents coordinate column expressions. |
Functions
|
Get columns representing coordinates. |
|
Standardize column names. |
Module Contents
- class agglovar.bed.col.CoordCol
Bases:
collections.abc.Iterable[str],collections.abc.Container[str]Represents coordinate columns to use.
- Variables:
chrom – Chromosome column name.
pos – Position column name.
end – End column name.
- __iter__()
Iterate over chrom, pos, and end column names.
- __repr__()
Return a string representation.
- class agglovar.bed.col.CoordColExpr
Bases:
collections.abc.Iterable[polars.Expr]Represents coordinate column expressions.
- Variables:
chrom – Chromosome column expression.
pos – Position column expression.
end – End column expression.
- __iter__()
Iterate over chrom, pos, and end expressions.
- __repr__()
Return a string representation.
- col_names()
Get the resulting column name for each column expression.
- Returns:
Column names.
- chrom: polars.Expr
- end: polars.Expr
- pos: polars.Expr
- agglovar.bed.col.get_coord_cols(col_names: CoordCol | str | collections.abc.Iterable[str] | None = None) CoordCol
Get columns representing coordinates.
Columns may have different names, such as “chrom”, “pos”, “end” for references or “qry_id”, “qry_pos”, and “qry_end” for queries. Returns a tuple of three expressions to be used in Polars selects, one for each of these three columns, to select the correct column from the input table and alias them to “chrom”, “pos”, and “end” with a set suffix.
- Parameters:
col_names – Column names. Can be an iterable of three strings, or a keyword in “ref” or “qry”. None is equivalent to “ref”.
- Returns:
An object with column names.
- agglovar.bed.col.standardize(col: str) str
Standardize column names.
Standard column names are lower-case with alphanumeric, underscore, and dot characters only. Leading and trailing whitespace is stripped, and runs of spaces are replaced with a single underscore. All other characters are removed.
- Parameters:
col – Column name.
- Returns:
Standard column names.