graphld.ldsc_io¶
I/O functions for LDSC format files (summary statistics and annotations).
For broader loading workflows, see the I/O and Merging guide.
ldsc_io
¶
Functions for reading LDSC sumstats files.
read_ldsc_snplist
¶
read_ldsc_snplist(file: Union[str, Path], add_positions: bool = True, positions_file: str = POSITIONS_FILE) -> pl.DataFrame
Read LDSC snplist file format.
Source code in src/graphld/ldsc_io.py
read_ldsc_sumstats
¶
read_ldsc_sumstats(file: Union[str, Path], add_positions: bool = True, positions_file: str = POSITIONS_FILE, maximum_missingness: float = 1.0) -> pl.DataFrame
Read LDSC sumstats file format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Union[str, Path]
|
Path to LDSC sumstats file |
required |
add_positions
|
bool
|
If True, merge with external file to add positions |
True
|
positions_file
|
str
|
File containing RSIDs and positions, defaults to data/rsid_position.csv |
POSITIONS_FILE
|
maximum_missingness
|
float
|
Maximum fraction of missing samples allowed. Variants with N below (1 - maximum_missingness) * max(N) are removed. |
1.0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns: SNP, N, Z, ALT, REF |
DataFrame
|
If add_positions=True, also includes: CHR, POS |