Blazing fast toolkit to work with .hic and .cool files
Project description
hictkpy
Python bindings for hictk, a blazing fast toolkit to work with .hic and .cool files.
Installing hictkpy
hictkpy can be installed in various ways.
PIP
pip install hictkpy
Conda (bioconda)
conda install -c conda-forge -c bioconda hictkpy
From source
pip install 'git+https://github.com/paulsengroup/hictkpy.git@main'
On Windows you will have to manually install some of hictk dependencies, namely hdf5 (with zlib support) and libdeflate.
Using hictkpy
import hictkpy
path_to_clr = "file.mcool" # "file.hic"
clr = hictkpy.File(path_to_clr, 100_000)
sel = clr.fetch("chr1")
df = sel.to_df() # Get interactions as a pd.DataFrame
m1 = sel.to_numpy() # Get interactions as a numpy matrix
m2 = sel.to_coo() # Get interactions as a scipy.sparse.coo_matrix
# Loop over interactions
for bin1_id, bin2_id, count in clr.fetch("chr1"):
print(bin1_id, ...)
# Loop over interactions
for chrom1, start1, end1, chrom2, start2, end2, count in clr.fetch("chr1", join=True):
print(chrom1, ...)
# Fetch interactions using UCSC queries
clr.fetch("chr1:0-10,000,000").to_df()
clr.fetch("chr1:0-10,000,000", "chr2:100,000,000-105,000,000").to_df()
# Fetch interactions using BED queries
clr.fetch("chr1\t0\t10000000", query_type="BED").to_df()
# Fetch balanced interactions
clr.fetch("chr1", normalization="weight").to_df()
clr.fetch("chr1", normalization="VC").to_df()
# Sum interactions overlapping query
clr.fetch("chr1").sum()
# Count non-zero entries
clr.fetch("chr1").nnz()
MIT License
Copyright (c) 2023 Roberto Rossini
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for hictkpy-0.0.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54acfe9cf8148ede0b76e4d3da906b2ea40c3a076631e1e6f507f684c9870e81 |
|
MD5 | 71fc53d69cc25bcb8d5219e6d8837ea7 |
|
BLAKE2b-256 | bd912d7c7dfb03c842883ee45b6ff33914fdd52ae1f554530321210df2e6710a |
Hashes for hictkpy-0.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b48824abac719ab4e40fa413a07804c413fbbf363141f9b4c2a1336d5ffcc0a |
|
MD5 | 15810ee8e51b4fc98c04a258b2ec4a94 |
|
BLAKE2b-256 | 7301beb857cef13523a05b216be718f21da22c83236b13c3c86e92befcc5e603 |
Hashes for hictkpy-0.0.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 687bb8498816bf9a14bb2b122aae3cf5823d3291360989e1fc53ae329950356a |
|
MD5 | 22cbfb9e52458ed2c645d17d0d2e45d6 |
|
BLAKE2b-256 | a6a91ecc45772c0344362f76d063bd06a716143db31a19d4460ba73e0208662b |
Hashes for hictkpy-0.0.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64b57b69fb17036c00ea37d31dd1d412d0e637233f3e50c69ecfd0c2c948385c |
|
MD5 | bd7ffd0ebe75459a2a6d49eca0ddc1da |
|
BLAKE2b-256 | 1c9bd927ff9dcfba61f888f23cd4c5816cb44167375fac0071afe918b3867b17 |
Hashes for hictkpy-0.0.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f454efec87cd830b51f55857d9ceab4f7133b2626fb2dbd484c38ca59a871edc |
|
MD5 | 3e17da60b284a2c3deae949c90f38b77 |
|
BLAKE2b-256 | a1f9625933f5f6d1ba62319d16c6e3b2701ebc95a718743fc8ae8c20012d713b |
Hashes for hictkpy-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8425994171d34781b7afd2540430d106b4478c9fc912e1c3c41d63e9e2d2ffb8 |
|
MD5 | d802fcda1ae95cfbf61c8feee352b643 |
|
BLAKE2b-256 | 764e976674884db74f15cb89d154cd74a56a8c7f0e94e3654479c0a60c27c3c9 |
Hashes for hictkpy-0.0.2-cp311-cp311-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fb66f2aee769c59bc1bd28e29aa1f968682f70f401132dab9376203820d6303 |
|
MD5 | 22c019e56c66c9fecdd34f2f5e2174e6 |
|
BLAKE2b-256 | fed665470243197433a4041584f4e6d21b0a87666fab3f0d06b427d95bb25eba |
Hashes for hictkpy-0.0.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 904afba86a0e90c9730e5c10f0849057e28c15f92bb6f9b2c0dac9c4b9042a7a |
|
MD5 | c2c4007661aa16c0b92e8d3ba8f48f7a |
|
BLAKE2b-256 | d2b55da5844277b34782576150ea81013e87a485423652ee94b85cb6175cfa9d |
Hashes for hictkpy-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 251acc05125b860d0d6c7a18ee231ff2c76f364fccf18cee85fc868a4cd9d64e |
|
MD5 | b036571f8641089234f515a7f4ce2bcd |
|
BLAKE2b-256 | fe09464435e0161cc4f8df95e4dbcab0d5abff15ae4ce39fd45698aaf3e156aa |
Hashes for hictkpy-0.0.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b348038b9c05a58e92c87b9aadd2eed83ae1a3f607a7b5461b21e48828977d6 |
|
MD5 | 5701c63ea9f0afd4e601a078b8d3091c |
|
BLAKE2b-256 | b7812dff9730ade0c1c6f411d4b1383a8aa8a9931039605bc29d32e4a3fe0d86 |
Hashes for hictkpy-0.0.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ae3c480b20f46906e35926ab50f49b4e77f5ba9ba4bbe0df812cbe7cb603dc |
|
MD5 | 2d371d3fca251b587d3ec765f1b58062 |
|
BLAKE2b-256 | 7f953bea21b19be4653edeeb38b82119e0facf2daa7d67ee26a8469cdbafd983 |
Hashes for hictkpy-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5ff2451d18111b7b5070c5881323c29d711fb69cd202b294c12eb7e9b4516b |
|
MD5 | d575f50698f4564d18b3c12d84c4ed31 |
|
BLAKE2b-256 | f50cad2c6f09564855ac3f850dda186b0bd56a9fe1a041136aa97a6b8b90c1d6 |
Hashes for hictkpy-0.0.2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4316569f0fdf7d54815f62da5fa806af692648be5788ad42d304bc7732b3bff |
|
MD5 | 93122720f8a13a14086c460a2b18a21b |
|
BLAKE2b-256 | c4b9a03dfa56182d6dc4a0d4d44d6a3fa8c77b78a0f629fe794798006fdd0f62 |
Hashes for hictkpy-0.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf5667f54f71e468757ce1d8627fc2da5d9f3da7960693d6b953d08f505a97c |
|
MD5 | 1303e658c5089c884d6a41e08dd5fea2 |
|
BLAKE2b-256 | 6760fef0b77cde7eaab478809e11287f32e0736f3bcab86674b0cbff1147b152 |
Hashes for hictkpy-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad6ef32e3cf04e9b7f72b40394486f9cf18deccf32e9ae391df34774cecbb12 |
|
MD5 | 0e31102132a53bb54e3045dd39981c7b |
|
BLAKE2b-256 | c2efc107ce79ddad3749ba54b736cf1c467ce60f012aa67f94fe2d46fcc78fc4 |
Hashes for hictkpy-0.0.2-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf568916b9646c24770032606d68ea72a29f105361b0664ed6f2513cfbd0258 |
|
MD5 | 6f318aa62bb82944db82af8f7a108642 |
|
BLAKE2b-256 | d732b78fdecf0b340c0b590bde931ed89a07885cdcc341094dd2bca5bb256d40 |
Hashes for hictkpy-0.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbcae8f27fd1642065f083d3d58d9d0fe526416b07a127bc997b8f2ba599d304 |
|
MD5 | f2e695bad4ebde02c0ceb5be7b37e197 |
|
BLAKE2b-256 | fb50c1a2d9a3c68ff6f3a4d3f64f00c2972c8c60d127849791d9b17de85633ff |
Hashes for hictkpy-0.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ace18209c458f154f321619621af04f0d61824b59210e50632c876d6ec7a42e |
|
MD5 | 085ed575b8f3c009fdc60b509ee156b4 |
|
BLAKE2b-256 | 5766fdf934b1364e161da5c84d66d9f2b0242bf498b4c8282db489f12b2f9df1 |
Hashes for hictkpy-0.0.2-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268a8dc4946420d269cd2599b3101ee1edfca180234496ab2d2df7353ff64e72 |
|
MD5 | 91023a960d7b08d3ca36081c74411ecf |
|
BLAKE2b-256 | aceaf1125863492e010b6d5f8b78aebb01726bc02866ff45080e4cceeb9dd8dc |
Hashes for hictkpy-0.0.2-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcbae003643348ba6fa0b194c936880d1f9b730d69ee9a4614e2f04a5fdae3ab |
|
MD5 | 344d9db2df203a415ed5102d8f79d3a2 |
|
BLAKE2b-256 | 6580f049f97ad85d31c85b90d89428406e68bd161f67f1a5a1f3fbe9f48da904 |