Data utils
download_ld_matrix(target_dir='.', chromosome=None, *, ancestry, source='huggingface', panel='ukb', overwrite=False)
¶
Download hosted LD archives locally without extracting them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dir
|
Destination root. Files are saved under
|
'.'
|
|
chromosome
|
An autosome number or iterable of autosome numbers (1–22).
|
None
|
|
ancestry
|
One of EUR, CSA, AFR, EAS, MID, or AMR (case insensitive). |
required | |
source
|
|
'huggingface'
|
|
panel
|
|
'ukb'
|
|
overwrite
|
Replace existing archives if True. Otherwise reuse them. |
False
|
Returns:
| Type | Description |
|---|---|
|
A list of pathlib.Path objects for the downloaded or reused archives. Hugging Face ZIPs can be passed directly to magenpy; Zenodo tar.gz files must be extracted before use. Downloads stream to temporary files in the destination directory and are
renamed only after completion. A failed download leaves any existing archive
intact; successfully downloaded chromosomes are retained for a later retry.
When installed, |
Source code in viprs/utils/data_utils.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
parse_pgs_catalog_metadata(metadata=None)
¶
Parse metadata supplied as a mapping or comma-separated key=value string.
Source code in viprs/utils/data_utils.py
prepare_pgs_catalog_metadata(metadata=None)
¶
Apply defaults and validate PGS Catalog scoring-file metadata.
Source code in viprs/utils/data_utils.py
read_pgs_catalog_scoring_file(f_name)
¶
Read a PGS Catalog scoring file into VIPRS parameter-table format.
Source code in viprs/utils/data_utils.py
write_pgs_catalog_scoring_file(parameter_table, f_name, metadata=None, effect_column='BETA')
¶
Write inferred effect sizes using PGS Catalog scoring-file format 2.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_table
|
A pandas DataFrame containing VIPRS variant parameters. |
required | |
f_name
|
Output filename. A bare prefix receives the |
required | |
metadata
|
PGS Catalog metadata. |
None
|
|
effect_column
|
Parameter-table column to write as |
'BETA'
|
Returns:
| Type | Description |
|---|---|
|
The path of the scoring file that was written. |