https://github.com/38/pyd4
The python binding for D4 format
https://github.com/38/pyd4
Last synced: 4 months ago
JSON representation
The python binding for D4 format
- Host: GitHub
- URL: https://github.com/38/pyd4
- Owner: 38
- Created: 2020-09-21T23:24:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-22T20:12:07.000Z (over 4 years ago)
- Last Synced: 2025-07-11T07:23:32.950Z (about 1 year ago)
- Language: Rust
- Size: 33.2 KB
- Stars: 16
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pyd4 - Python Binding for D4 File Format
This python module allows python read D4 file.
## Installation
Install through pip is recommended
```bash
pip install pyd4
```
or you can also run the `setup.py` to install:
```bash
./setup.py install
```
## Usage by Example
```python
from pyd4 import D4File
file = D4File("test.d4")
# Print the chrom list
print(file.chroms())
# Get the mean cov for region chr1:10000000-20000000
print(file.mean([("chr1", 10000000, 20000000)]))
# Get the depth distribution hisgoram for chr1:10000000-20000000.
# The max bucket is 1000 and the min bucket is 0
print(file.histogram([("chr1", 10000000, 20000000)], 0, 1000))
# Get a iterator over values
for i in file.value_iter("chr1", 0, 10000):
print(i)
```