Skip to content

Commit

Permalink
magenpy==0.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
shz9 committed Apr 4, 2024
1 parent 579504c commit 4c83c94
Show file tree
Hide file tree
Showing 99 changed files with 6,352 additions and 2,737 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ci Docs
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: python -m pip install -r requirements-docs.txt
- run: mkdocs gh-deploy --force
39 changes: 39 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: magenpy Linux-CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up miniconda
uses: conda-incubator/[email protected]
with:
channels: conda-forge
python-version: ${{ matrix.python-version }}

- name: Set up Conda environment
shell: "bash -l {0}"
run: >
conda create --name "magenpy_ci" -c conda-forge -c anaconda
python=${{matrix.python-version}} pip wheel compilers openblas -y
- name: Install magenpy
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
python -m pip install -v -e .[test]
- name: Run tests
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
pytest -v
39 changes: 39 additions & 0 deletions .github/workflows/ci-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: magenpy OSX-CI

on: [push, pull_request]

jobs:
build:

runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up miniconda
uses: conda-incubator/[email protected]
with:
channels: conda-forge
python-version: ${{ matrix.python-version }}

- name: Set up Conda environment
shell: "bash -l {0}"
run: >
conda create --name "magenpy_ci" -c conda-forge -c anaconda
python=${{matrix.python-version}} pip wheel compilers openblas -y
- name: Install magenpy
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
python -m pip install -v -e .[test]
- name: Run tests
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
pytest -v
39 changes: 39 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: magenpy OSX-CI

on: [push, pull_request]

jobs:
build:

runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up miniconda
uses: conda-incubator/[email protected]
with:
channels: conda-forge
python-version: ${{ matrix.python-version }}

- name: Set up Conda environment
shell: "bash -l {0}"
run: >
conda create --name "magenpy_ci" -c conda-forge -c anaconda
python=${{matrix.python-version}} pip wheel compilers openblas -y
- name: Install magenpy
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
python -m pip install -v -e .[test]
- name: Run tests
shell: "bash -l {0}"
run: |
conda activate magenpy_ci
pytest -v
71 changes: 71 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build magenpy and upload to PyPI

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: test install
run: pip install dist/magenpy*.tar.gz

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository-url: https://test.pypi.org/legacy/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# C extensions
*.c
*.cpp
*.so

# Distribution / packaging
Expand All @@ -18,6 +19,7 @@ lib/
lib64/
parts/
sdist/
site/
var/
*.egg-info/
.installed.cfg
Expand All @@ -34,6 +36,9 @@ pip-delete-this-directory.txt

# custom
.idea/
.vscode/
.tox/
.pytest_cache/
*.html
*.zarr
*.npz
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2024-04-04

A large scale restructuring of the code base to improve efficiency and usability.

### Changed

- Bug fixes across the entire code base.
- Simulator classes have been renamed from `GWASimulator` to `PhenotypeSimulator`.
- Moved plotting script to its own separate module.
- Updated some method names / commandline flags to be consistent throughout.

### Added

- Basic integration testing with `pytest` and GitHub workflows.
- Documentation for the entire package using `mkdocs`.
- Integration testing / automating building with GitHub workflows.
- New implementation of the LD matrix that uses CSR matrix data structures.
- Quantization / float precision specification when storing LD matrices.
- Allow user to specify Compressor / Compressor options for Zarr storage.
- New implementation of `magenpy_simulate` script.
- Allow users to set random seed.
- Now accept `--prop-causal` instead of specifying full mixing proportions.
- Tried to incorporate `genome_build` into various data structures. This will be useful in the
future to ensure consistent genome builds across different data types.
- Allow user to pass various metadata to `magenpy_ld` to save information about dataset
characteristics.
- New sumstats parsers:
- Saige sumstats format.
- plink1.9 sumstats format.
- GWAS Catalog sumstats format.
- Chained transform function for transforming phenotypes.

## [0.0.12] - 2023-02-12

Expand Down
21 changes: 21 additions & 0 deletions CITATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
If you use `magenpy` in your research, please cite the following paper(s):

> Zabad, S., Gravel, S., & Li, Y. (2023). **Fast and accurate Bayesian polygenic risk modeling with variational inference.**
The American Journal of Human Genetics, 110(5), 741–761. https://doi.org/10.1016/j.ajhg.2023.03.009

## BibTeX records

```bibtex
@article{ZABAD2023741,
title = {Fast and accurate Bayesian polygenic risk modeling with variational inference},
journal = {The American Journal of Human Genetics},
volume = {110},
number = {5},
pages = {741-761},
year = {2023},
issn = {0002-9297},
doi = {https://doi.org/10.1016/j.ajhg.2023.03.009},
url = {https://www.sciencedirect.com/science/article/pii/S0002929723000939},
author = {Shadi Zabad and Simon Gravel and Yue Li}
}
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Shadi Zabad, McGill University
Copyright (c) 2024 Shadi Zabad, McGill University.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ include MANIFEST.in
include requirements*.txt
include magenpy/config/*.ini
include LICENSE
include README.md
include *.md
include setup.py

graft magenpy

global-exclude *.c
global-exclude *.cpp
global-exclude *.so
global-exclude *.pyd
global-exclude *.pyc
29 changes: 23 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
.PHONY: build dist redist install install-from-source clean uninstall
.PHONY: build build-inplace test test-inplace dist redist install install-from-source clean uninstall publish-test publish

build:
python3 setup.py build

build-inplace:
python3 setup.py build_ext --inplace

test-inplace:
PYTHONPATH=. pytest

test:
python -m pytest

dist:
python3 setup.py sdist bdist_wheel
python setup.py sdist bdist_wheel

redist: clean dist

install:
pip install .
python -m pip install .

install-from-source: dist
pip install dist/magenpy-*.tar.gz
python -m pip install dist/magenpy-*.tar.gz

clean:
$(RM) -r build dist *.egg-info
$(RM) -r magenpy/LDMatrix.c magenpy/utils/c_utils.c
$(RM) -r magenpy/stats/ld/*.c magenpy/stats/score/*.cpp
$(RM) -r magenpy/stats/ld/*.so magenpy/stats/score/*.so
$(RM) -r .pytest_cache .tox temp output
find . -name __pycache__ -exec rm -r {} +

uninstall:
pip uninstall magenpy
python -m pip uninstall magenpy

publish-test:
python -m twine upload -r testpypi dist/* --verbose

publish:
python -m twine upload dist/* --verbose
Loading

0 comments on commit 4c83c94

Please sign in to comment.