gencodegenes 1.2.0__tar.gz → 1.2.2__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 (294) hide show
  1. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/MANIFEST.in +4 -2
  2. {gencodegenes-1.2.0/src/gencodegenes.egg-info → gencodegenes-1.2.2}/PKG-INFO +5 -3
  3. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/README.md +4 -2
  4. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/pyproject.toml +2 -2
  5. gencodegenes-1.2.2/setup.py +88 -0
  6. gencodegenes-1.2.2/src/gencode.cpp +302 -0
  7. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencode.h +0 -20
  8. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.cpp +18269 -16462
  9. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.pyi +1 -1
  10. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.pyx +195 -91
  11. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.cpp +11454 -14886
  12. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.pxd +2 -1
  13. gencodegenes-1.2.2/src/gencodegenes/transcript.pyi +382 -0
  14. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.pyx +48 -57
  15. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/tx.h +38 -17
  16. {gencodegenes-1.2.0 → gencodegenes-1.2.2/src/gencodegenes.egg-info}/PKG-INFO +5 -3
  17. gencodegenes-1.2.2/src/gencodegenes.egg-info/SOURCES.txt +270 -0
  18. gencodegenes-1.2.2/src/gtf.cpp +346 -0
  19. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gtf.h +3 -3
  20. {gencodegenes-1.2.0/src/gencodegenes → gencodegenes-1.2.2/src}/tx.cpp +560 -144
  21. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/tx.h +38 -17
  22. gencodegenes-1.2.2/src/zlib-ng/.codecov.yaml +27 -0
  23. gencodegenes-1.2.2/src/zlib-ng/.gitattributes +9 -0
  24. gencodegenes-1.2.2/src/zlib-ng/.gitignore +111 -0
  25. gencodegenes-1.2.2/src/zlib-ng/.shellcheckrc +1 -0
  26. gencodegenes-1.2.2/src/zlib-ng/CMakeLists.txt +1675 -0
  27. gencodegenes-1.2.2/src/zlib-ng/FAQ.zlib +373 -0
  28. gencodegenes-1.2.2/src/zlib-ng/INDEX.md +36 -0
  29. gencodegenes-1.2.2/src/zlib-ng/LICENSE.md +19 -0
  30. gencodegenes-1.2.2/src/zlib-ng/Makefile.in +409 -0
  31. gencodegenes-1.2.2/src/zlib-ng/PORTING.md +111 -0
  32. gencodegenes-1.2.2/src/zlib-ng/README.md +236 -0
  33. gencodegenes-1.2.2/src/zlib-ng/adler32.c +69 -0
  34. gencodegenes-1.2.2/src/zlib-ng/adler32_p.h +70 -0
  35. gencodegenes-1.2.2/src/zlib-ng/arch/.gitignore +2 -0
  36. gencodegenes-1.2.2/src/zlib-ng/arch/arm/Makefile.in +78 -0
  37. gencodegenes-1.2.2/src/zlib-ng/arch/arm/acle_intrins.h +85 -0
  38. gencodegenes-1.2.2/src/zlib-ng/arch/arm/adler32_neon.c +386 -0
  39. gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_features.c +115 -0
  40. gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_features.h +16 -0
  41. gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_functions.h +71 -0
  42. gencodegenes-1.2.2/src/zlib-ng/arch/arm/chunkset_neon.c +79 -0
  43. gencodegenes-1.2.2/src/zlib-ng/arch/arm/compare256_neon.c +60 -0
  44. gencodegenes-1.2.2/src/zlib-ng/arch/arm/crc32_armv8.c +86 -0
  45. gencodegenes-1.2.2/src/zlib-ng/arch/arm/neon_intrins.h +67 -0
  46. gencodegenes-1.2.2/src/zlib-ng/arch/arm/slide_hash_armv6.c +48 -0
  47. gencodegenes-1.2.2/src/zlib-ng/arch/arm/slide_hash_neon.c +47 -0
  48. gencodegenes-1.2.2/src/zlib-ng/arch/generic/Makefile.in +82 -0
  49. gencodegenes-1.2.2/src/zlib-ng/arch/generic/adler32_c.c +54 -0
  50. gencodegenes-1.2.2/src/zlib-ng/arch/generic/adler32_fold_c.c +15 -0
  51. gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_128bit_perm_idx_lut.h +26 -0
  52. gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_256bit_perm_idx_lut.h +47 -0
  53. gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_permute_table.h +53 -0
  54. gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunkset_c.c +42 -0
  55. gencodegenes-1.2.2/src/zlib-ng/arch/generic/compare256_c.c +31 -0
  56. gencodegenes-1.2.2/src/zlib-ng/arch/generic/compare256_p.h +123 -0
  57. gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_braid_c.c +222 -0
  58. gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_chorba_c.c +1485 -0
  59. gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_fold_c.c +31 -0
  60. gencodegenes-1.2.2/src/zlib-ng/arch/generic/generic_functions.h +72 -0
  61. gencodegenes-1.2.2/src/zlib-ng/arch/generic/slide_hash_c.c +52 -0
  62. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/Makefile.in +99 -0
  63. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/adler32_lasx.c +127 -0
  64. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/adler32_lsx.c +156 -0
  65. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/chunkset_lasx.c +126 -0
  66. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/chunkset_lsx.c +72 -0
  67. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/compare256_lasx.c +63 -0
  68. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/compare256_lsx.c +99 -0
  69. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/crc32_la.c +86 -0
  70. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/lasxintrin_ext.h +90 -0
  71. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_features.c +27 -0
  72. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_features.h +19 -0
  73. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_functions.h +95 -0
  74. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/lsxintrin_ext.h +33 -0
  75. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/slide_hash_lasx.c +41 -0
  76. gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/slide_hash_lsx.c +64 -0
  77. gencodegenes-1.2.2/src/zlib-ng/arch/power/Makefile.in +93 -0
  78. gencodegenes-1.2.2/src/zlib-ng/arch/power/adler32_power8.c +153 -0
  79. gencodegenes-1.2.2/src/zlib-ng/arch/power/adler32_vmx.c +186 -0
  80. gencodegenes-1.2.2/src/zlib-ng/arch/power/chunkset_power8.c +50 -0
  81. gencodegenes-1.2.2/src/zlib-ng/arch/power/compare256_power9.c +66 -0
  82. gencodegenes-1.2.2/src/zlib-ng/arch/power/crc32_constants.h +1123 -0
  83. gencodegenes-1.2.2/src/zlib-ng/arch/power/crc32_power8.c +587 -0
  84. gencodegenes-1.2.2/src/zlib-ng/arch/power/power_features.c +49 -0
  85. gencodegenes-1.2.2/src/zlib-ng/arch/power/power_features.h +18 -0
  86. gencodegenes-1.2.2/src/zlib-ng/arch/power/power_functions.h +64 -0
  87. gencodegenes-1.2.2/src/zlib-ng/arch/power/power_intrins.h +34 -0
  88. gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_hash_power8.c +12 -0
  89. gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_hash_vmx.c +10 -0
  90. gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_ppc_tpl.h +32 -0
  91. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/Makefile.in +72 -0
  92. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/README.md +45 -0
  93. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/adler32_rvv.c +136 -0
  94. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/chunkset_rvv.c +122 -0
  95. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/compare256_rvv.c +49 -0
  96. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/crc32_zbc.c +100 -0
  97. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_features.c +46 -0
  98. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_features.h +19 -0
  99. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_functions.h +56 -0
  100. gencodegenes-1.2.2/src/zlib-ng/arch/riscv/slide_hash_rvv.c +33 -0
  101. gencodegenes-1.2.2/src/zlib-ng/arch/s390/Makefile.in +48 -0
  102. gencodegenes-1.2.2/src/zlib-ng/arch/s390/README.md +265 -0
  103. gencodegenes-1.2.2/src/zlib-ng/arch/s390/crc32-vx.c +222 -0
  104. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_common.h +119 -0
  105. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_deflate.c +384 -0
  106. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_deflate.h +58 -0
  107. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_detail.h +275 -0
  108. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_inflate.c +191 -0
  109. gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_inflate.h +67 -0
  110. gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_features.c +14 -0
  111. gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_features.h +14 -0
  112. gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_functions.h +27 -0
  113. gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner +62 -0
  114. gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner-rebuild.sh +49 -0
  115. gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.Dockerfile +46 -0
  116. gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.service +18 -0
  117. gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/entrypoint +30 -0
  118. gencodegenes-1.2.2/src/zlib-ng/arch/x86/Makefile.in +169 -0
  119. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx2.c +180 -0
  120. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx2_p.h +32 -0
  121. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512.c +108 -0
  122. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512_p.h +57 -0
  123. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512_vnni.c +210 -0
  124. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_sse42.c +120 -0
  125. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_ssse3.c +156 -0
  126. gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_ssse3_p.h +29 -0
  127. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chorba_sse2.c +876 -0
  128. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chorba_sse41.c +336 -0
  129. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_avx2.c +130 -0
  130. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_avx512.c +189 -0
  131. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_sse2.c +49 -0
  132. gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_ssse3.c +70 -0
  133. gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_avx2.c +64 -0
  134. gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_avx512.c +97 -0
  135. gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_sse2.c +97 -0
  136. gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h +419 -0
  137. gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_fold_vpclmulqdq_tpl.h +107 -0
  138. gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_pclmulqdq.c +30 -0
  139. gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h +414 -0
  140. gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_vpclmulqdq.c +17 -0
  141. gencodegenes-1.2.2/src/zlib-ng/arch/x86/slide_hash_avx2.c +40 -0
  142. gencodegenes-1.2.2/src/zlib-ng/arch/x86/slide_hash_sse2.c +63 -0
  143. gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_features.c +127 -0
  144. gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_features.h +30 -0
  145. gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_functions.h +207 -0
  146. gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_intrins.h +122 -0
  147. gencodegenes-1.2.2/src/zlib-ng/arch_functions.h +31 -0
  148. gencodegenes-1.2.2/src/zlib-ng/chunkset_tpl.h +283 -0
  149. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-arch.c +115 -0
  150. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-arch.cmake +103 -0
  151. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-coverage.cmake +46 -0
  152. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-install-dirs.cmake +43 -0
  153. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-intrinsics.cmake +732 -0
  154. gencodegenes-1.2.2/src/zlib-ng/cmake/detect-sanitizer.cmake +157 -0
  155. gencodegenes-1.2.2/src/zlib-ng/cmake/fallback-macros.cmake +19 -0
  156. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-aarch64.cmake +24 -0
  157. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-arm.cmake +29 -0
  158. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-armhf.cmake +25 -0
  159. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-aarch64.cmake +41 -0
  160. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-armv7.cmake +41 -0
  161. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-i686.cmake +41 -0
  162. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-x86_64.cmake +41 -0
  163. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-loongarch64-gcc-14.cmake +25 -0
  164. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mingw-i686.cmake +35 -0
  165. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mingw-x86_64.cmake +34 -0
  166. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mips.cmake +29 -0
  167. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mips64.cmake +29 -0
  168. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc.cmake +25 -0
  169. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64-clang.cmake +16 -0
  170. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64-power9.cmake +25 -0
  171. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64.cmake +25 -0
  172. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le-clang.cmake +16 -0
  173. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le-power9.cmake +25 -0
  174. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le.cmake +25 -0
  175. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-riscv-clang.cmake +16 -0
  176. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-riscv.cmake +25 -0
  177. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-s390x.cmake +25 -0
  178. gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-sparc64.cmake +25 -0
  179. gencodegenes-1.2.2/src/zlib-ng/compare256_rle.h +133 -0
  180. gencodegenes-1.2.2/src/zlib-ng/compress.c +98 -0
  181. gencodegenes-1.2.2/src/zlib-ng/configure +2617 -0
  182. gencodegenes-1.2.2/src/zlib-ng/cpu_features.c +25 -0
  183. gencodegenes-1.2.2/src/zlib-ng/cpu_features.h +47 -0
  184. gencodegenes-1.2.2/src/zlib-ng/crc32.c +42 -0
  185. gencodegenes-1.2.2/src/zlib-ng/crc32.h +27 -0
  186. gencodegenes-1.2.2/src/zlib-ng/crc32_braid_comb.c +56 -0
  187. gencodegenes-1.2.2/src/zlib-ng/crc32_braid_comb_p.h +42 -0
  188. gencodegenes-1.2.2/src/zlib-ng/crc32_braid_p.h +40 -0
  189. gencodegenes-1.2.0/src/zlib/crc32.h → gencodegenes-1.2.2/src/zlib-ng/crc32_braid_tbl.h +70 -84
  190. gencodegenes-1.2.2/src/zlib-ng/deflate.c +1416 -0
  191. gencodegenes-1.2.2/src/zlib-ng/deflate.h +494 -0
  192. gencodegenes-1.2.2/src/zlib-ng/deflate_fast.c +104 -0
  193. gencodegenes-1.2.2/src/zlib-ng/deflate_huff.c +45 -0
  194. gencodegenes-1.2.2/src/zlib-ng/deflate_medium.c +293 -0
  195. gencodegenes-1.2.2/src/zlib-ng/deflate_p.h +198 -0
  196. gencodegenes-1.2.2/src/zlib-ng/deflate_quick.c +130 -0
  197. gencodegenes-1.2.2/src/zlib-ng/deflate_rle.c +84 -0
  198. gencodegenes-1.2.2/src/zlib-ng/deflate_slow.c +144 -0
  199. gencodegenes-1.2.2/src/zlib-ng/deflate_stored.c +186 -0
  200. gencodegenes-1.2.2/src/zlib-ng/doc/algorithm.txt +209 -0
  201. gencodegenes-1.2.2/src/zlib-ng/doc/crc-doc.1.0.pdf +0 -0
  202. gencodegenes-1.2.2/src/zlib-ng/doc/crc-pclmulqdq.pdf +0 -0
  203. gencodegenes-1.2.2/src/zlib-ng/doc/rfc1950.txt +619 -0
  204. gencodegenes-1.2.2/src/zlib-ng/doc/rfc1951.txt +955 -0
  205. gencodegenes-1.2.2/src/zlib-ng/doc/rfc1952.txt +675 -0
  206. gencodegenes-1.2.2/src/zlib-ng/doc/txtvsbin.txt +107 -0
  207. gencodegenes-1.2.2/src/zlib-ng/fallback_builtins.h +47 -0
  208. gencodegenes-1.2.2/src/zlib-ng/functable.c +464 -0
  209. gencodegenes-1.2.2/src/zlib-ng/functable.h +54 -0
  210. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzguts.h +45 -113
  211. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzlib.c +171 -219
  212. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzread.c +142 -186
  213. gencodegenes-1.2.2/src/zlib-ng/gzread_mangle.h.in +7 -0
  214. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzwrite.c +98 -266
  215. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/infback.c +149 -271
  216. gencodegenes-1.2.2/src/zlib-ng/inffast_tpl.h +332 -0
  217. gencodegenes-1.2.2/src/zlib-ng/inffixed_tbl.h +94 -0
  218. gencodegenes-1.2.2/src/zlib-ng/inflate.c +1461 -0
  219. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inflate.h +72 -27
  220. gencodegenes-1.2.2/src/zlib-ng/inflate_p.h +215 -0
  221. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inftrees.c +39 -48
  222. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inftrees.h +17 -13
  223. gencodegenes-1.2.2/src/zlib-ng/insert_string.c +21 -0
  224. gencodegenes-1.2.2/src/zlib-ng/insert_string_roll.c +24 -0
  225. gencodegenes-1.2.2/src/zlib-ng/insert_string_tpl.h +111 -0
  226. gencodegenes-1.2.2/src/zlib-ng/match_tpl.h +252 -0
  227. gencodegenes-1.2.2/src/zlib-ng/tools/config.sub +17 -0
  228. gencodegenes-1.2.2/src/zlib-ng/tools/makecrct.c +242 -0
  229. gencodegenes-1.2.2/src/zlib-ng/tools/makefixed.c +89 -0
  230. gencodegenes-1.2.2/src/zlib-ng/tools/maketrees.c +148 -0
  231. gencodegenes-1.2.2/src/zlib-ng/trees.c +818 -0
  232. gencodegenes-1.2.2/src/zlib-ng/trees.h +40 -0
  233. gencodegenes-1.2.2/src/zlib-ng/trees_emit.h +231 -0
  234. gencodegenes-1.2.2/src/zlib-ng/trees_tbl.h +132 -0
  235. {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/uncompr.c +21 -34
  236. gencodegenes-1.2.2/src/zlib-ng/win32/zlib-ng.def.in +60 -0
  237. gencodegenes-1.2.2/src/zlib-ng/win32/zlib-ng1.rc +36 -0
  238. gencodegenes-1.2.2/src/zlib-ng/win32/zlib.def.in +64 -0
  239. gencodegenes-1.2.2/src/zlib-ng/win32/zlib1.rc +36 -0
  240. gencodegenes-1.2.2/src/zlib-ng/win32/zlibcompat.def.in +97 -0
  241. gencodegenes-1.2.2/src/zlib-ng/zbuild.h +364 -0
  242. gencodegenes-1.2.2/src/zlib-ng/zconf-ng.h.in +176 -0
  243. gencodegenes-1.2.2/src/zlib-ng/zconf.h.in +206 -0
  244. gencodegenes-1.2.2/src/zlib-ng/zendian.h +60 -0
  245. gencodegenes-1.2.2/src/zlib-ng/zlib-config.cmake.in +12 -0
  246. gencodegenes-1.2.2/src/zlib-ng/zlib-ng-config.cmake.in +10 -0
  247. gencodegenes-1.2.2/src/zlib-ng/zlib-ng.h.in +1871 -0
  248. gencodegenes-1.2.2/src/zlib-ng/zlib-ng.map.in +110 -0
  249. gencodegenes-1.2.0/src/zlib/zlib.h → gencodegenes-1.2.2/src/zlib-ng/zlib.h.in +263 -339
  250. gencodegenes-1.2.2/src/zlib-ng/zlib.map.in +98 -0
  251. gencodegenes-1.2.2/src/zlib-ng/zlib.pc.cmakein +15 -0
  252. gencodegenes-1.2.2/src/zlib-ng/zlib.pc.in +15 -0
  253. gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling-ng.h.in +178 -0
  254. gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling.h.empty +8 -0
  255. gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling.h.in +170 -0
  256. gencodegenes-1.2.2/src/zlib-ng/zmemory.h +99 -0
  257. gencodegenes-1.2.2/src/zlib-ng/zutil.c +151 -0
  258. gencodegenes-1.2.2/src/zlib-ng/zutil.h +142 -0
  259. gencodegenes-1.2.2/src/zlib-ng/zutil_p.h +20 -0
  260. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/test_gencode.py +198 -12
  261. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/test_sequence_methods.py +63 -4
  262. gencodegenes-1.2.2/tests/test_transcript.py +1139 -0
  263. gencodegenes-1.2.0/setup.py +0 -69
  264. gencodegenes-1.2.0/src/gencode.cpp +0 -313
  265. gencodegenes-1.2.0/src/gencodegenes/transcript.pyi +0 -137
  266. gencodegenes-1.2.0/src/gencodegenes.egg-info/SOURCES.txt +0 -59
  267. gencodegenes-1.2.0/src/gtf.cpp +0 -300
  268. gencodegenes-1.2.0/src/tx.cpp +0 -918
  269. gencodegenes-1.2.0/src/zlib/adler32.c +0 -186
  270. gencodegenes-1.2.0/src/zlib/compress.c +0 -86
  271. gencodegenes-1.2.0/src/zlib/crc32.c +0 -1125
  272. gencodegenes-1.2.0/src/zlib/deflate.c +0 -2217
  273. gencodegenes-1.2.0/src/zlib/deflate.h +0 -346
  274. gencodegenes-1.2.0/src/zlib/gzclose.c +0 -25
  275. gencodegenes-1.2.0/src/zlib/inffast.c +0 -323
  276. gencodegenes-1.2.0/src/zlib/inffast.h +0 -11
  277. gencodegenes-1.2.0/src/zlib/inffixed.h +0 -94
  278. gencodegenes-1.2.0/src/zlib/inflate.c +0 -1595
  279. gencodegenes-1.2.0/src/zlib/trees.c +0 -1181
  280. gencodegenes-1.2.0/src/zlib/trees.h +0 -128
  281. gencodegenes-1.2.0/src/zlib/zconf.h +0 -547
  282. gencodegenes-1.2.0/src/zlib/zutil.c +0 -327
  283. gencodegenes-1.2.0/src/zlib/zutil.h +0 -275
  284. gencodegenes-1.2.0/tests/test_transcript.py +0 -540
  285. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/LICENSE.txt +0 -0
  286. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/setup.cfg +0 -0
  287. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/__init__.py +0 -0
  288. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/py.typed +0 -0
  289. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/dependency_links.txt +0 -0
  290. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/requires.txt +0 -0
  291. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/top_level.txt +0 -0
  292. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/__init__.py +0 -0
  293. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/data/example.grch38.fa +0 -0
  294. {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/data/example.grch38.gtf +0 -0
@@ -10,8 +10,10 @@ include src/gencodegenes/py.typed
10
10
  include src/*.h
11
11
  include src/*.cpp
12
12
 
13
- include src/zlib/*.c
14
- include src/zlib/*.h
13
+ graft src/zlib-ng
14
+ prune src/zlib-ng/test
15
+ prune src/zlib-ng/.github
16
+ exclude src/zlib-ng/.git
15
17
 
16
18
  # gencodegenes tests
17
19
  include tests/*.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gencodegenes
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Package to load genes from GENCODE GTF files
5
5
  Author-email: Jeremy McRae <jeremy.mcrae@gmail.com>
6
6
  License-Expression: MIT
@@ -75,8 +75,10 @@ tx.name # transcript ID
75
75
  tx.chrom # transcript chromosome
76
76
  tx.start # transcript start (lowest position on chromosome)
77
77
  tx.end # transcript end (highest position on chromosome)
78
- tx.cds_start # CDS start position
79
- tx.cds_end # CDS end position
78
+ tx.tss # transcription start site (tx.end on the - strand)
79
+ tx.cds_start # CDS start position, in the direction of transcription (so
80
+ # the highest CDS position on the - strand)
81
+ tx.cds_end # CDS end position, in the direction of transcription
80
82
  tx.type # transcript type e.g. protein_coding
81
83
  tx.strand # strand (+ or -)
82
84
  tx.exons # list of exon coordinates
@@ -60,8 +60,10 @@ tx.name # transcript ID
60
60
  tx.chrom # transcript chromosome
61
61
  tx.start # transcript start (lowest position on chromosome)
62
62
  tx.end # transcript end (highest position on chromosome)
63
- tx.cds_start # CDS start position
64
- tx.cds_end # CDS end position
63
+ tx.tss # transcription start site (tx.end on the - strand)
64
+ tx.cds_start # CDS start position, in the direction of transcription (so
65
+ # the highest CDS position on the - strand)
66
+ tx.cds_end # CDS end position, in the direction of transcription
65
67
  tx.type # transcript type e.g. protein_coding
66
68
  tx.strand # strand (+ or -)
67
69
  tx.exons # list of exon coordinates
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["cython", "setuptools >= 77.0.0"]
2
+ requires = ["cython", "setuptools >= 77.0.0", "cmake >= 3.14"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = 'gencodegenes'
7
- version = '1.2.0'
7
+ version = '1.2.2'
8
8
  description = 'Package to load genes from GENCODE GTF files'
9
9
  readme = 'README.md'
10
10
  license = "MIT"
@@ -0,0 +1,88 @@
1
+
2
+ import os
3
+ import subprocess
4
+ import sys
5
+ import shutil
6
+
7
+ from setuptools import setup, Extension
8
+ from setuptools.command.build_ext import build_ext
9
+ from Cython.Build import cythonize
10
+
11
+ EXTRA_COMPILE_ARGS = []
12
+ EXTRA_LINK_ARGS = []
13
+ if sys.platform == "win32":
14
+ EXTRA_COMPILE_ARGS += ['/std:c++14']
15
+ else:
16
+ EXTRA_COMPILE_ARGS += ['-std=c++11']
17
+ if sys.platform == "darwin":
18
+ EXTRA_COMPILE_ARGS += ["-stdlib=libc++"]
19
+ EXTRA_LINK_ARGS += ["-stdlib=libc++"]
20
+
21
+ ZLIB_NG_DIR = os.path.abspath('src/zlib-ng')
22
+
23
+ class build_ext_zlib_ng(build_ext):
24
+ ''' build zlib-ng as a static library (via cmake), before building extensions
25
+
26
+ zlib-ng is built with its native API (zng_ prefixed functions), so it can't
27
+ clash with any system zlib loaded into the python process.
28
+ '''
29
+ def run(self):
30
+ build_dir = os.path.abspath(os.path.join(self.build_temp, 'zlib-ng'))
31
+ config = [
32
+ '-DCMAKE_BUILD_TYPE=Release',
33
+ '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
34
+ '-DBUILD_SHARED_LIBS=OFF',
35
+ '-DZLIB_COMPAT=OFF',
36
+ '-DWITH_GZFILEOP=ON',
37
+ '-DBUILD_TESTING=OFF',
38
+ ]
39
+ archflags = os.environ.get('ARCHFLAGS', '')
40
+ if sys.platform == 'darwin' and archflags:
41
+ # match the architectures requested for the extension (e.g. by cibuildwheel)
42
+ archs = ';'.join(archflags.split()[1::2])
43
+ config.append(f'-DCMAKE_OSX_ARCHITECTURES={archs}')
44
+ subprocess.check_call(['cmake', '-S', ZLIB_NG_DIR, '-B', build_dir] + config)
45
+ subprocess.check_call(['cmake', '--build', build_dir, '--config', 'Release',
46
+ '--parallel'])
47
+
48
+ lib_dir = build_dir
49
+ lib = 'z-ng'
50
+ if sys.platform == 'win32':
51
+ lib_dir = os.path.join(build_dir, 'Release')
52
+ lib = 'zlibstatic-ng'
53
+ for ext in self.extensions:
54
+ if ext.name == 'gencodegenes.gencode':
55
+ ext.include_dirs.append(build_dir)
56
+ ext.library_dirs.append(lib_dir)
57
+ ext.libraries.append(lib)
58
+ super().run()
59
+
60
+ extensions = [
61
+ Extension("gencodegenes.transcript",
62
+ extra_compile_args=EXTRA_COMPILE_ARGS,
63
+ extra_link_args=EXTRA_LINK_ARGS,
64
+ sources=[
65
+ "src/gencodegenes/transcript.pyx",
66
+ "src/tx.cpp"],
67
+ include_dirs=["src/"],
68
+ language="c++"),
69
+ Extension("gencodegenes.gencode",
70
+ extra_compile_args=EXTRA_COMPILE_ARGS,
71
+ extra_link_args=EXTRA_LINK_ARGS,
72
+ sources=[
73
+ "src/gencodegenes/gencode.pyx",
74
+ "src/gencode.cpp",
75
+ "src/gtf.cpp",
76
+ "src/tx.cpp"],
77
+ include_dirs=["src/"],
78
+ define_macros=[('WITH_GZFILEOP', None)],
79
+ language="c++"),
80
+ ]
81
+
82
+ shutil.copy("src/tx.h", "src/gencodegenes/tx.h")
83
+
84
+ setup(
85
+ package_dir={'': 'src'},
86
+ ext_modules=cythonize(extensions),
87
+ cmdclass={'build_ext': build_ext_zlib_ng},
88
+ )
@@ -0,0 +1,302 @@
1
+
2
+ #include <algorithm>
3
+ #include <climits>
4
+ #include <cstdlib>
5
+ #include <deque>
6
+ #include <iostream>
7
+ #include <map>
8
+ #include <stdexcept>
9
+ #include <string>
10
+ #include <unordered_map>
11
+ #include <unordered_set>
12
+ #include <utility>
13
+ #include <vector>
14
+
15
+ #include "gtf.h"
16
+ #include "tx.h"
17
+ #include "gencode.h"
18
+
19
+ namespace gencode {
20
+
21
+ // features collected for a transcript while loading the GTF, to construct a Tx
22
+ struct TxInfo {
23
+ std::string name;
24
+ std::string chrom;
25
+ int start = 0;
26
+ int end = 0;
27
+ char strand;
28
+ std::string transcript_type;
29
+ std::vector<Region> exons;
30
+ std::vector<Region> cds;
31
+ // CDS range, including the start and stop codons
32
+ int cds_min = INT_MAX;
33
+ int cds_max = 0;
34
+ int is_canonical = 0;
35
+ std::string symbol;
36
+ std::vector<std::string> alt_ids;
37
+ std::map<std::string, std::string> attributes;
38
+ };
39
+
40
+ // find the index of the exon containing a given chromosome position
41
+ static size_t get_exon_num(const std::vector<Region> & exons, int pos) {
42
+ for (size_t i = 0; i < exons.size(); i++) {
43
+ if ((pos >= exons[i].start) && (pos <= exons[i].end)) {
44
+ return i;
45
+ }
46
+ }
47
+ throw std::invalid_argument("can't find exon for an end codon");
48
+ }
49
+
50
+ // adjust CDS coords for any end codon positions
51
+ //
52
+ // the CDS might exclude the start codon and end codon from the CDS range
53
+ // we have collected the start and end codon ends in cds_min and cds_max. We
54
+ // can't just set the first CDS coord and last CDS coord to their values though,
55
+ // as at least one stop codon spans an intron boundary, which messes up the
56
+ // CDS if included as is.
57
+ static void include_end_codons(TxInfo & info) {
58
+ if (info.cds.empty()) {
59
+ return;
60
+ }
61
+ auto by_start = [](const Region & a, const Region & b) { return a.start < b.start; };
62
+ std::sort(info.cds.begin(), info.cds.end(), by_start);
63
+ std::sort(info.exons.begin(), info.exons.end(), by_start);
64
+
65
+ // handle left (5') boundary
66
+ size_t first_idx = get_exon_num(info.exons, info.cds[0].start);
67
+ size_t min_idx = get_exon_num(info.exons, info.cds_min);
68
+ if (min_idx == first_idx) {
69
+ info.cds[0].start = info.cds_min;
70
+ } else {
71
+ info.cds[0].start = info.exons[first_idx].start; // extend existing CDS
72
+ info.cds.insert(info.cds.begin(), Region {info.cds_min, info.exons[min_idx].end});
73
+ }
74
+
75
+ // handle right (3') boundary
76
+ size_t last_idx = get_exon_num(info.exons, info.cds.back().end);
77
+ size_t max_idx = get_exon_num(info.exons, info.cds_max);
78
+ if (max_idx == last_idx) {
79
+ info.cds.back().end = info.cds_max;
80
+ } else {
81
+ info.cds.back().end = info.exons[last_idx].end; // extend existing CDS
82
+ info.cds.push_back(Region {info.exons[max_idx].start, info.cds_max});
83
+ }
84
+ }
85
+
86
+ // set the transcript span from its exons and CDS, for GTFs without transcript lines
87
+ static void set_span(TxInfo & info) {
88
+ if (info.start != 0 || info.end != 0) {
89
+ return;
90
+ }
91
+ bool first = true;
92
+ for (auto regions : {&info.exons, &info.cds}) {
93
+ for (auto & x : *regions) {
94
+ info.start = first ? x.start : std::min(info.start, x.start);
95
+ info.end = first ? x.end : std::max(info.end, x.end);
96
+ first = false;
97
+ }
98
+ }
99
+ }
100
+
101
+ // construct a Tx from the features collected for a transcript
102
+ //
103
+ // Transcripts with inconsistent coordinates (e.g. a stop codon outside the
104
+ // exons) are skipped with a warning, so one malformed transcript doesn't stop
105
+ // the rest of the GTF from loading.
106
+ static void add_transcript(std::vector<NamedTx> & transcripts, TxInfo & info) {
107
+ try {
108
+ if (info.exons.empty()) {
109
+ throw std::invalid_argument("no exons");
110
+ }
111
+ include_end_codons(info);
112
+ set_span(info);
113
+ Tx tx(info.name, info.chrom, info.start, info.end, info.strand,
114
+ info.transcript_type, std::move(info.attributes));
115
+ tx.set_exons(std::move(info.exons));
116
+ tx.set_cds(std::move(info.cds));
117
+ transcripts.push_back({std::move(info.symbol), std::move(info.alt_ids),
118
+ std::move(tx), info.is_canonical});
119
+ } catch (const std::invalid_argument & e) {
120
+ std::cerr << "skipping transcript " << info.name << ": " << e.what() << std::endl;
121
+ }
122
+ }
123
+
124
+ // build transcripts in the order they first appeared, freeing each entry once
125
+ // its transcript is built
126
+ //
127
+ // @param pos start of the current GTF line. Transcripts are only built once this
128
+ // passes their end, as no further lines for them can follow in a
129
+ // position-sorted GTF. Use -1 to build all transcripts.
130
+ static void build_transcripts(std::vector<NamedTx> & transcripts,
131
+ std::deque<TxInfo> & entries, std::unordered_map<std::string, TxInfo *> & index,
132
+ int pos=-1) {
133
+ while (!entries.empty()) {
134
+ TxInfo & info = entries.front();
135
+ if (pos != -1 && (info.end == 0 || pos <= info.end)) {
136
+ break;
137
+ }
138
+ index.erase(info.name);
139
+ add_transcript(transcripts, info);
140
+ entries.pop_front();
141
+ }
142
+ }
143
+
144
+ // find the entry for a GTF line's transcript, or start a new one from the line
145
+ static TxInfo * get_entry(std::deque<TxInfo> & entries,
146
+ std::unordered_map<std::string, TxInfo *> & index, GTFLine & gtf) {
147
+ auto it = index.find(gtf.tx_id);
148
+ if (it != index.end()) {
149
+ return it->second;
150
+ }
151
+ entries.emplace_back();
152
+ TxInfo * info = &entries.back();
153
+ index[gtf.tx_id] = info;
154
+
155
+ info->name = gtf.tx_id;
156
+ info->chrom = gtf.chrom;
157
+ info->strand = gtf.strand[0];
158
+ info->is_canonical = gtf.is_canonical;
159
+ info->transcript_type = gtf.transcript_type;
160
+ info->symbol = gtf.symbol;
161
+ info->alt_ids = gtf.alternate_ids;
162
+ if (gtf.feature != "transcript") {
163
+ // without a transcript line, use the first line's attributes, minus the
164
+ // fields specific to that feature
165
+ info->attributes = std::move(gtf.attributes);
166
+ for (auto field : {"exon_number", "exon_id", "exon_version"}) {
167
+ info->attributes.erase(field);
168
+ }
169
+ }
170
+ return info;
171
+ }
172
+
173
+ enum class Feature { other, transcript, exon, cds, codon, utr };
174
+
175
+ static Feature get_feature(const std::string & feature) {
176
+ if (feature == "exon") { return Feature::exon; }
177
+ if (feature == "CDS") { return Feature::cds; }
178
+ if (feature == "UTR") { return Feature::utr; }
179
+ if (feature == "transcript") { return Feature::transcript; }
180
+ if (feature == "start_codon" || feature == "stop_codon") { return Feature::codon; }
181
+ return Feature::other;
182
+ }
183
+
184
+ // collect all features for a transcript into a single object
185
+ //
186
+ // When we load lines from gencode GTF files, each line represents a single exon
187
+ // or CDS, and we need to combine these based on transcript ID. Lines for a
188
+ // transcript are usually contiguous, but position-sorted GTFs interleave
189
+ // transcripts, so features are collected by transcript ID until the chromosome
190
+ // changes (GTFs are grouped by chromosome), or the GTF moves past the transcript.
191
+ static void load_transcripts(std::vector<NamedTx> & transcripts, GTF & gtf_file, bool coding) {
192
+ std::deque<TxInfo> entries;
193
+ std::unordered_map<std::string, TxInfo *> index;
194
+ TxInfo * info = nullptr;
195
+ GTFLine gtf;
196
+
197
+ while (gtf_file.next(gtf)) {
198
+ Feature feature = get_feature(gtf.feature);
199
+ if (feature == Feature::other || (coding && gtf.transcript_type != "protein_coding")) {
200
+ continue;
201
+ }
202
+
203
+ // only look up the transcript when it differs from the previous line's
204
+ if (info == nullptr || gtf.tx_id != info->name || gtf.chrom != info->chrom) {
205
+ bool new_chrom = info != nullptr && gtf.chrom != info->chrom;
206
+ build_transcripts(transcripts, entries, index, new_chrom ? -1 : gtf.start);
207
+ info = get_entry(entries, index, gtf);
208
+ }
209
+
210
+ if (feature == Feature::transcript) {
211
+ info->start = gtf.start;
212
+ info->end = gtf.end;
213
+ info->attributes = std::move(gtf.attributes);
214
+ } else if (feature == Feature::exon) {
215
+ info->exons.push_back(Region {gtf.start, gtf.end});
216
+ } else if (feature == Feature::cds) {
217
+ info->cds.push_back(Region {gtf.start, gtf.end});
218
+ }
219
+ if (feature == Feature::cds || feature == Feature::codon) {
220
+ info->cds_min = std::min({info->cds_min, gtf.start, gtf.end});
221
+ info->cds_max = std::max({info->cds_max, gtf.start, gtf.end});
222
+ }
223
+ }
224
+
225
+ build_transcripts(transcripts, entries, index);
226
+ }
227
+
228
+ std::vector<NamedTx> open_gencode(std::string path, bool coding) {
229
+ GTF gtf_file(path);
230
+ std::vector<NamedTx> transcripts;
231
+ transcripts.reserve(80000);
232
+ load_transcripts(transcripts, gtf_file, coding);
233
+ return transcripts;
234
+ }
235
+
236
+ bool CompFunc(const GenePoint &l, const GenePoint &r) {
237
+ return l.pos < r.pos;
238
+ }
239
+
240
+ // find genes overlapping a region
241
+ //
242
+ // @param starts gene start positions per chromosome, sorted by position
243
+ // @param ends gene end positions per chromosome, sorted by position
244
+ // @param max_window maximum gene length, which limits how far beyond the region
245
+ // we search for genes that span the whole region
246
+ // @returns keys for the genes overlapping the region
247
+ std::vector<std::string> _in_region(std::string chrom, int start, int end,
248
+ std::map<std::string, std::vector<GenePoint>> & starts,
249
+ std::map<std::string, std::vector<GenePoint>> & ends,
250
+ int max_window) {
251
+ if (start > end) {
252
+ throw std::invalid_argument("region start (" + std::to_string(start)
253
+ + ") is after its end (" + std::to_string(end) + ")");
254
+ }
255
+ auto starts_it = starts.find(chrom);
256
+ if (starts_it == starts.end()) {
257
+ throw std::invalid_argument("unknown_chrom: " + chrom);
258
+ }
259
+ const std::vector<GenePoint> & chrom_starts = starts_it->second;
260
+ const std::vector<GenePoint> & chrom_ends = ends.at(chrom);
261
+ const int n_starts = (int) chrom_starts.size();
262
+ const int n_ends = (int) chrom_ends.size();
263
+ std::vector<std::string> symbols;
264
+
265
+ // find genes with a start inside the region
266
+ std::unordered_set<std::string> inside;
267
+ int first_start = std::lower_bound(chrom_starts.begin(), chrom_starts.end(),
268
+ GenePoint {start, ""}, CompFunc) - chrom_starts.begin();
269
+ for (int i = first_start; i < n_starts && chrom_starts[i].pos <= end; i++) {
270
+ inside.insert(chrom_starts[i].symbol);
271
+ symbols.push_back(chrom_starts[i].symbol);
272
+ }
273
+
274
+ // find genes with an end inside the region (that don't also start inside it)
275
+ int after_end = std::upper_bound(chrom_ends.begin(), chrom_ends.end(),
276
+ GenePoint {end, ""}, CompFunc) - chrom_ends.begin();
277
+ for (int i = after_end - 1; i >= 0 && chrom_ends[i].pos >= start; i--) {
278
+ if (inside.count(chrom_ends[i].symbol) == 0) {
279
+ symbols.push_back(chrom_ends[i].symbol);
280
+ }
281
+ }
282
+
283
+ if (std::abs(end - start) > max_window) {
284
+ // if the window is too wide to permit a gene to span it, just return
285
+ return symbols;
286
+ }
287
+
288
+ // find genes that span the region, i.e. start upstream and end downstream
289
+ std::unordered_set<std::string> starts_before;
290
+ for (int i = first_start - 1; i >= 0 && std::abs(chrom_starts[i].pos - end) <= max_window; i--) {
291
+ starts_before.insert(chrom_starts[i].symbol);
292
+ }
293
+ for (int i = after_end; i < n_ends && std::abs(chrom_ends[i].pos - start) <= max_window; i++) {
294
+ if (starts_before.count(chrom_ends[i].symbol) != 0) {
295
+ symbols.push_back(chrom_ends[i].symbol);
296
+ }
297
+ }
298
+
299
+ return symbols;
300
+ }
301
+
302
+ } // namespace
@@ -1,33 +1,14 @@
1
1
  #ifndef GENCODEGENES_GENCODE_H_
2
2
  #define GENCODEGENES_GENCODE_H_
3
3
 
4
- #include <cstdint>
5
- #include <fstream>
6
4
  #include <string>
7
5
  #include <map>
8
6
  #include <vector>
9
- #include <set>
10
7
 
11
- #include "gtf.h"
12
8
  #include "tx.h"
13
9
 
14
10
  namespace gencode {
15
11
 
16
- // collects info for a transcript, so we can later construct a Tx object
17
- struct TxInfo {
18
- std::string name = "";
19
- std::string chrom;
20
- int start = 0;
21
- int end = 0;
22
- std::string strand;
23
- std::string transcript_type;
24
- std::vector<std::vector<int> > exons;
25
- std::vector<std::vector<int> > cds;
26
- int offset = 0;
27
- int is_canonical = 0;
28
- std::map<std::string, std::string> attributes;
29
- };
30
-
31
12
  // stores HGNC symbol with the transcript, so we can collect transcripts by gene
32
13
  struct NamedTx {
33
14
  std::string symbol;
@@ -53,4 +34,3 @@ std::vector<std::string> _in_region(std::string chrom, int start, int end,
53
34
  } // namespace
54
35
 
55
36
  #endif // GENCODEGENES_GENCODE_H_
56
-