gencodegenes 1.1.7__tar.gz → 1.2.1__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.1.7 → gencodegenes-1.2.1}/MANIFEST.in +4 -4
- {gencodegenes-1.1.7/src/gencodegenes.egg-info → gencodegenes-1.2.1}/PKG-INFO +26 -16
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/README.md +23 -13
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/pyproject.toml +7 -4
- gencodegenes-1.2.1/setup.py +99 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencode.cpp +129 -79
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencode.h +4 -4
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/gencode.cpp +13620 -7632
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/gencode.pyi +13 -4
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/gencode.pyx +103 -51
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/transcript.cpp +9451 -4707
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/transcript.pxd +2 -2
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/transcript.pyx +16 -9
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/tx.cpp +125 -69
- {gencodegenes-1.1.7/src → gencodegenes-1.2.1/src/gencodegenes}/tx.h +6 -4
- {gencodegenes-1.1.7 → gencodegenes-1.2.1/src/gencodegenes.egg-info}/PKG-INFO +26 -16
- gencodegenes-1.2.1/src/gencodegenes.egg-info/SOURCES.txt +271 -0
- gencodegenes-1.2.1/src/gtf.cpp +395 -0
- gencodegenes-1.2.1/src/gtf.h +59 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/tx.cpp +125 -69
- {gencodegenes-1.1.7/src/gencodegenes → gencodegenes-1.2.1/src}/tx.h +6 -4
- gencodegenes-1.2.1/src/zlib-ng/.codecov.yaml +27 -0
- gencodegenes-1.2.1/src/zlib-ng/.gitattributes +9 -0
- gencodegenes-1.2.1/src/zlib-ng/.gitignore +111 -0
- gencodegenes-1.2.1/src/zlib-ng/.shellcheckrc +1 -0
- gencodegenes-1.2.1/src/zlib-ng/CMakeLists.txt +1675 -0
- gencodegenes-1.2.1/src/zlib-ng/FAQ.zlib +373 -0
- gencodegenes-1.2.1/src/zlib-ng/INDEX.md +36 -0
- gencodegenes-1.2.1/src/zlib-ng/LICENSE.md +19 -0
- gencodegenes-1.2.1/src/zlib-ng/Makefile.in +409 -0
- gencodegenes-1.2.1/src/zlib-ng/PORTING.md +111 -0
- gencodegenes-1.2.1/src/zlib-ng/README.md +236 -0
- gencodegenes-1.2.1/src/zlib-ng/adler32.c +69 -0
- gencodegenes-1.2.1/src/zlib-ng/adler32_p.h +70 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/.gitignore +2 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/Makefile.in +78 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/acle_intrins.h +85 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/adler32_neon.c +386 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/arm_features.c +115 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/arm_features.h +16 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/arm_functions.h +71 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/chunkset_neon.c +79 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/compare256_neon.c +60 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/crc32_armv8.c +86 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/neon_intrins.h +67 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/slide_hash_armv6.c +48 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/arm/slide_hash_neon.c +47 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/Makefile.in +82 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/adler32_c.c +54 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/adler32_fold_c.c +15 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/chunk_128bit_perm_idx_lut.h +26 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/chunk_256bit_perm_idx_lut.h +47 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/chunk_permute_table.h +53 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/chunkset_c.c +42 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/compare256_c.c +31 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/compare256_p.h +123 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/crc32_braid_c.c +222 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/crc32_chorba_c.c +1485 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/crc32_fold_c.c +31 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/generic_functions.h +72 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/generic/slide_hash_c.c +52 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/Makefile.in +99 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/adler32_lasx.c +127 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/adler32_lsx.c +156 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/chunkset_lasx.c +126 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/chunkset_lsx.c +72 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/compare256_lasx.c +63 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/compare256_lsx.c +99 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/crc32_la.c +86 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/lasxintrin_ext.h +90 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/loongarch_features.c +27 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/loongarch_features.h +19 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/loongarch_functions.h +95 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/lsxintrin_ext.h +33 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/slide_hash_lasx.c +41 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/loongarch/slide_hash_lsx.c +64 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/Makefile.in +93 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/adler32_power8.c +153 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/adler32_vmx.c +186 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/chunkset_power8.c +50 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/compare256_power9.c +66 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/crc32_constants.h +1123 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/crc32_power8.c +587 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/power_features.c +49 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/power_features.h +18 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/power_functions.h +64 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/power_intrins.h +34 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/slide_hash_power8.c +12 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/slide_hash_vmx.c +10 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/power/slide_ppc_tpl.h +32 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/Makefile.in +72 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/README.md +45 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/adler32_rvv.c +136 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/chunkset_rvv.c +122 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/compare256_rvv.c +49 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/crc32_zbc.c +100 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/riscv_features.c +46 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/riscv_features.h +19 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/riscv_functions.h +56 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/riscv/slide_hash_rvv.c +33 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/Makefile.in +48 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/README.md +265 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/crc32-vx.c +222 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_common.h +119 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_deflate.c +384 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_deflate.h +58 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_detail.h +275 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_inflate.c +191 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/dfltcc_inflate.h +67 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/s390_features.c +14 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/s390_features.h +14 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/s390_functions.h +27 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner +62 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner-rebuild.sh +49 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.Dockerfile +46 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/self-hosted-builder/actions-runner.service +18 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/s390/self-hosted-builder/entrypoint +30 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/Makefile.in +169 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_avx2.c +180 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_avx2_p.h +32 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_avx512.c +108 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_avx512_p.h +57 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_avx512_vnni.c +210 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_sse42.c +120 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_ssse3.c +156 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/adler32_ssse3_p.h +29 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chorba_sse2.c +876 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chorba_sse41.c +336 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chunkset_avx2.c +130 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chunkset_avx512.c +189 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chunkset_sse2.c +49 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/chunkset_ssse3.c +70 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/compare256_avx2.c +64 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/compare256_avx512.c +97 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/compare256_sse2.c +97 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h +419 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/crc32_fold_vpclmulqdq_tpl.h +107 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/crc32_pclmulqdq.c +30 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h +414 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/crc32_vpclmulqdq.c +17 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/slide_hash_avx2.c +40 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/slide_hash_sse2.c +63 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/x86_features.c +127 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/x86_features.h +30 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/x86_functions.h +207 -0
- gencodegenes-1.2.1/src/zlib-ng/arch/x86/x86_intrins.h +122 -0
- gencodegenes-1.2.1/src/zlib-ng/arch_functions.h +31 -0
- gencodegenes-1.2.1/src/zlib-ng/chunkset_tpl.h +283 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-arch.c +115 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-arch.cmake +103 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-coverage.cmake +46 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-install-dirs.cmake +43 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-intrinsics.cmake +732 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/detect-sanitizer.cmake +157 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/fallback-macros.cmake +19 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-aarch64.cmake +24 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-arm.cmake +29 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-armhf.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-llvm-mingw-aarch64.cmake +41 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-llvm-mingw-armv7.cmake +41 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-llvm-mingw-i686.cmake +41 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-llvm-mingw-x86_64.cmake +41 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-loongarch64-gcc-14.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-mingw-i686.cmake +35 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-mingw-x86_64.cmake +34 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-mips.cmake +29 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-mips64.cmake +29 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64-clang.cmake +16 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64-power9.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64le-clang.cmake +16 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64le-power9.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-powerpc64le.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-riscv-clang.cmake +16 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-riscv.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-s390x.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cmake/toolchain-sparc64.cmake +25 -0
- gencodegenes-1.2.1/src/zlib-ng/compare256_rle.h +133 -0
- gencodegenes-1.2.1/src/zlib-ng/compress.c +98 -0
- gencodegenes-1.2.1/src/zlib-ng/configure +2617 -0
- gencodegenes-1.2.1/src/zlib-ng/cpu_features.c +25 -0
- gencodegenes-1.2.1/src/zlib-ng/cpu_features.h +47 -0
- gencodegenes-1.2.1/src/zlib-ng/crc32.c +42 -0
- gencodegenes-1.2.1/src/zlib-ng/crc32.h +27 -0
- gencodegenes-1.2.1/src/zlib-ng/crc32_braid_comb.c +56 -0
- gencodegenes-1.2.1/src/zlib-ng/crc32_braid_comb_p.h +42 -0
- gencodegenes-1.2.1/src/zlib-ng/crc32_braid_p.h +40 -0
- gencodegenes-1.1.7/src/zlib/crc32.h → gencodegenes-1.2.1/src/zlib-ng/crc32_braid_tbl.h +70 -84
- gencodegenes-1.2.1/src/zlib-ng/deflate.c +1416 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate.h +494 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_fast.c +104 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_huff.c +45 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_medium.c +293 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_p.h +198 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_quick.c +130 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_rle.c +84 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_slow.c +144 -0
- gencodegenes-1.2.1/src/zlib-ng/deflate_stored.c +186 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/algorithm.txt +209 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/crc-doc.1.0.pdf +0 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/crc-pclmulqdq.pdf +0 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/rfc1950.txt +619 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/rfc1951.txt +955 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/rfc1952.txt +675 -0
- gencodegenes-1.2.1/src/zlib-ng/doc/txtvsbin.txt +107 -0
- gencodegenes-1.2.1/src/zlib-ng/fallback_builtins.h +47 -0
- gencodegenes-1.2.1/src/zlib-ng/functable.c +464 -0
- gencodegenes-1.2.1/src/zlib-ng/functable.h +54 -0
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/gzguts.h +45 -113
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/gzlib.c +171 -219
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/gzread.c +142 -186
- gencodegenes-1.2.1/src/zlib-ng/gzread_mangle.h.in +7 -0
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/gzwrite.c +98 -266
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/infback.c +149 -271
- gencodegenes-1.2.1/src/zlib-ng/inffast_tpl.h +332 -0
- gencodegenes-1.2.1/src/zlib-ng/inffixed_tbl.h +94 -0
- gencodegenes-1.2.1/src/zlib-ng/inflate.c +1461 -0
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/inflate.h +72 -27
- gencodegenes-1.2.1/src/zlib-ng/inflate_p.h +215 -0
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/inftrees.c +39 -48
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/inftrees.h +17 -13
- gencodegenes-1.2.1/src/zlib-ng/insert_string.c +21 -0
- gencodegenes-1.2.1/src/zlib-ng/insert_string_roll.c +24 -0
- gencodegenes-1.2.1/src/zlib-ng/insert_string_tpl.h +111 -0
- gencodegenes-1.2.1/src/zlib-ng/match_tpl.h +252 -0
- gencodegenes-1.2.1/src/zlib-ng/tools/config.sub +17 -0
- gencodegenes-1.2.1/src/zlib-ng/tools/makecrct.c +242 -0
- gencodegenes-1.2.1/src/zlib-ng/tools/makefixed.c +89 -0
- gencodegenes-1.2.1/src/zlib-ng/tools/maketrees.c +148 -0
- gencodegenes-1.2.1/src/zlib-ng/trees.c +818 -0
- gencodegenes-1.2.1/src/zlib-ng/trees.h +40 -0
- gencodegenes-1.2.1/src/zlib-ng/trees_emit.h +231 -0
- gencodegenes-1.2.1/src/zlib-ng/trees_tbl.h +132 -0
- {gencodegenes-1.1.7/src/zlib → gencodegenes-1.2.1/src/zlib-ng}/uncompr.c +21 -34
- gencodegenes-1.2.1/src/zlib-ng/win32/zlib-ng.def.in +60 -0
- gencodegenes-1.2.1/src/zlib-ng/win32/zlib-ng1.rc +36 -0
- gencodegenes-1.2.1/src/zlib-ng/win32/zlib.def.in +64 -0
- gencodegenes-1.2.1/src/zlib-ng/win32/zlib1.rc +36 -0
- gencodegenes-1.2.1/src/zlib-ng/win32/zlibcompat.def.in +97 -0
- gencodegenes-1.2.1/src/zlib-ng/zbuild.h +364 -0
- gencodegenes-1.2.1/src/zlib-ng/zconf-ng.h.in +176 -0
- gencodegenes-1.2.1/src/zlib-ng/zconf.h.in +206 -0
- gencodegenes-1.2.1/src/zlib-ng/zendian.h +60 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib-config.cmake.in +12 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib-ng-config.cmake.in +10 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib-ng.h.in +1871 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib-ng.map.in +110 -0
- gencodegenes-1.1.7/src/zlib/zlib.h → gencodegenes-1.2.1/src/zlib-ng/zlib.h.in +263 -339
- gencodegenes-1.2.1/src/zlib-ng/zlib.map.in +98 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib.pc.cmakein +15 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib.pc.in +15 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib_name_mangling-ng.h.in +178 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib_name_mangling.h.empty +8 -0
- gencodegenes-1.2.1/src/zlib-ng/zlib_name_mangling.h.in +170 -0
- gencodegenes-1.2.1/src/zlib-ng/zmemory.h +99 -0
- gencodegenes-1.2.1/src/zlib-ng/zutil.c +151 -0
- gencodegenes-1.2.1/src/zlib-ng/zutil.h +142 -0
- gencodegenes-1.2.1/src/zlib-ng/zutil_p.h +20 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/test_gencode.py +399 -1
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/test_sequence_methods.py +38 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/test_transcript.py +89 -0
- gencodegenes-1.1.7/setup.py +0 -117
- gencodegenes-1.1.7/src/gencodegenes.egg-info/SOURCES.txt +0 -61
- gencodegenes-1.1.7/src/gtf.cpp +0 -252
- gencodegenes-1.1.7/src/gtf.h +0 -46
- gencodegenes-1.1.7/src/gzstream/gzstream.C +0 -165
- gencodegenes-1.1.7/src/gzstream/gzstream.h +0 -121
- gencodegenes-1.1.7/src/zlib/adler32.c +0 -186
- gencodegenes-1.1.7/src/zlib/compress.c +0 -86
- gencodegenes-1.1.7/src/zlib/crc32.c +0 -1125
- gencodegenes-1.1.7/src/zlib/deflate.c +0 -2217
- gencodegenes-1.1.7/src/zlib/deflate.h +0 -346
- gencodegenes-1.1.7/src/zlib/gzclose.c +0 -25
- gencodegenes-1.1.7/src/zlib/inffast.c +0 -323
- gencodegenes-1.1.7/src/zlib/inffast.h +0 -11
- gencodegenes-1.1.7/src/zlib/inffixed.h +0 -94
- gencodegenes-1.1.7/src/zlib/inflate.c +0 -1595
- gencodegenes-1.1.7/src/zlib/trees.c +0 -1181
- gencodegenes-1.1.7/src/zlib/trees.h +0 -128
- gencodegenes-1.1.7/src/zlib/zconf.h +0 -547
- gencodegenes-1.1.7/src/zlib/zutil.c +0 -327
- gencodegenes-1.1.7/src/zlib/zutil.h +0 -275
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/LICENSE.txt +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/setup.cfg +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/__init__.py +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/py.typed +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes/transcript.pyi +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes.egg-info/dependency_links.txt +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes.egg-info/requires.txt +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/src/gencodegenes.egg-info/top_level.txt +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/__init__.py +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/data/example.grch38.fa +0 -0
- {gencodegenes-1.1.7 → gencodegenes-1.2.1}/tests/data/example.grch38.gtf +0 -0
|
@@ -9,11 +9,11 @@ include src/gencodegenes/*.pyi
|
|
|
9
9
|
include src/gencodegenes/py.typed
|
|
10
10
|
include src/*.h
|
|
11
11
|
include src/*.cpp
|
|
12
|
-
include src/gzstream/gzstream.C
|
|
13
|
-
include src/gzstream/gzstream.h
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
graft src/zlib-ng
|
|
14
|
+
prune src/zlib-ng/test
|
|
15
|
+
prune src/zlib-ng/.github
|
|
16
|
+
exclude src/zlib-ng/.git
|
|
17
17
|
|
|
18
18
|
# gencodegenes tests
|
|
19
19
|
include tests/*.py
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gencodegenes
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Package to load genes from GENCODE GTF files
|
|
5
5
|
Author-email: Jeremy McRae <jeremy.mcrae@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
6
7
|
Project-URL: homepage, https://github.com/jeremymcrae/gencodegenes
|
|
7
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
8
8
|
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE.txt
|
|
13
13
|
Requires-Dist: pyfaidx>=0.5.8
|
|
@@ -16,7 +16,7 @@ Dynamic: license-file
|
|
|
16
16
|
|
|
17
17
|
### GENCODEGenes
|
|
18
18
|
|
|
19
|
-
This package loads genes from GENCODE GTF
|
|
19
|
+
This package loads genes from GENCODE GTF files, groups transcripts by gene,
|
|
20
20
|
and provides methods for transcripts, so you can find exon coordinates, CDS
|
|
21
21
|
distances and sequences.
|
|
22
22
|
|
|
@@ -31,22 +31,30 @@ pip install gencodegenes
|
|
|
31
31
|
from gencodegenes import Gencode
|
|
32
32
|
|
|
33
33
|
gencode = Gencode(GTF_PATH)
|
|
34
|
-
# full function arguments are Gencode(
|
|
35
|
-
# -
|
|
34
|
+
# full function arguments are Gencode(gencode, fasta=None, coding_only=True)
|
|
35
|
+
# - gencode: path to GTF file (plain or gzipped)
|
|
36
|
+
# - fasta: pass in path to fasta file to get gene transcripts with sequence
|
|
36
37
|
# - coding_only: pass in False to include all transcripts, not just protein coding
|
|
37
38
|
|
|
39
|
+
# use as a context manager to close the fasta when done
|
|
40
|
+
with Gencode(GTF_PATH, fasta=FASTA_PATH) as gencode:
|
|
41
|
+
...
|
|
42
|
+
|
|
38
43
|
# get gene by HGNC symbol
|
|
39
44
|
gene = gencode['OR5A1']
|
|
40
45
|
transcripts = gene.transcripts
|
|
41
|
-
canonical = gene.canonical # picks
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
# picks the longest cDNA
|
|
46
|
+
canonical = gene.canonical # picks the transcript tagged Ensembl_canonical (the
|
|
47
|
+
# MANE Select transcript in human, where one exists), if
|
|
48
|
+
# none tagged, picks from those tagged appris_principal,
|
|
49
|
+
# if none tagged, picks from all transcripts. Within
|
|
50
|
+
# these, picks the longest CDS, or the longest cDNA if
|
|
51
|
+
# none are protein coding
|
|
46
52
|
gene.start, gene.end, gene.chrom, gene.strand, gene.symbol # other attributes available
|
|
53
|
+
gene.alternate_ids # gene_id and hgnc_id from the GTF
|
|
47
54
|
|
|
48
55
|
|
|
49
|
-
# find gene nearest a genomic position, or overlapping a genomic region
|
|
56
|
+
# find gene nearest a genomic position, or overlapping a genomic region.
|
|
57
|
+
# Chromosomes match with or without the 'chr' prefix
|
|
50
58
|
gencode.nearest('chr1', 1000000)
|
|
51
59
|
gencode.in_region('chr1', 1000000, 2000000)
|
|
52
60
|
|
|
@@ -58,14 +66,15 @@ tx.get_coding_distance(pos) # get distance in CDS to CDS start
|
|
|
58
66
|
tx.get_closest_exon(pos) # find exon closest to position
|
|
59
67
|
tx.get_position_on_chrom(cds_pos) # convert CDS pos to genomic pos
|
|
60
68
|
tx.get_codon_info(pos) # get info about codon for a site
|
|
61
|
-
tx.
|
|
62
|
-
tx.translate(seq) # translate DNA to AA
|
|
69
|
+
tx.get_codon_number_for_cds_position(cds_pos) # convert CDS pos to codon number
|
|
70
|
+
tx.translate(seq) # translate DNA to AA
|
|
71
|
+
tx.consequence(pos, ref, alt) # get variant consequence (if opened with fasta)
|
|
63
72
|
|
|
64
73
|
# the transcript also has associated data fields
|
|
65
74
|
tx.name # transcript ID
|
|
66
75
|
tx.chrom # transcript chromosome
|
|
67
|
-
tx.start # transcript start (
|
|
68
|
-
tx.end # transcript end
|
|
76
|
+
tx.start # transcript start (lowest position on chromosome)
|
|
77
|
+
tx.end # transcript end (highest position on chromosome)
|
|
69
78
|
tx.cds_start # CDS start position
|
|
70
79
|
tx.cds_end # CDS end position
|
|
71
80
|
tx.type # transcript type e.g. protein_coding
|
|
@@ -73,5 +82,6 @@ tx.strand # strand (+ or -)
|
|
|
73
82
|
tx.exons # list of exon coordinates
|
|
74
83
|
tx.cds # list of CDS coordinates
|
|
75
84
|
tx.cds_sequence # get cDNA sequence (if Gencode was opened with fasta)
|
|
85
|
+
tx.attributes # dict-like view of the GTF attributes e.g. tx.attributes['gene_id']
|
|
76
86
|
|
|
77
87
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
### GENCODEGenes
|
|
3
3
|
|
|
4
|
-
This package loads genes from GENCODE GTF
|
|
4
|
+
This package loads genes from GENCODE GTF files, groups transcripts by gene,
|
|
5
5
|
and provides methods for transcripts, so you can find exon coordinates, CDS
|
|
6
6
|
distances and sequences.
|
|
7
7
|
|
|
@@ -16,22 +16,30 @@ pip install gencodegenes
|
|
|
16
16
|
from gencodegenes import Gencode
|
|
17
17
|
|
|
18
18
|
gencode = Gencode(GTF_PATH)
|
|
19
|
-
# full function arguments are Gencode(
|
|
20
|
-
# -
|
|
19
|
+
# full function arguments are Gencode(gencode, fasta=None, coding_only=True)
|
|
20
|
+
# - gencode: path to GTF file (plain or gzipped)
|
|
21
|
+
# - fasta: pass in path to fasta file to get gene transcripts with sequence
|
|
21
22
|
# - coding_only: pass in False to include all transcripts, not just protein coding
|
|
22
23
|
|
|
24
|
+
# use as a context manager to close the fasta when done
|
|
25
|
+
with Gencode(GTF_PATH, fasta=FASTA_PATH) as gencode:
|
|
26
|
+
...
|
|
27
|
+
|
|
23
28
|
# get gene by HGNC symbol
|
|
24
29
|
gene = gencode['OR5A1']
|
|
25
30
|
transcripts = gene.transcripts
|
|
26
|
-
canonical = gene.canonical # picks
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
# picks the longest cDNA
|
|
31
|
+
canonical = gene.canonical # picks the transcript tagged Ensembl_canonical (the
|
|
32
|
+
# MANE Select transcript in human, where one exists), if
|
|
33
|
+
# none tagged, picks from those tagged appris_principal,
|
|
34
|
+
# if none tagged, picks from all transcripts. Within
|
|
35
|
+
# these, picks the longest CDS, or the longest cDNA if
|
|
36
|
+
# none are protein coding
|
|
31
37
|
gene.start, gene.end, gene.chrom, gene.strand, gene.symbol # other attributes available
|
|
38
|
+
gene.alternate_ids # gene_id and hgnc_id from the GTF
|
|
32
39
|
|
|
33
40
|
|
|
34
|
-
# find gene nearest a genomic position, or overlapping a genomic region
|
|
41
|
+
# find gene nearest a genomic position, or overlapping a genomic region.
|
|
42
|
+
# Chromosomes match with or without the 'chr' prefix
|
|
35
43
|
gencode.nearest('chr1', 1000000)
|
|
36
44
|
gencode.in_region('chr1', 1000000, 2000000)
|
|
37
45
|
|
|
@@ -43,14 +51,15 @@ tx.get_coding_distance(pos) # get distance in CDS to CDS start
|
|
|
43
51
|
tx.get_closest_exon(pos) # find exon closest to position
|
|
44
52
|
tx.get_position_on_chrom(cds_pos) # convert CDS pos to genomic pos
|
|
45
53
|
tx.get_codon_info(pos) # get info about codon for a site
|
|
46
|
-
tx.
|
|
47
|
-
tx.translate(seq) # translate DNA to AA
|
|
54
|
+
tx.get_codon_number_for_cds_position(cds_pos) # convert CDS pos to codon number
|
|
55
|
+
tx.translate(seq) # translate DNA to AA
|
|
56
|
+
tx.consequence(pos, ref, alt) # get variant consequence (if opened with fasta)
|
|
48
57
|
|
|
49
58
|
# the transcript also has associated data fields
|
|
50
59
|
tx.name # transcript ID
|
|
51
60
|
tx.chrom # transcript chromosome
|
|
52
|
-
tx.start # transcript start (
|
|
53
|
-
tx.end # transcript end
|
|
61
|
+
tx.start # transcript start (lowest position on chromosome)
|
|
62
|
+
tx.end # transcript end (highest position on chromosome)
|
|
54
63
|
tx.cds_start # CDS start position
|
|
55
64
|
tx.cds_end # CDS end position
|
|
56
65
|
tx.type # transcript type e.g. protein_coding
|
|
@@ -58,5 +67,6 @@ tx.strand # strand (+ or -)
|
|
|
58
67
|
tx.exons # list of exon coordinates
|
|
59
68
|
tx.cds # list of CDS coordinates
|
|
60
69
|
tx.cds_sequence # get cDNA sequence (if Gencode was opened with fasta)
|
|
70
|
+
tx.attributes # dict-like view of the GTF attributes e.g. tx.attributes['gene_id']
|
|
61
71
|
|
|
62
72
|
```
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["cython", "setuptools >=
|
|
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.1
|
|
7
|
+
version = '1.2.1'
|
|
8
8
|
description = 'Package to load genes from GENCODE GTF files'
|
|
9
9
|
readme = 'README.md'
|
|
10
|
-
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
11
12
|
authors = [
|
|
12
13
|
{name = 'Jeremy McRae', email = 'jeremy.mcrae@gmail.com'}
|
|
13
14
|
]
|
|
@@ -17,7 +18,6 @@ dependencies = [
|
|
|
17
18
|
]
|
|
18
19
|
|
|
19
20
|
classifiers = [
|
|
20
|
-
"License :: OSI Approved :: MIT License",
|
|
21
21
|
"Development Status :: 4 - Beta",
|
|
22
22
|
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
23
23
|
]
|
|
@@ -27,5 +27,8 @@ packages = [
|
|
|
27
27
|
"gencodegenes"
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
gencodegenes = ['transcript.pxd', 'tx.h', 'tx.cpp', 'py.typed', '*.pyi']
|
|
32
|
+
|
|
30
33
|
[project.urls]
|
|
31
34
|
homepage = 'https://github.com/jeremymcrae/gencodegenes'
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
sdk_base = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
|
21
|
+
if os.path.exists(sdk_base):
|
|
22
|
+
EXTRA_COMPILE_ARGS += [
|
|
23
|
+
f"-I{sdk_base}/usr/include/c++/v1",
|
|
24
|
+
f"-I{sdk_base}/usr/include",
|
|
25
|
+
]
|
|
26
|
+
EXTRA_LINK_ARGS += [
|
|
27
|
+
f"-L{sdk_base}/usr/lib",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
ZLIB_NG_DIR = os.path.abspath('src/zlib-ng')
|
|
31
|
+
|
|
32
|
+
class build_ext_zlib_ng(build_ext):
|
|
33
|
+
''' build zlib-ng as a static library (via cmake), before building extensions
|
|
34
|
+
|
|
35
|
+
zlib-ng is built with its native API (zng_ prefixed functions), so it can't
|
|
36
|
+
clash with any system zlib loaded into the python process.
|
|
37
|
+
'''
|
|
38
|
+
def run(self):
|
|
39
|
+
build_dir = os.path.abspath(os.path.join(self.build_temp, 'zlib-ng'))
|
|
40
|
+
config = [
|
|
41
|
+
'-DCMAKE_BUILD_TYPE=Release',
|
|
42
|
+
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
|
|
43
|
+
'-DBUILD_SHARED_LIBS=OFF',
|
|
44
|
+
'-DZLIB_COMPAT=OFF',
|
|
45
|
+
'-DWITH_GZFILEOP=ON',
|
|
46
|
+
'-DBUILD_TESTING=OFF',
|
|
47
|
+
]
|
|
48
|
+
archflags = os.environ.get('ARCHFLAGS', '')
|
|
49
|
+
if sys.platform == 'darwin' and archflags:
|
|
50
|
+
# match the architectures requested for the extension (e.g. by cibuildwheel)
|
|
51
|
+
archs = ';'.join(archflags.split()[1::2])
|
|
52
|
+
config.append(f'-DCMAKE_OSX_ARCHITECTURES={archs}')
|
|
53
|
+
subprocess.check_call(['cmake', '-S', ZLIB_NG_DIR, '-B', build_dir] + config)
|
|
54
|
+
subprocess.check_call(['cmake', '--build', build_dir, '--config', 'Release',
|
|
55
|
+
'--parallel'])
|
|
56
|
+
|
|
57
|
+
lib_dir = build_dir
|
|
58
|
+
lib = 'z-ng'
|
|
59
|
+
if sys.platform == 'win32':
|
|
60
|
+
lib_dir = os.path.join(build_dir, 'Release')
|
|
61
|
+
lib = 'zlibstatic-ng'
|
|
62
|
+
for ext in self.extensions:
|
|
63
|
+
if ext.name == 'gencodegenes.gencode':
|
|
64
|
+
ext.include_dirs.append(build_dir)
|
|
65
|
+
ext.library_dirs.append(lib_dir)
|
|
66
|
+
ext.libraries.append(lib)
|
|
67
|
+
super().run()
|
|
68
|
+
|
|
69
|
+
extensions = [
|
|
70
|
+
Extension("gencodegenes.transcript",
|
|
71
|
+
extra_compile_args=EXTRA_COMPILE_ARGS,
|
|
72
|
+
extra_link_args=EXTRA_LINK_ARGS,
|
|
73
|
+
sources=[
|
|
74
|
+
"src/gencodegenes/transcript.pyx",
|
|
75
|
+
"src/tx.cpp"],
|
|
76
|
+
include_dirs=["src/"],
|
|
77
|
+
language="c++"),
|
|
78
|
+
Extension("gencodegenes.gencode",
|
|
79
|
+
extra_compile_args=EXTRA_COMPILE_ARGS,
|
|
80
|
+
extra_link_args=EXTRA_LINK_ARGS,
|
|
81
|
+
sources=[
|
|
82
|
+
"src/gencodegenes/gencode.pyx",
|
|
83
|
+
"src/gencode.cpp",
|
|
84
|
+
"src/gtf.cpp",
|
|
85
|
+
"src/tx.cpp"],
|
|
86
|
+
include_dirs=["src/"],
|
|
87
|
+
define_macros=[('WITH_GZFILEOP', None)],
|
|
88
|
+
language="c++"),
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
# include tx.h in the package, for downstream usage
|
|
92
|
+
shutil.copy("src/tx.h", "src/gencodegenes/tx.h")
|
|
93
|
+
shutil.copy("src/tx.cpp", "src/gencodegenes/tx.cpp")
|
|
94
|
+
|
|
95
|
+
setup(
|
|
96
|
+
package_dir={'': 'src'},
|
|
97
|
+
ext_modules=cythonize(extensions),
|
|
98
|
+
cmdclass={'build_ext': build_ext_zlib_ng},
|
|
99
|
+
)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
#include <algorithm>
|
|
3
3
|
#include <cstdint>
|
|
4
|
+
#include <deque>
|
|
4
5
|
#include <string>
|
|
5
6
|
#include <map>
|
|
6
7
|
#include <set>
|
|
7
8
|
#include <stdexcept>
|
|
9
|
+
#include <unordered_map>
|
|
10
|
+
#include <utility>
|
|
8
11
|
#include <vector>
|
|
9
12
|
|
|
10
13
|
#include <iostream>
|
|
@@ -16,18 +19,18 @@
|
|
|
16
19
|
namespace gencode {
|
|
17
20
|
|
|
18
21
|
// check which exon is first, by start position
|
|
19
|
-
static bool compareExons(
|
|
20
|
-
return (e1
|
|
22
|
+
static bool compareExons(const Region & e1, const Region & e2) {
|
|
23
|
+
return (e1.start < e2.start);
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
static void sort_exons(std::vector<
|
|
26
|
+
static void sort_exons(std::vector<Region> & exons) {
|
|
24
27
|
std::sort(exons.begin(), exons.end(), compareExons);
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
// find the index of the exon containing a given chromosome position
|
|
28
|
-
static std::uint32_t get_exon_num(std::vector<
|
|
31
|
+
static std::uint32_t get_exon_num(const std::vector<Region> & exons, int pos) {
|
|
29
32
|
for (std::uint32_t i=0; i<exons.size(); i++) {
|
|
30
|
-
if ((pos >= exons[i]
|
|
33
|
+
if ((pos >= exons[i].start) && (pos <= exons[i].end)) {
|
|
31
34
|
return i;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -41,123 +44,174 @@ static std::uint32_t get_exon_num(std::vector<std::vector<int> > exons, int pos)
|
|
|
41
44
|
// just set the first CDS coord and last CDS coord to their values though,
|
|
42
45
|
// as at least one stop codon spans an intron boundary, which messes up the
|
|
43
46
|
// CDS if included as is.
|
|
44
|
-
static void include_end_codons(std::map<std::string, int> cds_range, TxInfo & info) {
|
|
47
|
+
static void include_end_codons(const std::map<std::string, int> & cds_range, TxInfo & info) {
|
|
45
48
|
if (info.cds.size() == 0) {
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
51
|
sort_exons(info.cds);
|
|
49
52
|
sort_exons(info.exons);
|
|
53
|
+
int cds_min = cds_range.at("min");
|
|
54
|
+
int cds_max = cds_range.at("max");
|
|
50
55
|
|
|
51
56
|
// handle left (5') boundary
|
|
52
|
-
std::uint32_t first_idx = get_exon_num(info.exons, info.cds[0]
|
|
53
|
-
std::uint32_t min_idx = get_exon_num(info.exons,
|
|
57
|
+
std::uint32_t first_idx = get_exon_num(info.exons, info.cds[0].start);
|
|
58
|
+
std::uint32_t min_idx = get_exon_num(info.exons, cds_min);
|
|
54
59
|
if (min_idx == first_idx) {
|
|
55
|
-
info.cds[0]
|
|
60
|
+
info.cds[0].start = cds_min;
|
|
56
61
|
} else {
|
|
57
|
-
info.cds[0]
|
|
58
|
-
|
|
59
|
-
auto it = info.cds.begin();
|
|
60
|
-
info.cds.insert(it, extra_cds);
|
|
62
|
+
info.cds[0].start = info.exons[first_idx].start; // extend existing CDS
|
|
63
|
+
info.cds.insert(info.cds.begin(), Region {cds_min, info.exons[min_idx].end});
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
// handle right (3') boundary
|
|
64
|
-
std::uint32_t last_idx = get_exon_num(info.exons, info.cds.back()
|
|
65
|
-
std::uint32_t max_idx = get_exon_num(info.exons,
|
|
67
|
+
std::uint32_t last_idx = get_exon_num(info.exons, info.cds.back().end);
|
|
68
|
+
std::uint32_t max_idx = get_exon_num(info.exons, cds_max);
|
|
66
69
|
if (max_idx == last_idx) {
|
|
67
|
-
info.cds.back()
|
|
70
|
+
info.cds.back().end = cds_max;
|
|
68
71
|
} else {
|
|
69
|
-
info.cds.back()
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
info.cds.back().end = info.exons[last_idx].end; // extend existing CDS
|
|
73
|
+
info.cds.push_back(Region {info.exons[max_idx].start, cds_max});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// set the transcript span from its exons and CDS, for GTFs without transcript lines
|
|
78
|
+
static void set_span(TxInfo & info) {
|
|
79
|
+
if (info.start != 0 || info.end != 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
bool first = true;
|
|
83
|
+
for (auto regions : {&info.exons, &info.cds}) {
|
|
84
|
+
for (auto & x : *regions) {
|
|
85
|
+
info.start = first ? x.start : std::min(info.start, x.start);
|
|
86
|
+
info.end = first ? x.end : std::max(info.end, x.end);
|
|
87
|
+
first = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// construct a Tx from the features collected for a transcript
|
|
93
|
+
//
|
|
94
|
+
// Transcripts with inconsistent coordinates (e.g. a stop codon outside the
|
|
95
|
+
// exons) are skipped with a warning, so one malformed transcript doesn't stop
|
|
96
|
+
// the rest of the GTF from loading.
|
|
97
|
+
static void add_transcript(std::vector<NamedTx> & transcripts, TxInfo & info,
|
|
98
|
+
std::map<std::string, int> & cds_range, std::string & symbol,
|
|
99
|
+
std::vector<std::string> & alt_ids) {
|
|
100
|
+
try {
|
|
101
|
+
// adjust CDS for start and stop codon coords
|
|
102
|
+
include_end_codons(cds_range, info);
|
|
103
|
+
set_span(info);
|
|
104
|
+
Tx tx = Tx(info.name, info.chrom, info.start, info.end, info.strand[0],
|
|
105
|
+
info.transcript_type, info.attributes);
|
|
106
|
+
tx.set_exons(std::move(info.exons));
|
|
107
|
+
tx.set_cds(std::move(info.cds));
|
|
108
|
+
transcripts.push_back({std::move(symbol), std::move(alt_ids), std::move(tx), info.is_canonical});
|
|
109
|
+
} catch (const std::invalid_argument & e) {
|
|
110
|
+
std::cerr << "skipping transcript " << info.name << ": " << e.what() << std::endl;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// features collected for a transcript, while loading the GTF
|
|
115
|
+
struct TxEntry {
|
|
116
|
+
TxInfo info;
|
|
117
|
+
std::map<std::string, int> cds_range = {{"max", 0}, {"min", 999999999}};
|
|
118
|
+
std::string symbol;
|
|
119
|
+
std::vector<std::string> alt_ids;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// build transcripts in the order they first appeared, freeing each entry once
|
|
123
|
+
// its transcript is built
|
|
124
|
+
//
|
|
125
|
+
// @param pos start of the current GTF line. Transcripts are only built once this
|
|
126
|
+
// passes their end, as no further lines for them can follow in a
|
|
127
|
+
// position-sorted GTF. Use -1 to build all transcripts.
|
|
128
|
+
static void build_transcripts(std::vector<NamedTx> & transcripts,
|
|
129
|
+
std::deque<TxEntry> & entries, std::unordered_map<std::string, TxEntry *> & index,
|
|
130
|
+
int pos=-1) {
|
|
131
|
+
while (!entries.empty()) {
|
|
132
|
+
TxEntry & x = entries.front();
|
|
133
|
+
if (pos != -1 && (x.info.end == 0 || pos <= x.info.end)) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
index.erase(x.info.name);
|
|
137
|
+
add_transcript(transcripts, x.info, x.cds_range, x.symbol, x.alt_ids);
|
|
138
|
+
entries.pop_front();
|
|
72
139
|
}
|
|
73
140
|
}
|
|
74
141
|
|
|
75
142
|
// collect all features for a transcript into a single object
|
|
76
143
|
//
|
|
77
144
|
// When we load lines from gencode GTF files, each line represents a single exon
|
|
78
|
-
// or CDS, and we need to combine these based on transcript ID
|
|
145
|
+
// or CDS, and we need to combine these based on transcript ID. Lines for a
|
|
146
|
+
// transcript are usually contiguous, but position-sorted GTFs interleave
|
|
147
|
+
// transcripts, so features are collected by transcript ID until the chromosome
|
|
148
|
+
// changes (GTFs are grouped by chromosome), or the GTF moves past the transcript.
|
|
79
149
|
static void load_transcripts(std::vector<NamedTx> & transcripts, GTF >f_file, bool coding=true) {
|
|
80
150
|
std::set<std::string> permit = {"exon", "CDS", "UTR", "transcript",
|
|
81
151
|
"stop_codon", "start_codon"};
|
|
82
|
-
std::
|
|
83
|
-
std::string
|
|
84
|
-
|
|
85
|
-
std::vector<std::string> alt_ids;
|
|
86
|
-
std::string current;
|
|
87
|
-
TxInfo info;
|
|
152
|
+
std::deque<TxEntry> entries;
|
|
153
|
+
std::unordered_map<std::string, TxEntry *> index;
|
|
154
|
+
TxEntry * entry = nullptr;
|
|
88
155
|
|
|
89
156
|
GTFLine gtf;
|
|
90
157
|
|
|
91
|
-
while (
|
|
92
|
-
try {
|
|
93
|
-
gtf = gtf_file.next();
|
|
94
|
-
} catch (const std::out_of_range& e) {
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
158
|
+
while (gtf_file.next(gtf)) {
|
|
99
159
|
if (permit.count(gtf.feature) == 0) {
|
|
100
160
|
continue;
|
|
101
161
|
} else if (coding && (gtf.transcript_type != "protein_coding")) {
|
|
102
162
|
continue;
|
|
103
163
|
}
|
|
104
164
|
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
info.transcript_type = gtf.transcript_type;
|
|
165
|
+
// only look up the transcript when it differs from the previous line's
|
|
166
|
+
if (entry == nullptr || gtf.tx_id != entry->info.name || gtf.chrom != entry->info.chrom) {
|
|
167
|
+
int pos = (entry != nullptr && gtf.chrom != entry->info.chrom) ? -1 : gtf.start;
|
|
168
|
+
build_transcripts(transcripts, entries, index, pos);
|
|
169
|
+
auto it = index.find(gtf.tx_id);
|
|
170
|
+
if (it != index.end()) {
|
|
171
|
+
entry = it->second;
|
|
172
|
+
} else {
|
|
173
|
+
entries.emplace_back();
|
|
174
|
+
entry = &entries.back();
|
|
175
|
+
index[gtf.tx_id] = entry;
|
|
176
|
+
|
|
177
|
+
TxInfo & info = entry->info;
|
|
178
|
+
info.name = gtf.tx_id;
|
|
179
|
+
info.chrom = gtf.chrom;
|
|
180
|
+
info.strand = gtf.strand;
|
|
181
|
+
info.is_canonical = gtf.is_canonical;
|
|
182
|
+
info.transcript_type = gtf.transcript_type;
|
|
183
|
+
entry->symbol = gtf.symbol;
|
|
184
|
+
entry->alt_ids = gtf.alternate_ids;
|
|
185
|
+
if (gtf.feature != "transcript") {
|
|
186
|
+
// without a transcript line, use the first line's attributes,
|
|
187
|
+
// minus the fields specific to that feature
|
|
188
|
+
info.attributes = gtf.attributes;
|
|
189
|
+
for (auto field : {"exon_number", "exon_id", "exon_version"}) {
|
|
190
|
+
info.attributes.erase(field);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
135
194
|
}
|
|
136
195
|
|
|
196
|
+
TxInfo & info = entry->info;
|
|
197
|
+
std::map<std::string, int> & cds_range = entry->cds_range;
|
|
137
198
|
if (gtf.feature == "transcript") {
|
|
138
199
|
info.start = gtf.start;
|
|
139
200
|
info.end = gtf.end;
|
|
140
201
|
info.attributes = std::move(gtf.attributes);
|
|
141
202
|
} else if (gtf.feature == "CDS") {
|
|
142
|
-
info.cds.push_back(
|
|
203
|
+
info.cds.push_back(Region {gtf.start, gtf.end});
|
|
143
204
|
cds_range["max"] = std::max(std::max(cds_range["max"], gtf.start), gtf.end);
|
|
144
205
|
cds_range["min"] = std::min(std::min(cds_range["min"], gtf.start), gtf.end);
|
|
145
206
|
} else if (gtf.feature == "exon") {
|
|
146
|
-
info.exons.push_back(
|
|
207
|
+
info.exons.push_back(Region {gtf.start, gtf.end});
|
|
147
208
|
} else if ((gtf.feature == "stop_codon") || (gtf.feature == "start_codon")) {
|
|
148
209
|
cds_range["max"] = std::max(std::max(cds_range["max"], gtf.start), gtf.end);
|
|
149
210
|
cds_range["min"] = std::min(std::min(cds_range["min"], gtf.start), gtf.end);
|
|
150
211
|
}
|
|
151
212
|
}
|
|
152
213
|
|
|
153
|
-
|
|
154
|
-
if (info.name != "") {
|
|
155
|
-
include_end_codons(cds_range, info);
|
|
156
|
-
Tx tx = Tx(info.name, info.chrom, info.start, info.end, info.strand[0], info.transcript_type, info.attributes);
|
|
157
|
-
tx.set_exons(info.exons);
|
|
158
|
-
tx.set_cds(info.cds);
|
|
159
|
-
transcripts.push_back({symbol, alt_ids, tx, info.is_canonical});
|
|
160
|
-
}
|
|
214
|
+
build_transcripts(transcripts, entries, index);
|
|
161
215
|
}
|
|
162
216
|
|
|
163
217
|
std::vector<NamedTx> open_gencode(std::string path, bool coding) {
|
|
@@ -177,10 +231,6 @@ std::vector<std::string> _in_region(std::string chrom, int start, int end,
|
|
|
177
231
|
std::map<std::string, std::vector<GenePoint>> & ends,
|
|
178
232
|
int max_window=2500000) {
|
|
179
233
|
|
|
180
|
-
if (chrom.size() < 3 || chrom.substr(0, 3) != "chr") {
|
|
181
|
-
chrom.insert(0, "chr");
|
|
182
|
-
}
|
|
183
|
-
|
|
184
234
|
if (starts.count(chrom) == 0) {
|
|
185
235
|
throw std::invalid_argument("unknown_chrom: " + chrom);
|
|
186
236
|
}
|
|
@@ -257,7 +307,7 @@ std::vector<std::string> _in_region(std::string chrom, int start, int end,
|
|
|
257
307
|
// gencode::open_gencode(path);
|
|
258
308
|
// }
|
|
259
309
|
//
|
|
260
|
-
// g++ -std=c++11 gencode.cpp gtf.cpp tx.cpp
|
|
310
|
+
// g++ -std=c++11 gencode.cpp gtf.cpp tx.cpp -lz
|
|
261
311
|
|
|
262
312
|
|
|
263
313
|
|
|
@@ -17,12 +17,12 @@ namespace gencode {
|
|
|
17
17
|
struct TxInfo {
|
|
18
18
|
std::string name = "";
|
|
19
19
|
std::string chrom;
|
|
20
|
-
int start;
|
|
21
|
-
int end;
|
|
20
|
+
int start = 0;
|
|
21
|
+
int end = 0;
|
|
22
22
|
std::string strand;
|
|
23
23
|
std::string transcript_type;
|
|
24
|
-
std::vector<
|
|
25
|
-
std::vector<
|
|
24
|
+
std::vector<Region> exons;
|
|
25
|
+
std::vector<Region> cds;
|
|
26
26
|
int offset = 0;
|
|
27
27
|
int is_canonical = 0;
|
|
28
28
|
std::map<std::string, std::string> attributes;
|