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.
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/MANIFEST.in +4 -2
- {gencodegenes-1.2.0/src/gencodegenes.egg-info → gencodegenes-1.2.2}/PKG-INFO +5 -3
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/README.md +4 -2
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/pyproject.toml +2 -2
- gencodegenes-1.2.2/setup.py +88 -0
- gencodegenes-1.2.2/src/gencode.cpp +302 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencode.h +0 -20
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.cpp +18269 -16462
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.pyi +1 -1
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/gencode.pyx +195 -91
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.cpp +11454 -14886
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.pxd +2 -1
- gencodegenes-1.2.2/src/gencodegenes/transcript.pyi +382 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/transcript.pyx +48 -57
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/tx.h +38 -17
- {gencodegenes-1.2.0 → gencodegenes-1.2.2/src/gencodegenes.egg-info}/PKG-INFO +5 -3
- gencodegenes-1.2.2/src/gencodegenes.egg-info/SOURCES.txt +270 -0
- gencodegenes-1.2.2/src/gtf.cpp +346 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gtf.h +3 -3
- {gencodegenes-1.2.0/src/gencodegenes → gencodegenes-1.2.2/src}/tx.cpp +560 -144
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/tx.h +38 -17
- gencodegenes-1.2.2/src/zlib-ng/.codecov.yaml +27 -0
- gencodegenes-1.2.2/src/zlib-ng/.gitattributes +9 -0
- gencodegenes-1.2.2/src/zlib-ng/.gitignore +111 -0
- gencodegenes-1.2.2/src/zlib-ng/.shellcheckrc +1 -0
- gencodegenes-1.2.2/src/zlib-ng/CMakeLists.txt +1675 -0
- gencodegenes-1.2.2/src/zlib-ng/FAQ.zlib +373 -0
- gencodegenes-1.2.2/src/zlib-ng/INDEX.md +36 -0
- gencodegenes-1.2.2/src/zlib-ng/LICENSE.md +19 -0
- gencodegenes-1.2.2/src/zlib-ng/Makefile.in +409 -0
- gencodegenes-1.2.2/src/zlib-ng/PORTING.md +111 -0
- gencodegenes-1.2.2/src/zlib-ng/README.md +236 -0
- gencodegenes-1.2.2/src/zlib-ng/adler32.c +69 -0
- gencodegenes-1.2.2/src/zlib-ng/adler32_p.h +70 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/.gitignore +2 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/Makefile.in +78 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/acle_intrins.h +85 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/adler32_neon.c +386 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_features.c +115 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_features.h +16 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/arm_functions.h +71 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/chunkset_neon.c +79 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/compare256_neon.c +60 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/crc32_armv8.c +86 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/neon_intrins.h +67 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/slide_hash_armv6.c +48 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/arm/slide_hash_neon.c +47 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/Makefile.in +82 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/adler32_c.c +54 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/adler32_fold_c.c +15 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_128bit_perm_idx_lut.h +26 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_256bit_perm_idx_lut.h +47 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunk_permute_table.h +53 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/chunkset_c.c +42 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/compare256_c.c +31 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/compare256_p.h +123 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_braid_c.c +222 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_chorba_c.c +1485 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/crc32_fold_c.c +31 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/generic_functions.h +72 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/generic/slide_hash_c.c +52 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/Makefile.in +99 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/adler32_lasx.c +127 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/adler32_lsx.c +156 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/chunkset_lasx.c +126 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/chunkset_lsx.c +72 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/compare256_lasx.c +63 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/compare256_lsx.c +99 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/crc32_la.c +86 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/lasxintrin_ext.h +90 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_features.c +27 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_features.h +19 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/loongarch_functions.h +95 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/lsxintrin_ext.h +33 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/slide_hash_lasx.c +41 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/loongarch/slide_hash_lsx.c +64 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/Makefile.in +93 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/adler32_power8.c +153 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/adler32_vmx.c +186 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/chunkset_power8.c +50 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/compare256_power9.c +66 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/crc32_constants.h +1123 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/crc32_power8.c +587 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/power_features.c +49 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/power_features.h +18 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/power_functions.h +64 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/power_intrins.h +34 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_hash_power8.c +12 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_hash_vmx.c +10 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/power/slide_ppc_tpl.h +32 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/Makefile.in +72 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/README.md +45 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/adler32_rvv.c +136 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/chunkset_rvv.c +122 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/compare256_rvv.c +49 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/crc32_zbc.c +100 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_features.c +46 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_features.h +19 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/riscv_functions.h +56 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/riscv/slide_hash_rvv.c +33 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/Makefile.in +48 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/README.md +265 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/crc32-vx.c +222 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_common.h +119 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_deflate.c +384 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_deflate.h +58 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_detail.h +275 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_inflate.c +191 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/dfltcc_inflate.h +67 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_features.c +14 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_features.h +14 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/s390_functions.h +27 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner +62 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner-rebuild.sh +49 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.Dockerfile +46 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.service +18 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/s390/self-hosted-builder/entrypoint +30 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/Makefile.in +169 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx2.c +180 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx2_p.h +32 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512.c +108 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512_p.h +57 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_avx512_vnni.c +210 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_sse42.c +120 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_ssse3.c +156 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/adler32_ssse3_p.h +29 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chorba_sse2.c +876 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chorba_sse41.c +336 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_avx2.c +130 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_avx512.c +189 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_sse2.c +49 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/chunkset_ssse3.c +70 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_avx2.c +64 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_avx512.c +97 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/compare256_sse2.c +97 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h +419 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_fold_vpclmulqdq_tpl.h +107 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_pclmulqdq.c +30 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h +414 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/crc32_vpclmulqdq.c +17 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/slide_hash_avx2.c +40 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/slide_hash_sse2.c +63 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_features.c +127 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_features.h +30 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_functions.h +207 -0
- gencodegenes-1.2.2/src/zlib-ng/arch/x86/x86_intrins.h +122 -0
- gencodegenes-1.2.2/src/zlib-ng/arch_functions.h +31 -0
- gencodegenes-1.2.2/src/zlib-ng/chunkset_tpl.h +283 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-arch.c +115 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-arch.cmake +103 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-coverage.cmake +46 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-install-dirs.cmake +43 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-intrinsics.cmake +732 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/detect-sanitizer.cmake +157 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/fallback-macros.cmake +19 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-aarch64.cmake +24 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-arm.cmake +29 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-armhf.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-aarch64.cmake +41 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-armv7.cmake +41 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-i686.cmake +41 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-llvm-mingw-x86_64.cmake +41 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-loongarch64-gcc-14.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mingw-i686.cmake +35 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mingw-x86_64.cmake +34 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mips.cmake +29 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-mips64.cmake +29 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64-clang.cmake +16 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64-power9.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le-clang.cmake +16 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le-power9.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-powerpc64le.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-riscv-clang.cmake +16 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-riscv.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-s390x.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cmake/toolchain-sparc64.cmake +25 -0
- gencodegenes-1.2.2/src/zlib-ng/compare256_rle.h +133 -0
- gencodegenes-1.2.2/src/zlib-ng/compress.c +98 -0
- gencodegenes-1.2.2/src/zlib-ng/configure +2617 -0
- gencodegenes-1.2.2/src/zlib-ng/cpu_features.c +25 -0
- gencodegenes-1.2.2/src/zlib-ng/cpu_features.h +47 -0
- gencodegenes-1.2.2/src/zlib-ng/crc32.c +42 -0
- gencodegenes-1.2.2/src/zlib-ng/crc32.h +27 -0
- gencodegenes-1.2.2/src/zlib-ng/crc32_braid_comb.c +56 -0
- gencodegenes-1.2.2/src/zlib-ng/crc32_braid_comb_p.h +42 -0
- gencodegenes-1.2.2/src/zlib-ng/crc32_braid_p.h +40 -0
- gencodegenes-1.2.0/src/zlib/crc32.h → gencodegenes-1.2.2/src/zlib-ng/crc32_braid_tbl.h +70 -84
- gencodegenes-1.2.2/src/zlib-ng/deflate.c +1416 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate.h +494 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_fast.c +104 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_huff.c +45 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_medium.c +293 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_p.h +198 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_quick.c +130 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_rle.c +84 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_slow.c +144 -0
- gencodegenes-1.2.2/src/zlib-ng/deflate_stored.c +186 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/algorithm.txt +209 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/crc-doc.1.0.pdf +0 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/crc-pclmulqdq.pdf +0 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/rfc1950.txt +619 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/rfc1951.txt +955 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/rfc1952.txt +675 -0
- gencodegenes-1.2.2/src/zlib-ng/doc/txtvsbin.txt +107 -0
- gencodegenes-1.2.2/src/zlib-ng/fallback_builtins.h +47 -0
- gencodegenes-1.2.2/src/zlib-ng/functable.c +464 -0
- gencodegenes-1.2.2/src/zlib-ng/functable.h +54 -0
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzguts.h +45 -113
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzlib.c +171 -219
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzread.c +142 -186
- gencodegenes-1.2.2/src/zlib-ng/gzread_mangle.h.in +7 -0
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/gzwrite.c +98 -266
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/infback.c +149 -271
- gencodegenes-1.2.2/src/zlib-ng/inffast_tpl.h +332 -0
- gencodegenes-1.2.2/src/zlib-ng/inffixed_tbl.h +94 -0
- gencodegenes-1.2.2/src/zlib-ng/inflate.c +1461 -0
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inflate.h +72 -27
- gencodegenes-1.2.2/src/zlib-ng/inflate_p.h +215 -0
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inftrees.c +39 -48
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/inftrees.h +17 -13
- gencodegenes-1.2.2/src/zlib-ng/insert_string.c +21 -0
- gencodegenes-1.2.2/src/zlib-ng/insert_string_roll.c +24 -0
- gencodegenes-1.2.2/src/zlib-ng/insert_string_tpl.h +111 -0
- gencodegenes-1.2.2/src/zlib-ng/match_tpl.h +252 -0
- gencodegenes-1.2.2/src/zlib-ng/tools/config.sub +17 -0
- gencodegenes-1.2.2/src/zlib-ng/tools/makecrct.c +242 -0
- gencodegenes-1.2.2/src/zlib-ng/tools/makefixed.c +89 -0
- gencodegenes-1.2.2/src/zlib-ng/tools/maketrees.c +148 -0
- gencodegenes-1.2.2/src/zlib-ng/trees.c +818 -0
- gencodegenes-1.2.2/src/zlib-ng/trees.h +40 -0
- gencodegenes-1.2.2/src/zlib-ng/trees_emit.h +231 -0
- gencodegenes-1.2.2/src/zlib-ng/trees_tbl.h +132 -0
- {gencodegenes-1.2.0/src/zlib → gencodegenes-1.2.2/src/zlib-ng}/uncompr.c +21 -34
- gencodegenes-1.2.2/src/zlib-ng/win32/zlib-ng.def.in +60 -0
- gencodegenes-1.2.2/src/zlib-ng/win32/zlib-ng1.rc +36 -0
- gencodegenes-1.2.2/src/zlib-ng/win32/zlib.def.in +64 -0
- gencodegenes-1.2.2/src/zlib-ng/win32/zlib1.rc +36 -0
- gencodegenes-1.2.2/src/zlib-ng/win32/zlibcompat.def.in +97 -0
- gencodegenes-1.2.2/src/zlib-ng/zbuild.h +364 -0
- gencodegenes-1.2.2/src/zlib-ng/zconf-ng.h.in +176 -0
- gencodegenes-1.2.2/src/zlib-ng/zconf.h.in +206 -0
- gencodegenes-1.2.2/src/zlib-ng/zendian.h +60 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib-config.cmake.in +12 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib-ng-config.cmake.in +10 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib-ng.h.in +1871 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib-ng.map.in +110 -0
- gencodegenes-1.2.0/src/zlib/zlib.h → gencodegenes-1.2.2/src/zlib-ng/zlib.h.in +263 -339
- gencodegenes-1.2.2/src/zlib-ng/zlib.map.in +98 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib.pc.cmakein +15 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib.pc.in +15 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling-ng.h.in +178 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling.h.empty +8 -0
- gencodegenes-1.2.2/src/zlib-ng/zlib_name_mangling.h.in +170 -0
- gencodegenes-1.2.2/src/zlib-ng/zmemory.h +99 -0
- gencodegenes-1.2.2/src/zlib-ng/zutil.c +151 -0
- gencodegenes-1.2.2/src/zlib-ng/zutil.h +142 -0
- gencodegenes-1.2.2/src/zlib-ng/zutil_p.h +20 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/test_gencode.py +198 -12
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/test_sequence_methods.py +63 -4
- gencodegenes-1.2.2/tests/test_transcript.py +1139 -0
- gencodegenes-1.2.0/setup.py +0 -69
- gencodegenes-1.2.0/src/gencode.cpp +0 -313
- gencodegenes-1.2.0/src/gencodegenes/transcript.pyi +0 -137
- gencodegenes-1.2.0/src/gencodegenes.egg-info/SOURCES.txt +0 -59
- gencodegenes-1.2.0/src/gtf.cpp +0 -300
- gencodegenes-1.2.0/src/tx.cpp +0 -918
- gencodegenes-1.2.0/src/zlib/adler32.c +0 -186
- gencodegenes-1.2.0/src/zlib/compress.c +0 -86
- gencodegenes-1.2.0/src/zlib/crc32.c +0 -1125
- gencodegenes-1.2.0/src/zlib/deflate.c +0 -2217
- gencodegenes-1.2.0/src/zlib/deflate.h +0 -346
- gencodegenes-1.2.0/src/zlib/gzclose.c +0 -25
- gencodegenes-1.2.0/src/zlib/inffast.c +0 -323
- gencodegenes-1.2.0/src/zlib/inffast.h +0 -11
- gencodegenes-1.2.0/src/zlib/inffixed.h +0 -94
- gencodegenes-1.2.0/src/zlib/inflate.c +0 -1595
- gencodegenes-1.2.0/src/zlib/trees.c +0 -1181
- gencodegenes-1.2.0/src/zlib/trees.h +0 -128
- gencodegenes-1.2.0/src/zlib/zconf.h +0 -547
- gencodegenes-1.2.0/src/zlib/zutil.c +0 -327
- gencodegenes-1.2.0/src/zlib/zutil.h +0 -275
- gencodegenes-1.2.0/tests/test_transcript.py +0 -540
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/LICENSE.txt +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/setup.cfg +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/__init__.py +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes/py.typed +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/dependency_links.txt +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/requires.txt +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/src/gencodegenes.egg-info/top_level.txt +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/__init__.py +0 -0
- {gencodegenes-1.2.0 → gencodegenes-1.2.2}/tests/data/example.grch38.fa +0 -0
- {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
|
-
|
|
14
|
-
|
|
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.
|
|
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.
|
|
79
|
-
tx.
|
|
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.
|
|
64
|
-
tx.
|
|
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.
|
|
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
|
-
|