Data utils
download_ld_matrix(target_dir='.', chromosome=None)
¶
Download LD matrices for VIPRS software.
TODO: Update this once data is made available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dir
|
The path or directory where to store the LD matrix |
'.'
|
|
chromosome
|
An integer or list of integers with the chromosome numbers for which to download the LD matrices from Zenodo. |
None
|
Source code in viprs/utils/data_utils.py
gwas_catalog_directory(accession)
¶
Return the GWAS Catalog summary-statistics directory for an accession.
Source code in viprs/utils/data_utils.py
is_gwas_catalog_accession(value)
¶
Return whether value is a GWAS Catalog study accession.
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
resolve_gwas_catalog(accession, read_text=None)
¶
Resolve an accession to its preferred GRCh37 summary-statistics URL.
read_text may be supplied to use a different HTTP transport.
Source code in viprs/utils/data_utils.py
resolve_gwas_catalog_async(accession, read_text)
async
¶
Resolve an accession using an async text-fetching callback.
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. |
Source code in viprs/utils/data_utils.py
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 | |