Covariate, offset, and list readers¤
These readers normalize IID-like columns and prepare covariate, offset, and identifier files for sample alignment.
jaxqtl.io.read_plink_style_tsvlike(path_or_filename: str | os.PathLike, keep_columns: list[str] | list[int] | None = None, drop_columns: list[str] | list[int] | None = None) -> DataFrame
¤
Read a tab-delimited sample table with a PLINK-style IID column.
The header must contain exactly one case-insensitive iid or #iid column.
An optional fid or #fid column is dropped, and the IID column is normalized
to iid. The strings NA, NULL, NaN, nan, and empty fields are read as
missing values.
Arguments:
path_or_filename: Plain-text or gzip-compressed tab-delimited file.keep_columns: Optional column names or zero-based indices to retain. The IID column is added automatically when omitted.drop_columns: Optional column names or zero-based indices to remove. The IID column is retained even when requested for removal.
Returns:
A Polars frame with normalized iid and at least one data column.
Raises:
ValueError: If keep and drop selections are both supplied, the header is empty, exactly one IID-like column is not present, a requested column is missing, or no data columns remain.TypeError: If a column selection mixes names and indices.
jaxqtl.io.read_offset_tsvlike(path_or_filename: str | os.PathLike, column: str | int | None = None) -> DataFrame
¤
Read a sample-aligned offset from a tab-delimited file.
Arguments:
path_or_filename: Plain-text or gzip-compressed table accepted byread_plink_style_tsvlike.column: Name or zero-based index of the offset column. When omitted, the input must already contain exactly one non-IID column.
Returns:
A two-column Polars frame with columns iid and offset.
Raises:
ValueError: Ifcolumnhas an unsupported type or the selected table does not contain exactly one non-IID column.TypeError: If column selection is invalid forread_plink_style_tsvlike.
jaxqtl.io.read_single_column_file(path_or_filename: str | os.PathLike) -> list
¤
Read stripped lines from a plain-text or gzip-compressed file.
A first line beginning with # is treated as a header and skipped. Later lines,
including empty or comment-like lines, are returned after stripping whitespace.
Arguments:
path_or_filename: Input text file, optionally ending in.gz.
Returns:
A list of strings in file order.