pybcf 1.3.2__tar.gz → 1.3.4__tar.gz

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.
Files changed (85) hide show
  1. {pybcf-1.3.2/src/pybcf.egg-info → pybcf-1.3.4}/PKG-INFO +4 -4
  2. {pybcf-1.3.2 → pybcf-1.3.4}/README.md +3 -3
  3. {pybcf-1.3.2 → pybcf-1.3.4}/setup.py +4 -58
  4. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf/reader.cpp +191 -130
  5. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf/reader.pyx +3 -0
  6. {pybcf-1.3.2 → pybcf-1.3.4/src/pybcf.egg-info}/PKG-INFO +4 -4
  7. pybcf-1.3.4/src/sample_data.cpp +494 -0
  8. {pybcf-1.3.2 → pybcf-1.3.4}/src/sample_data.h +3 -0
  9. {pybcf-1.3.2 → pybcf-1.3.4}/test/test_pybcf.py +56 -4
  10. pybcf-1.3.2/src/sample_data.cpp +0 -247
  11. {pybcf-1.3.2 → pybcf-1.3.4}/LICENSE.txt +0 -0
  12. {pybcf-1.3.2 → pybcf-1.3.4}/MANIFEST.in +0 -0
  13. {pybcf-1.3.2 → pybcf-1.3.4}/pyproject.toml +0 -0
  14. {pybcf-1.3.2 → pybcf-1.3.4}/setup.cfg +0 -0
  15. {pybcf-1.3.2 → pybcf-1.3.4}/src/bcf.cpp +0 -0
  16. {pybcf-1.3.2 → pybcf-1.3.4}/src/bcf.h +0 -0
  17. {pybcf-1.3.2 → pybcf-1.3.4}/src/gzstream.cpp +0 -0
  18. {pybcf-1.3.2 → pybcf-1.3.4}/src/gzstream.h +0 -0
  19. {pybcf-1.3.2 → pybcf-1.3.4}/src/header.cpp +0 -0
  20. {pybcf-1.3.2 → pybcf-1.3.4}/src/header.h +0 -0
  21. {pybcf-1.3.2 → pybcf-1.3.4}/src/index.cpp +0 -0
  22. {pybcf-1.3.2 → pybcf-1.3.4}/src/index.h +0 -0
  23. {pybcf-1.3.2 → pybcf-1.3.4}/src/info.cpp +0 -0
  24. {pybcf-1.3.2 → pybcf-1.3.4}/src/info.h +0 -0
  25. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf/__init__.py +0 -0
  26. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf.egg-info/SOURCES.txt +0 -0
  27. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf.egg-info/dependency_links.txt +0 -0
  28. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf.egg-info/requires.txt +0 -0
  29. {pybcf-1.3.2 → pybcf-1.3.4}/src/pybcf.egg-info/top_level.txt +0 -0
  30. {pybcf-1.3.2 → pybcf-1.3.4}/src/types.h +0 -0
  31. {pybcf-1.3.2 → pybcf-1.3.4}/src/variant.cpp +0 -0
  32. {pybcf-1.3.2 → pybcf-1.3.4}/src/variant.h +0 -0
  33. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/adler32.c +0 -0
  34. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/adler32_p.h +0 -0
  35. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/arch_functions.h +0 -0
  36. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/chunkset_tpl.h +0 -0
  37. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/compare256_rle.h +0 -0
  38. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/compress.c +0 -0
  39. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/cpu_features.c +0 -0
  40. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/cpu_features.h +0 -0
  41. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32.c +0 -0
  42. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32.h +0 -0
  43. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32_braid_comb.c +0 -0
  44. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32_braid_comb_p.h +0 -0
  45. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32_braid_p.h +0 -0
  46. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/crc32_braid_tbl.h +0 -0
  47. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate.c +0 -0
  48. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate.h +0 -0
  49. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_fast.c +0 -0
  50. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_huff.c +0 -0
  51. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_medium.c +0 -0
  52. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_p.h +0 -0
  53. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_quick.c +0 -0
  54. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_rle.c +0 -0
  55. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_slow.c +0 -0
  56. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/deflate_stored.c +0 -0
  57. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/fallback_builtins.h +0 -0
  58. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/functable.c +0 -0
  59. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/functable.h +0 -0
  60. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/gzguts.h +0 -0
  61. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/gzlib.c +0 -0
  62. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/gzwrite.c +0 -0
  63. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/infback.c +0 -0
  64. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inffast_tpl.h +0 -0
  65. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inffixed_tbl.h +0 -0
  66. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inflate.c +0 -0
  67. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inflate.h +0 -0
  68. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inflate_p.h +0 -0
  69. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inftrees.c +0 -0
  70. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/inftrees.h +0 -0
  71. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/insert_string.c +0 -0
  72. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/insert_string_roll.c +0 -0
  73. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/insert_string_tpl.h +0 -0
  74. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/match_tpl.h +0 -0
  75. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/trees.c +0 -0
  76. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/trees.h +0 -0
  77. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/trees_emit.h +0 -0
  78. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/trees_tbl.h +0 -0
  79. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/uncompr.c +0 -0
  80. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/zbuild.h +0 -0
  81. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/zendian.h +0 -0
  82. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/zutil.c +0 -0
  83. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/zutil.h +0 -0
  84. {pybcf-1.3.2 → pybcf-1.3.4}/src/zlib-ng/zutil_p.h +0 -0
  85. {pybcf-1.3.2 → pybcf-1.3.4}/test/test_indexed.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybcf
3
- Version: 1.3.2
3
+ Version: 1.3.4
4
4
  Summary: Package for loading data from bcf files
5
5
  Home-page: https://github.com/jeremymcrae/pybcf
6
6
  Author: Jeremy McRae
@@ -23,8 +23,8 @@ data into numpy arrays quickly.
23
23
 
24
24
  This performs relatively better at larger sample sizes e.g. it's 7X faster than
25
25
  pysam with 2k samples, but improves to 50X faster than pysam with 30k samples.
26
- Currently it's slower than pysam for BCFs without samples, but on the other hand,
27
- BCFs without variants aren't generally the limiting factor e.g. it still parses
26
+ Currently it's slower than pysam for BCFs without sample level data, but BCFs
27
+ without genotypes aren't generally a limiting factor e.g. it still parses
28
28
  300k variants/second under those conditions.
29
29
 
30
30
  ```py
@@ -41,7 +41,7 @@ for var in bcf:
41
41
 
42
42
  # sample data is accessed as numpy arrays via the format keys
43
43
  keys = list(var.samples)
44
- genotypes = var.samples['GT'] # as n x 2 numpy array, missing=-1
44
+ genotypes = var.samples['GT'] # as n x 2 numpy array, missing=nan
45
45
 
46
46
  # or fetch from random regions if bcf is indexed
47
47
  for var in bcf.fetch('chr1', 10000, 200000):
@@ -7,8 +7,8 @@ data into numpy arrays quickly.
7
7
 
8
8
  This performs relatively better at larger sample sizes e.g. it's 7X faster than
9
9
  pysam with 2k samples, but improves to 50X faster than pysam with 30k samples.
10
- Currently it's slower than pysam for BCFs without samples, but on the other hand,
11
- BCFs without variants aren't generally the limiting factor e.g. it still parses
10
+ Currently it's slower than pysam for BCFs without sample level data, but BCFs
11
+ without genotypes aren't generally a limiting factor e.g. it still parses
12
12
  300k variants/second under those conditions.
13
13
 
14
14
  ```py
@@ -25,7 +25,7 @@ for var in bcf:
25
25
 
26
26
  # sample data is accessed as numpy arrays via the format keys
27
27
  keys = list(var.samples)
28
- genotypes = var.samples['GT'] # as n x 2 numpy array, missing=-1
28
+ genotypes = var.samples['GT'] # as n x 2 numpy array, missing=nan
29
29
 
30
30
  # or fetch from random regions if bcf is indexed
31
31
  for var in bcf.fetch('chr1', 10000, 200000):
@@ -1,5 +1,4 @@
1
1
 
2
- import glob
3
2
  import io
4
3
  from pathlib import Path
5
4
  from setuptools import setup
@@ -9,7 +8,6 @@ import os
9
8
  import platform
10
9
 
11
10
  from distutils.core import Extension
12
- from distutils.ccompiler import new_compiler
13
11
  from Cython.Build import cythonize
14
12
 
15
13
  EXTRA_COMPILE_ARGS = ['-std=c++11', '-I/usr/include']
@@ -19,6 +17,8 @@ if sys.platform == "darwin":
19
17
  "-stdlib=libc++",
20
18
  "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1",
21
19
  "-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include",
20
+ '-mavx',
21
+ '-mavx2',
22
22
  ]
23
23
  EXTRA_LINK_ARGS += [
24
24
  "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib",
@@ -27,9 +27,6 @@ if sys.platform == "darwin":
27
27
  if platform.machine() == 'x86_64':
28
28
  EXTRA_COMPILE_ARGS += ['-mavx', '-mavx2']
29
29
 
30
- def flatten(*lists):
31
- return [str(x) for sublist in lists for x in sublist]
32
-
33
30
  def build_zlib():
34
31
  ''' compile zlib code to object files for linking
35
32
 
@@ -57,65 +54,14 @@ def build_zlib():
57
54
 
58
55
  return str(build_dir), objs
59
56
 
60
- def get_gzstream_path():
61
- ''' workaround for building gzstream on windows
62
-
63
- cython on windows didn't like the .C extension for gzstream. This just
64
- renames the file (on windows only), and returns the relative path.
65
- '''
66
- # gzstream_path = 'src/gzstream/gzstream.C'
67
- gzstream_path = 'src/gzstream.cpp'
68
- # if sys.platform == 'win32':
69
- # gzstream_win_path = 'src/gzstream/gzstream.cpp'
70
- # try:
71
- # os.rename(gzstream_path, gzstream_win_path)
72
- # except FileNotFoundError:
73
- # pass # avoid error on github actions
74
- # gzstream_path = gzstream_win_path
75
- return gzstream_path
76
-
77
- def scrub_gzstream():
78
- ''' workaround for compilation error on macos
79
-
80
- compiling gzstream requires the corresponding gzstream.h file, but if we
81
- include the gzstream directory in the include dirs, then clang complains
82
- about the version file in the gzstream folder. If we remove the gzstream
83
- directory from the include dirs, then clang complains about the missing
84
- gzstream.h. This is because gzstream.C identifies it's header file with
85
- angle brackets. Replacing the angle brackets in that line seems to work.
86
-
87
- We also need to do the same for the "#include <zlib.h>" in the gzstream
88
- header, since this now uses zlib-ng for better performance.
89
- '''
90
- with open(get_gzstream_path(), 'rt') as handle:
91
- lines = handle.readlines()
92
-
93
- with open(get_gzstream_path(), 'wt') as handle:
94
- for line in lines:
95
- if line == '#include <gzstream.h>\n':
96
- line = '#include "gzstream.h"\n'
97
- handle.write(line)
98
-
99
- # rejig the header file
100
- gzstream_header_path = get_gzstream_path().rsplit('.')[0] + '.h'
101
- with open(gzstream_header_path, 'rt') as handle:
102
- lines = handle.readlines()
103
-
104
- with open(gzstream_header_path, 'wt') as handle:
105
- for line in lines:
106
- if line == '#include <zlib.h>\n':
107
- line = '#include "zlib.h"\n'
108
- handle.write(line)
109
-
110
57
  include_dir, zlib = build_zlib()
111
- scrub_gzstream()
112
58
 
113
59
  ext = cythonize([
114
60
  Extension('pybcf.reader',
115
61
  extra_compile_args=EXTRA_COMPILE_ARGS,
116
62
  extra_link_args=EXTRA_LINK_ARGS,
117
63
  sources=['src/pybcf/reader.pyx',
118
- get_gzstream_path(),
64
+ 'src/gzstream.cpp',
119
65
  'src/bcf.cpp',
120
66
  'src/index.cpp',
121
67
  'src/header.cpp',
@@ -131,7 +77,7 @@ setup(name='pybcf',
131
77
  description='Package for loading data from bcf files',
132
78
  long_description=io.open('README.md', encoding='utf-8').read(),
133
79
  long_description_content_type='text/markdown',
134
- version='1.3.2',
80
+ version='1.3.4',
135
81
  author='Jeremy McRae',
136
82
  author_email='jmcrae@illumina.com',
137
83
  license="MIT",