polars-mas - a fast multiple asspciation library for python backed by polars
Project description
Polars-MAS: Multiple Association Studies
polars-mas is a python library and CLI tool meant to perform large scale multiple association tests, primarily seen in academic research. Currently this tool only supports Firth's logistic regression. Will run as a stand in replacement for PheWAS R package analysis, especially for Phecodes. polars-mas is built to leverage the speed and memory efficiency of the polars dataframe library and it's interoperability with the sklearn and statsmodels libraries.
Installation
pip install polars-mas
Running the CLI
polars-mas --help
Polars-MAS: A Python package for multiple association analysis.
options:
-h, --help show this help message and exit
-i INPUT, --input INPUT
Input file path.
-o OUTPUT, --output OUTPUT
Output file prefix. Will be suffixed with '{predictor}.csv'.
-p PREDICTORS [PREDICTORS ...], --predictors PREDICTORS [PREDICTORS ...]
Predictor column names. These will be tested independently
-s SEPARATOR, --separator SEPARATOR
Column separator. Default is ","
-d DEPENDENTS [DEPENDENTS ...], --dependents DEPENDENTS [DEPENDENTS ...]
Dependent variable column names.
-di DEPENDENTS_INDICES, --dependents-indices DEPENDENTS_INDICES
Dependent variable column indicies. Ignored if --dependents is used. Accepts comma separated list of
indices/indicies ranges. E.g. 2, 2-5, 2-, 2,3 , 2,5-8, 2,8- are all valid. Range follows python
slicing conventions - includes start, excludes end.
-c COVARIATES [COVARIATES ...], --covariates COVARIATES [COVARIATES ...]
Covariate column names.
-ci COVARIATES_INDICIES, --covariates-indicies COVARIATES_INDICIES
Covariate column indicies. Ignored if --covariates is used. Accepts comma separated list of
indices/indicies ranges. E.g. 2, 2-5, 2-, 2,3 , 2,5-8, 2,8- are all valid. Range follows python
slicing conventions - includes start, excludes end.
-cc CATEGORICAL_COVARIATES [CATEGORICAL_COVARIATES ...], --categorical-covariates CATEGORICAL_COVARIATES [CATEGORICAL_COVARIATES ...]
Categorical covariate column names.
-nv NULL_VALUES [NULL_VALUES ...], --null-values NULL_VALUES [NULL_VALUES ...]
List of values to be treated as missing values. Default is None (normal polars option).
-qt, --quantitative Dependent variables are quantitative traits.
-mi {drop,forward,backward,min,max,mean,zero,one}, --missing {drop,forward,backward,min,max,mean,zero,one}
Method to handle missing values in covariates and predictor variables. If not specified, rows with
missing values in the predictor and covariate columns will be dropped.
-t {standard,min-max}, --transform {standard,min-max}
Transform continuous covariates/predictor variables. Default is no transformation.
-mc MIN_CASES, --min-cases MIN_CASES
Minimum number of cases for each dependent variable. Only applied when not --quantitative. Default is
20.
-m {firth,linear}, --model {firth,linear}
Type of model to fit. Default is firth logistic regression.
--phewas Input data uses Phecodes for dependent variables.
--phewas-sex-col PHEWAS_SEX_COL
Sex covariate column name for PheWAS analysis. Default = 'sex'. Must be coded as male = 0 and female
= 1.
-th THREADS, --threads THREADS
Number of threads for numpy and sklearn to use within each worker.
-n NUM_WORKERS, --num-workers NUM_WORKERS
Number of workers for parallel processing and threads available to Polars. Default is number of CPUs.
-v, --verbose have more verbose logging
If you have an R environment with the PheWAS package installed, you can run the src/tests/example_data/generate_examples.R script to create dummy data for this repository.
NOTE ON THREADS AND WORKERS: The total number of threads used by polars-mas is the number of workers (-n) multiplied by the number of threads (-th). So if you have 4 workers with 8 threads, polars-mas will use 32 threads on your machine.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polars_mas-0.2.1.tar.gz.
File metadata
- Download URL: polars_mas-0.2.1.tar.gz
- Upload date:
- Size: 80.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e86305ce0d50b14c3b21bff4a4f0415193cf73af29084685ceb74d392557791
|
|
| MD5 |
4dd431971d3a939fdd1649ef02722e1b
|
|
| BLAKE2b-256 |
f3919db48ca55569be87c5d25235156ef61982ca2e91da2da5eb706af3de3203
|
File details
Details for the file polars_mas-0.2.1-py3-none-any.whl.
File metadata
- Download URL: polars_mas-0.2.1-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07960ad41377d2460fbb6e26c3208e4cefc2c5b98615e7aed6e5c14a7ed7119f
|
|
| MD5 |
c286779420f804a5f2d42d095712f627
|
|
| BLAKE2b-256 |
3f6e74e73536f71834933cce55f5b63ad7568cfc23682014d1642dc663d43f32
|