Metadata-Version: 2.1
Name: sumstats
Version: 0.1.2
Summary: utilities for working with GWAS summary statistics
Home-page: https://gitlab.com/salk-tm/sumstats
Author: Anthony Aylward
Author-email: aaylward@salk.edu
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE

# sumstats

Utilities for working with GWAS summary statistics

This is a package on pypi so you can get it with `pip install sumstats`

## Fine mapping

If inputs are p-values, minor allele frequency, and sample size, first calculate natural log bayes factors and then calculate the PPA's.

To set things up:

```python
import math
import sumstats
N = <sample size>
p_values = <p_values of variants in fine-mapping region>
mafs = <minor allele frequencies of variants in fine-mapping region>
```

To calculate natural log bayes factors or "lnbf":

```python
lnbfs = [sumstats.approx_lnbf(pval=p, freq=maf, sample_size=N) for p, maf in zip(p_values, mafs)]
```

To caluclate posterior probability of association:
```python
normalizing_coefficient = sumstats.log_sum(lnbfs)
ppa = [math.exp(lnbf - normalizing_coefficient) for lnbf in lnbfs]
```


