pybcf 1.4.0__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybcf/__init__.py +18 -0
- pybcf/py.typed +0 -0
- pybcf/reader.cp315-win_amd64.pyd +0 -0
- pybcf/reader.pyi +118 -0
- pybcf-1.4.0.dist-info/DELVEWHEEL +2 -0
- pybcf-1.4.0.dist-info/METADATA +58 -0
- pybcf-1.4.0.dist-info/RECORD +11 -0
- pybcf-1.4.0.dist-info/WHEEL +5 -0
- pybcf-1.4.0.dist-info/licenses/LICENSE.txt +19 -0
- pybcf-1.4.0.dist-info/top_level.txt +1 -0
- pybcf.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
pybcf/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""""" # start delvewheel patch
|
|
2
|
+
def _delvewheel_patch_1_13_2():
|
|
3
|
+
import os
|
|
4
|
+
if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'pybcf.libs'))):
|
|
5
|
+
os.add_dll_directory(libs_dir)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
_delvewheel_patch_1_13_2()
|
|
9
|
+
del _delvewheel_patch_1_13_2
|
|
10
|
+
# end delvewheel patch
|
|
11
|
+
|
|
12
|
+
from importlib.metadata import version
|
|
13
|
+
|
|
14
|
+
__version__ = version('pybcf')
|
|
15
|
+
|
|
16
|
+
from pybcf.reader import BcfReader
|
|
17
|
+
|
|
18
|
+
__all__ = ['BcfReader']
|
pybcf/py.typed
ADDED
|
File without changes
|
|
Binary file
|
pybcf/reader.pyi
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
from os import PathLike
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
from typing import Any, BinaryIO, NoReturn, TextIO, TypeVar, overload
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
from numpy.typing import NDArray
|
|
10
|
+
|
|
11
|
+
_T = TypeVar('_T')
|
|
12
|
+
|
|
13
|
+
InfoValue = (
|
|
14
|
+
bool
|
|
15
|
+
| int
|
|
16
|
+
| float
|
|
17
|
+
| str
|
|
18
|
+
| tuple[int | None, ...]
|
|
19
|
+
| tuple[float | None, ...]
|
|
20
|
+
| tuple[str, ...]
|
|
21
|
+
| None
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
SampleValue = NDArray[np.float64] | NDArray[np.float32] | list[tuple[str, ...]]
|
|
25
|
+
|
|
26
|
+
class BcfHeader:
|
|
27
|
+
def __init__(self, *args: Any, **kwargs: Any) -> NoReturn: ...
|
|
28
|
+
@property
|
|
29
|
+
def samples(self) -> list[str]: ...
|
|
30
|
+
@property
|
|
31
|
+
def contigs(self) -> list[str]: ...
|
|
32
|
+
@property
|
|
33
|
+
def filters(self) -> list[str]: ...
|
|
34
|
+
@property
|
|
35
|
+
def formats(self) -> list[str]: ...
|
|
36
|
+
@property
|
|
37
|
+
def info(self) -> list[str]: ...
|
|
38
|
+
|
|
39
|
+
class BcfInfo:
|
|
40
|
+
def __init__(self, *args: Any, **kwargs: Any) -> NoReturn: ...
|
|
41
|
+
def __len__(self) -> int: ...
|
|
42
|
+
def __contains__(self, key: object) -> bool: ...
|
|
43
|
+
def keys(self) -> list[str]: ...
|
|
44
|
+
def values(self) -> list[InfoValue]: ...
|
|
45
|
+
def items(self) -> list[tuple[str, InfoValue]]: ...
|
|
46
|
+
def __iter__(self) -> Iterator[str]: ...
|
|
47
|
+
@overload
|
|
48
|
+
def get(self, key: str, default: None = None) -> InfoValue: ...
|
|
49
|
+
@overload
|
|
50
|
+
def get(self, key: str, default: _T) -> InfoValue | _T: ...
|
|
51
|
+
def __getitem__(self, key: str) -> InfoValue: ...
|
|
52
|
+
|
|
53
|
+
class BcfSampleData:
|
|
54
|
+
def __init__(self, *args: Any, **kwargs: Any) -> NoReturn: ...
|
|
55
|
+
def __len__(self) -> int: ...
|
|
56
|
+
def __contains__(self, key: object) -> bool: ...
|
|
57
|
+
def keys(self) -> list[str]: ...
|
|
58
|
+
def values(self) -> list[SampleValue]: ...
|
|
59
|
+
def items(self) -> list[tuple[str, SampleValue]]: ...
|
|
60
|
+
def __iter__(self) -> Iterator[str]: ...
|
|
61
|
+
@overload
|
|
62
|
+
def get(self, key: str, default: None = None) -> SampleValue | None: ...
|
|
63
|
+
@overload
|
|
64
|
+
def get(self, key: str, default: _T) -> SampleValue | _T: ...
|
|
65
|
+
def __getitem__(self, key: str) -> SampleValue: ...
|
|
66
|
+
@property
|
|
67
|
+
def phased(self) -> NDArray[np.bool_]: ...
|
|
68
|
+
|
|
69
|
+
class BcfVariant:
|
|
70
|
+
def __init__(self, *args: Any, **kwargs: Any) -> NoReturn: ...
|
|
71
|
+
@property
|
|
72
|
+
def chrom(self) -> str: ...
|
|
73
|
+
@property
|
|
74
|
+
def contig(self) -> str: ...
|
|
75
|
+
@property
|
|
76
|
+
def pos(self) -> int: ...
|
|
77
|
+
@property
|
|
78
|
+
def ref(self) -> str: ...
|
|
79
|
+
@property
|
|
80
|
+
def alts(self) -> tuple[str, ...] | None: ...
|
|
81
|
+
@property
|
|
82
|
+
def id(self) -> str | None: ...
|
|
83
|
+
@property
|
|
84
|
+
def qual(self) -> float | None: ...
|
|
85
|
+
@property
|
|
86
|
+
def filter(self) -> list[str]: ...
|
|
87
|
+
@property
|
|
88
|
+
def info(self) -> BcfInfo: ...
|
|
89
|
+
@property
|
|
90
|
+
def samples(self) -> BcfSampleData: ...
|
|
91
|
+
|
|
92
|
+
class BcfReader:
|
|
93
|
+
def __init__(
|
|
94
|
+
self,
|
|
95
|
+
path: str | PathLike[str] | TextIO | BinaryIO,
|
|
96
|
+
index_path: str | PathLike[str] | None = None,
|
|
97
|
+
) -> None: ...
|
|
98
|
+
def close(self) -> None: ...
|
|
99
|
+
def __repr__(self) -> str: ...
|
|
100
|
+
def __iter__(self) -> BcfReader: ...
|
|
101
|
+
def __next__(self) -> BcfVariant: ...
|
|
102
|
+
@property
|
|
103
|
+
def header(self) -> BcfHeader: ...
|
|
104
|
+
@property
|
|
105
|
+
def samples(self) -> list[str]: ...
|
|
106
|
+
def fetch(
|
|
107
|
+
self,
|
|
108
|
+
chrom: str,
|
|
109
|
+
start: int | None = None,
|
|
110
|
+
stop: int | None = None,
|
|
111
|
+
) -> BcfReader: ...
|
|
112
|
+
def __enter__(self) -> BcfReader: ...
|
|
113
|
+
def __exit__(
|
|
114
|
+
self,
|
|
115
|
+
exc_type: type[BaseException] | None,
|
|
116
|
+
exc_value: BaseException | None,
|
|
117
|
+
traceback: TracebackType | None,
|
|
118
|
+
) -> None: ...
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Version: 1.13.2
|
|
2
|
+
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-jxttwalv\\cp315-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-jxttwalv\\cp315-win_amd64\\repaired_wheel', '-v', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-jxttwalv\\cp315-win_amd64\\built_wheel\\pybcf-1.4.0-cp315-cp315-win_amd64.whl']
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pybcf
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: Package for loading data from bcf files
|
|
5
|
+
Author-email: Jeremy McRae <jmcrae@illumina.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/jeremymcrae/pybcf
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Provides-Extra: test
|
|
15
|
+
Requires-Dist: pysam; extra == "test"
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### pybcf
|
|
20
|
+
|
|
21
|
+
This is a package for reading BCF files (binary call format). Similar to pysam/cyvcf2,
|
|
22
|
+
but limited to reading from BCF files only, and oriented around getting genotype
|
|
23
|
+
data into numpy arrays quickly.
|
|
24
|
+
|
|
25
|
+
This performs relatively better at larger sample sizes e.g. it's ~15X faster than
|
|
26
|
+
pysam with 100 samples, but improves to ~200X faster than pysam with 100k samples.
|
|
27
|
+
|
|
28
|
+
```py
|
|
29
|
+
from pybcf import BcfReader
|
|
30
|
+
|
|
31
|
+
bcf = BcfReader(bcf_path)
|
|
32
|
+
|
|
33
|
+
sample_ids = bcf.samples
|
|
34
|
+
contigs = bcf.header.contigs
|
|
35
|
+
|
|
36
|
+
for var in bcf:
|
|
37
|
+
# the usual attributes are available e.g.
|
|
38
|
+
# var.chrom, var.pos, var.ref, var.alts, var.info['AF']
|
|
39
|
+
|
|
40
|
+
# sample data is accessed as numpy arrays via the format keys
|
|
41
|
+
keys = list(var.samples)
|
|
42
|
+
genotypes = var.samples['GT'] # as n x 2 numpy array, missing=nan
|
|
43
|
+
|
|
44
|
+
# or fetch from random regions if bcf is indexed. Positions are 1-based and
|
|
45
|
+
# include both ends (pysam's fetch is 0-based and excludes the end)
|
|
46
|
+
for var in bcf.fetch('chr1', 10000, 200000):
|
|
47
|
+
print(var.chrom, var.pos)
|
|
48
|
+
|
|
49
|
+
# you can read from stdin, but that doesn't allow fetching random regions
|
|
50
|
+
import sys
|
|
51
|
+
bcf = BcfReader(sys.stdin)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Limitations
|
|
55
|
+
- `fetch()` needs a bgzip-compressed BCF with a `.csi` index
|
|
56
|
+
- a reader has one position in the file, so `fetch()` inside a loop over the
|
|
57
|
+
same reader ends that loop. Open a second `BcfReader` to do both at once
|
|
58
|
+
- extracting info fields is a little slow
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pybcf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pybcf/reader.cp315-win_amd64.pyd,sha256=OPKdHg-P0d-Xwo8x5xH8ow5bL40-zqZ9e6CUSV4fYZ0,397824
|
|
3
|
+
pybcf/reader.pyi,sha256=hd2YBE6jOUVQdQX3XUj5uPom8SEVrD2jctMR77-MEz4,3585
|
|
4
|
+
pybcf/__init__.py,sha256=o6qmBfUUO4nf_GBOZA5FytMKXrSJ7Dn0kNV5daxvQX8,466
|
|
5
|
+
pybcf-1.4.0.dist-info/DELVEWHEEL,sha256=V9BMPERUrvmvKEd3lLXOZoOcKVISPZJarE0Gfdk8yXg,404
|
|
6
|
+
pybcf-1.4.0.dist-info/METADATA,sha256=UKzB_l8bK-aRw6H5J1LghAAqEyk5LtgbPVj1Sfr_BTs,1994
|
|
7
|
+
pybcf-1.4.0.dist-info/RECORD,,
|
|
8
|
+
pybcf-1.4.0.dist-info/top_level.txt,sha256=pLb1O4a8hp36X7AX-LkXELphf8eFeRBqAlVd7mEbzZo,6
|
|
9
|
+
pybcf-1.4.0.dist-info/WHEEL,sha256=0gLwYZa0C2fhgCxWR2c8HahwUiopqonVCV0wVwEg6fE,101
|
|
10
|
+
pybcf-1.4.0.dist-info/licenses/LICENSE.txt,sha256=MxRXDy8fWiEiJRQAlvRbGb3MLVjFFR94ZiAQOGeCrdQ,1072
|
|
11
|
+
pybcf.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll,sha256=pMIim9wqKmMKzcCVtNhgCOXD47x3cxdDVPPaT1vrnN4,575056
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2024 Illumina Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pybcf
|
|
Binary file
|