{"id":21962524,"url":"https://github.com/biocpy/iranges","last_synced_at":"2025-04-23T21:26:34.981Z","repository":{"id":204527409,"uuid":"711003957","full_name":"BiocPy/IRanges","owner":"BiocPy","description":"IRanges in Python","archived":false,"fork":false,"pushed_at":"2025-04-21T16:28:34.000Z","size":615,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T17:35:37.193Z","etag":null,"topics":["interval-arithmetic","iranges"],"latest_commit_sha":null,"homepage":"https://biocpy.github.io/IRanges/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BiocPy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-28T00:02:01.000Z","updated_at":"2025-03-27T06:21:20.000Z","dependencies_parsed_at":"2023-11-03T00:28:16.289Z","dependency_job_id":"bef9c110-fc64-4924-8255-4f910825a604","html_url":"https://github.com/BiocPy/IRanges","commit_stats":null,"previous_names":["biocpy/iranges"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2FIRanges","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2FIRanges/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2FIRanges/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2FIRanges/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BiocPy","download_url":"https://codeload.github.com/BiocPy/IRanges/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250516396,"owners_count":21443619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interval-arithmetic","iranges"],"created_at":"2024-11-29T10:42:57.658Z","updated_at":"2025-04-23T21:26:34.975Z","avatar_url":"https://github.com/BiocPy.png","language":"Python","readme":"\u003c!-- These are examples of badges you might want to add to your README:\n     please update the URLs accordingly\n\n[![Built Status](https://api.cirrus-ci.com/github/\u003cUSER\u003e/IRanges.svg?branch=main)](https://cirrus-ci.com/github/\u003cUSER\u003e/IRanges)\n[![ReadTheDocs](https://readthedocs.org/projects/IRanges/badge/?version=latest)](https://IRanges.readthedocs.io/en/stable/)\n[![Coveralls](https://img.shields.io/coveralls/github/\u003cUSER\u003e/IRanges/main.svg)](https://coveralls.io/r/\u003cUSER\u003e/IRanges)\n[![PyPI-Server](https://img.shields.io/pypi/v/IRanges.svg)](https://pypi.org/project/IRanges/)\n[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/IRanges.svg)](https://anaconda.org/conda-forge/IRanges)\n[![Monthly Downloads](https://pepy.tech/badge/IRanges/month)](https://pepy.tech/project/IRanges)\n[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social\u0026label=Twitter)](https://twitter.com/IRanges)\n--\u003e\n\n[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)\n[![PyPI-Server](https://img.shields.io/pypi/v/IRanges.svg)](https://pypi.org/project/IRanges/)\n![Unit tests](https://github.com/BiocPy/IRanges/actions/workflows/run-tests.yml/badge.svg)\n\n# Integer ranges in Python\n\nPython implementation of the [**IRanges**](https://bioconductor.org/packages/IRanges) Bioconductor package.\n\nTo get started, install the package from [PyPI](https://pypi.org/project/IRanges/)\n\n```bash\npip install iranges\n\n# To install optional dependencies\npip install iranges[optional]\n```\n\n## IRanges\n\nAn `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.\n\nNote: Ends are inclusive.\n\n```python\nfrom iranges import IRanges\n\nstarts = [1, 2, 3, 4]\nwidths = [4, 5, 6, 7]\nx = IRanges(starts, widths)\n\nprint(x)\n```\n\n     ## output\n     IRanges object with 4 ranges and 0 metadata columns\n                    start              end            width\n          \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e\n     [0]                1                4                4\n     [1]                2                6                5\n     [2]                3                9                6\n     [3]                4               10                7\n\n## Interval Operations\n\n`IRanges` supports most interval based operations. For example to compute gaps\n\n```python\n\nx = IRanges([-2, 6, 9, -4, 1, 0, -6, 10], [5, 0, 6, 1, 4, 3, 2, 3])\n\ngaps = x.gaps()\nprint(gaps)\n```\n\n     ## output\n     IRanges object with 2 ranges and 0 metadata columns\n                    start              end            width\n          \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e\n     [0]               -3               -3                1\n     [1]                5                8                4\n\nOr Perform interval set operations\n\n```python\nx = IRanges([1, 5, -2, 0, 14], [10, 5, 6, 12, 4])\ny = IRanges([14, 0, -5, 6, 18], [7, 3, 8, 3, 3])\n\nintersection = x.intersect(y)\nprint(intersection)\n```\n\n     ## output\n     IRanges object with 3 ranges and 0 metadata columns\n                    start              end            width\n          \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e \u003cndarray[int32]\u003e\n     [0]               -2                2                5\n     [1]                6                9                3\n     [2]               14               17                4\n\n### Overlap operations\n\nIRanges uses [nested containment lists](https://github.com/pyranges/ncls) under the hood to perform fast overlap and search based operations. These methods typically return a hits-like BiocFrame.\n\n```python\nsubject = IRanges([2, 2, 10], [1, 2, 3])\nquery = IRanges([1, 4, 9], [5, 4, 2])\n\noverlap = subject.find_overlaps(query)\nprint(overlap)\n```\n\n     ## output\n     BiocFrame with 3 rows and 2 columns\n               self_hits       query_hits\n          \u003cndarray[int64]\u003e \u003cndarray[int64]\u003e\n     [0]                1                0\n     [1]                0                0\n     [2]                2                2\n\nSimilarly one can perform search operations like follow, precede or nearest.\n\n```python\nquery = IRanges([1, 3, 9], [2, 5, 2])\nsubject = IRanges([3, 5, 12], [1, 2, 1])\n\nnearest = subject.nearest(query, select=\"all\")\nprint(nearest)\n```\n\n     ## output\n     BiocFrame with 4 rows and 2 columns\n               query_hits        self_hits\n          \u003cndarray[int64]\u003e \u003cndarray[int64]\u003e\n     [0]                0                0\n     [1]                0                1\n     [2]                1                1\n     [3]                2                2\n\n## Further Information\n\n- [IRanges reference](https://biocpy.github.io/IRanges/api/iranges.html#iranges-package)\n- [Bioc/IRanges](https://bioconductor.org/packages/release/bioc/html/IRanges.html)\n\n\n\u003c!-- pyscaffold-notes --\u003e\n\n## Note\n\nThis project has been set up using PyScaffold 4.5. For details and usage\ninformation on PyScaffold see https://pyscaffold.org/.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiocpy%2Firanges","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiocpy%2Firanges","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiocpy%2Firanges/lists"}