Skip to main content

Python implementation of the [**IRanges**](https://bioconductor.org/packages/IRanges) Bioconductor package.

Project description

Project generated with PyScaffold PyPI-Server Unit tests

Integer ranges in Python

Python implementation of the IRanges Bioconductor package.

To get started, install the package from PyPI

pip install iranges

# To install optional dependencies
pip install iranges[optional]

IRanges

An IRanges holds a start position and a width, and is most typically used to represent coordinates along some genomic sequence. The interpretation of the start position depends on the application; for sequences, the start is usually a 1-based position, but other use cases may allow zero or even negative values.

[!NOTE] ends are expected to be inclusive to be consistent with Bioconductor representations. If they are not, we recommend subtracting 1 from the ends.

from iranges import IRanges

starts = [1, 2, 3, 4]
widths = [4, 5, 6, 7]
x = IRanges(starts, widths)

print(x)
 ## output
 IRanges object with 4 ranges and 0 metadata columns
                start              end            width
      <ndarray[int32]> <ndarray[int32]> <ndarray[int32]>
 [0]                1                4                4
 [1]                2                6                5
 [2]                3                9                6
 [3]                4               10                7

Interval Operations

IRanges supports most interval based operations. For example to compute gaps

x = IRanges([-2, 6, 9, -4, 1, 0, -6, 10], [5, 0, 6, 1, 4, 3, 2, 3])

gaps = x.gaps()
print(gaps)
 ## output
 IRanges object with 2 ranges and 0 metadata columns
                start              end            width
      <ndarray[int32]> <ndarray[int32]> <ndarray[int32]>
 [0]               -3               -3                1
 [1]                5                8                4

Or Perform interval set operations

x = IRanges([1, 5, -2, 0, 14], [10, 5, 6, 12, 4])
y = IRanges([14, 0, -5, 6, 18], [7, 3, 8, 3, 3])

intersection = x.intersect(y)
print(intersection)
 ## output
 IRanges object with 3 ranges and 0 metadata columns
                start              end            width
      <ndarray[int32]> <ndarray[int32]> <ndarray[int32]>
 [0]               -2                2                5
 [1]                6                9                3
 [2]               14               17                4

Overlap operations

IRanges uses LTLA/nclist-cpp under the hood to perform fast overlap and search based operations. These methods typically return a hits-like BiocFrame.

subject = IRanges([2, 2, 10], [1, 2, 3])
query = IRanges([1, 4, 9], [5, 4, 2])

overlap = subject.find_overlaps(query)
print(overlap)
 ## output
 BiocFrame with 3 rows and 2 columns
           self_hits       query_hits
      <ndarray[int64]> <ndarray[int64]>
 [0]                1                0
 [1]                0                0
 [2]                2                2

Similarly one can perform search operations like follow, precede or nearest.

query = IRanges([1, 3, 9], [2, 5, 2])
subject = IRanges([3, 5, 12], [1, 2, 1])

nearest = subject.nearest(query, select="all")
print(nearest)
 ## output
 BiocFrame with 4 rows and 2 columns
           query_hits        self_hits
      <ndarray[int64]> <ndarray[int64]>
 [0]                0                0
 [1]                0                1
 [2]                1                1
 [3]                2                2

Further Information

Note

This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

iranges-0.7.2.tar.gz (60.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

iranges-0.7.2-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

iranges-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

iranges-0.7.2-cp313-cp313-macosx_11_0_arm64.whl (159.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

iranges-0.7.2-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

iranges-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

iranges-0.7.2-cp312-cp312-macosx_11_0_arm64.whl (159.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

iranges-0.7.2-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

iranges-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (203.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

iranges-0.7.2-cp311-cp311-macosx_11_0_arm64.whl (158.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

iranges-0.7.2-cp310-cp310-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

iranges-0.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

iranges-0.7.2-cp310-cp310-macosx_11_0_arm64.whl (157.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file iranges-0.7.2.tar.gz.

File metadata

  • Download URL: iranges-0.7.2.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for iranges-0.7.2.tar.gz
Algorithm Hash digest
SHA256 25c2f6049698fd4aafa8ae31a738f53f3c33b5bd5a1c32e108c1ac6583debbe3
MD5 9e5dce740fe1055b524dd35aba1b3f71
BLAKE2b-256 daa98718d3aba1f3095ff79285eff2887d0edee237963de6f4085c9996d2cd27

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2.tar.gz:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4ed30ec4e066961b2fed57e54067dc376ce254c638f92b65292e28b0d1599e67
MD5 306d689f6239689a8a543739b5d8c267
BLAKE2b-256 a3096376619e8600ff1055565bc604943a7413227fc015c24452bb0307963bb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 72582524b3dacfc946efed6d09878a27478957b9dda37ad2bf52d82d042d0b59
MD5 a4cd6915648c8c3405a032f959f0b923
BLAKE2b-256 da1a67eb7ebbb8fa7d4b316c2256c4f580dbd92f5195242dc65e6848f381b163

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5885698d3ed6d1ac08668a4a145c114d194b7fe5d40cf75a46357b277ba20a23
MD5 846fe6a4094f3ef6573c1dd960201e76
BLAKE2b-256 235fe13ebb30814aa0c058884ba740a41dca438c30fdddc8559a0f0183e6e725

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4f4469987ad9d4c278eba97ec0505487a9542a989bea08ee3383716fb278e5a4
MD5 57c7da8ce0a4dfa04fe9e91cf53d1845
BLAKE2b-256 b84b9eb63f06531b38f3aaf9347801371e46ae317e82bcdf51d86eff6e83f7a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c967e54f78415d1ce53412b15fed02290f74ee7b4b9f2bc82bf9de98fe6983ee
MD5 813d64eede4271b8219814584cbac12f
BLAKE2b-256 09e296bb51142e421ea1b9882eb94abec836d4ceedc0660b33fe0788ecc28a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44d56bd857ec324cd9f7cbf2e86e7ea28724394aa84b953196658f148cc4f3ba
MD5 fb3fc99d8ba8df2e1fdbb066685a53cc
BLAKE2b-256 1d00672872c9fc98a76ae29a1d557a060bc8facab95e78d3f50b5cc5882e4bbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3b7ab52c1325b752cbba8ae16448bd5bcb6718236766dadc9af4c626379795d7
MD5 0ad9fe7e80b26bf0b61fe80d93320566
BLAKE2b-256 e4ea093fae63e58f7c52bf13ff01c8873a2bb8973087230dfca8f14e60e05657

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff293fec866882bb4f8afc335b4cbd63d36a9f0d6d33eb8c297d6d25d2bfc774
MD5 87d7c2c2b180a619f97c02364b5482b1
BLAKE2b-256 44b78b5bf8044220e1b121c64d471d8c3bfee327104fd406d80db18eecbfddc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e39cd2f6dca739ea6e742812b8fc82686b142fa3c56ef34af68d338a748c551f
MD5 b016266ae1f08346793ff9a2c1217833
BLAKE2b-256 a17ade9c91778aa9febcbc109e4148eb8fe9f9f0bfd3733e1594f04df7955590

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e6637b93e407f2dfc6b303114aa09e2c27b3b27ff5e6d394de1f51c2f8e82a92
MD5 add10ff983731e3c4356fb54cf514413
BLAKE2b-256 6524da2057c825c7e39dfaa96982be32ee62664f8f40b44e3c1f58d98d0ca0f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74db3544dfb8da87dc7d5b3946b7b336ed3ee2a934eecc7f5fe7eeacbe285e7e
MD5 bbf6d2690f1e1cc14af618f45fda8167
BLAKE2b-256 de715bf0a3d09d64812684af90daa2f20d0b1de75c59f862b79fcb419a89b140

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iranges-0.7.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for iranges-0.7.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03d948397cf31bb9ddc12c584c066da5d6bd6f15d1c0968f930d13e7604c421d
MD5 a26430cdafd4b9a6cf5953ac14bfbb7f
BLAKE2b-256 41b7d1ac7405ef1fca2bf488b766555215e33a19c9580045d15e872cf63a16bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for iranges-0.7.2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/IRanges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page