Skip to content

Commit 03a71f5

Browse files
committed
feat: Initial source code
BREAKING CHANGE: No longer in beta development state
1 parent 6deb652 commit 03a71f5

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

.github/workflows/docs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build docs
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/setup-python@v2
10+
- uses: actions/checkout@master
11+
with:
12+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
13+
- uses: py-actions/py-dependency-install@v3
14+
with:
15+
path: "./requirements.txt"
16+
update-pip: "false"
17+
update-setuptools: "false"
18+
update-wheel: "false"
19+
- name: Build and Commit
20+
uses: sphinx-notes/pages@v2
21+
with:
22+
documentation_path: './docs/source'
23+
requirements_path: './requeriments_docs.txt'
24+
- name: Push changes
25+
uses: ad-m/github-push-action@master
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
branch: gh-pages

.github/workflows/main.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Semantic Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
release:
7+
environment:
8+
name: pypi
9+
url: https://pypi.org/p/plink-bed-reader
10+
permissions:
11+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
12+
runs-on: ubuntu-latest
13+
concurrency: release
14+
15+
steps:
16+
- uses: actions/checkout@master
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Python Semantic Release
21+
id: release
22+
uses: relekang/[email protected]
23+
with:
24+
github_token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Publish package distributions to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
# The following line is required to ensure that the package is only published to PyPI when a new version is released.
29+
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
30+
# See https://github.com/actions/runner/issues/1173
31+
if: steps.release.outputs.released == 'true'
32+
33+
- name: Publish package distributions to GitHub Releases
34+
uses: python-semantic-release/[email protected]
35+
if: steps.release.outputs.released == 'true'
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PLINK BED reader<!-- omit in toc -->
2+
**Lightweight and memory efficient reader for PLINK BED files**. It supports both SNP-major and individual-major formats. Written in pure Python. Check the [available documentation](https://computational-genomics-bsc.github.io/plink-bed-reader/) for more information.
3+
4+
## Table of contents<!-- omit in toc -->
5+
- [Getting started](#getting-started)
6+
- [Installation](#installation)
7+
- [Usage](#usage)
8+
- [Dependencies](#dependencies)
9+
10+
11+
## Getting started
12+
### Installation
13+
VariantExtractor is available on PyPI and can be installed using `pip`:
14+
```bash
15+
pip install plink-bed-reader
16+
```
17+
18+
## Usage
19+
```python
20+
# Import the package
21+
from plink_bed_reader import PLINKBEDReader, BEDMode
22+
23+
# Load the PLINK BED file (we include the mode for sanity check, but it is optional)
24+
bed = PLINKBEDReader('./input_test_data/test.bed', mode=BEDMode.SNP_MAJOR)
25+
26+
# Print the number of SNPs and samples
27+
print('Number of SNPs:', bed.snp_count)
28+
print('Number of samples:', bed.sample_count)
29+
# Print the first SNP
30+
first_snp = bed[0]
31+
print('First SNP:', first_snp, first_snp.dtype)
32+
# Print the first 3 SNPs
33+
print('First 3 SNPs:', bed[:3])
34+
```
35+
36+
## Dependencies
37+
38+
The dependencies are covered by their own respective licenses as follows:
39+
40+
* [Python/NumPy package](https://numpy.org/)

examples/example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
import os
77
import sys
88
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)) + '/../src/')
9+
# Import the package
910
from plink_bed_reader import PLINKBEDReader, BEDMode
1011

11-
# Load the PLINK BED file
12+
# Load the PLINK BED file (we include the mode for sanity check, but it is optional)
1213
bed = PLINKBEDReader('./input_test_data/test.bed', mode=BEDMode.SNP_MAJOR)
1314

1415
# Print the number of SNPs and samples

0 commit comments

Comments
 (0)