pyranges1 0.1.0__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.
Files changed (148) hide show
  1. pyranges1-0.1.0/.github/workflows/build-book.yml +49 -0
  2. pyranges1-0.1.0/.github/workflows/build_and_upload_wheels.yml +35 -0
  3. pyranges1-0.1.0/.github/workflows/check.yml +41 -0
  4. pyranges1-0.1.0/.github/workflows/run_hypothesis_tests.yml +28 -0
  5. pyranges1-0.1.0/.gitignore +34 -0
  6. pyranges1-0.1.0/CHANGELOG.txt +2 -0
  7. pyranges1-0.1.0/LICENSE +19 -0
  8. pyranges1-0.1.0/PKG-INFO +98 -0
  9. pyranges1-0.1.0/README.md +47 -0
  10. pyranges1-0.1.0/check_typing_linting_and_formatting.py +63 -0
  11. pyranges1-0.1.0/conftest.py +20 -0
  12. pyranges1-0.1.0/docs/Makefile +20 -0
  13. pyranges1-0.1.0/docs/api_reference.rst +17 -0
  14. pyranges1-0.1.0/docs/conf.py +79 -0
  15. pyranges1-0.1.0/docs/developer_guide.rst +348 -0
  16. pyranges1-0.1.0/docs/extension_orfs.rst +10 -0
  17. pyranges1-0.1.0/docs/extension_seqs.rst +10 -0
  18. pyranges1-0.1.0/docs/extension_stats.rst +10 -0
  19. pyranges1-0.1.0/docs/how_to_columns.rst +182 -0
  20. pyranges1-0.1.0/docs/how_to_create.rst +297 -0
  21. pyranges1-0.1.0/docs/how_to_genomic_ops.rst +590 -0
  22. pyranges1-0.1.0/docs/how_to_inspect.rst +260 -0
  23. pyranges1-0.1.0/docs/how_to_pages.rst +15 -0
  24. pyranges1-0.1.0/docs/how_to_rows.rst +402 -0
  25. pyranges1-0.1.0/docs/how_to_sequences.rst +175 -0
  26. pyranges1-0.1.0/docs/how_to_write.rst +96 -0
  27. pyranges1-0.1.0/docs/index.rst +55 -0
  28. pyranges1-0.1.0/docs/installation.rst +36 -0
  29. pyranges1-0.1.0/docs/make.bat +35 -0
  30. pyranges1-0.1.0/docs/pyranges_extensions.rst +13 -0
  31. pyranges1-0.1.0/docs/pyranges_module.rst +65 -0
  32. pyranges1-0.1.0/docs/pyranges_objects.rst +10 -0
  33. pyranges1-0.1.0/docs/range_frame.rst +8 -0
  34. pyranges1-0.1.0/docs/requirements.txt +2 -0
  35. pyranges1-0.1.0/docs/todos.rst +41 -0
  36. pyranges1-0.1.0/docs/tutorial.rst +836 -0
  37. pyranges1-0.1.0/pyproject.toml +106 -0
  38. pyranges1-0.1.0/pyranges/__init__.py +18 -0
  39. pyranges1-0.1.0/pyranges/core/__init__.py +0 -0
  40. pyranges1-0.1.0/pyranges/core/empty.py +62 -0
  41. pyranges1-0.1.0/pyranges/core/example_data.py +275 -0
  42. pyranges1-0.1.0/pyranges/core/loci_getter.py +149 -0
  43. pyranges1-0.1.0/pyranges/core/multioverlap.py +150 -0
  44. pyranges1-0.1.0/pyranges/core/names.py +168 -0
  45. pyranges1-0.1.0/pyranges/core/options.py +111 -0
  46. pyranges1-0.1.0/pyranges/core/out.py +315 -0
  47. pyranges1-0.1.0/pyranges/core/parallelism.py +166 -0
  48. pyranges1-0.1.0/pyranges/core/pyranges_groupby.py +225 -0
  49. pyranges1-0.1.0/pyranges/core/pyranges_helpers.py +190 -0
  50. pyranges1-0.1.0/pyranges/core/pyranges_main.py +4725 -0
  51. pyranges1-0.1.0/pyranges/core/random.py +85 -0
  52. pyranges1-0.1.0/pyranges/core/tostring.py +192 -0
  53. pyranges1-0.1.0/pyranges/core/version.py +45 -0
  54. pyranges1-0.1.0/pyranges/data/__init__.py +0 -0
  55. pyranges1-0.1.0/pyranges/data/aorta.bed +11 -0
  56. pyranges1-0.1.0/pyranges/data/aorta2.bed +10 -0
  57. pyranges1-0.1.0/pyranges/data/chipseq.bed +10000 -0
  58. pyranges1-0.1.0/pyranges/data/chipseq_background.bed +10000 -0
  59. pyranges1-0.1.0/pyranges/data/chromsizes.bed +25 -0
  60. pyranges1-0.1.0/pyranges/data/cpg.bed +1077 -0
  61. pyranges1-0.1.0/pyranges/data/ensembl.gtf +17 -0
  62. pyranges1-0.1.0/pyranges/data/ensembl_human.gtf.gz +0 -0
  63. pyranges1-0.1.0/pyranges/data/exons.bed +1000 -0
  64. pyranges1-0.1.0/pyranges/data/f1.bed +3 -0
  65. pyranges1-0.1.0/pyranges/data/f2.bed +2 -0
  66. pyranges1-0.1.0/pyranges/data/gencode_human.gtf.gz +0 -0
  67. pyranges1-0.1.0/pyranges/data/lamina.bed +1345 -0
  68. pyranges1-0.1.0/pyranges/data/ncbi.fasta +6348 -0
  69. pyranges1-0.1.0/pyranges/data/ncbi.fasta.fai +6 -0
  70. pyranges1-0.1.0/pyranges/data/ncbi.gff.gz +0 -0
  71. pyranges1-0.1.0/pyranges/data/smaller.bam +0 -0
  72. pyranges1-0.1.0/pyranges/data/ucsc_human.bed.gz +0 -0
  73. pyranges1-0.1.0/pyranges/docs +0 -0
  74. pyranges1-0.1.0/pyranges/ext/__init__.py +0 -0
  75. pyranges1-0.1.0/pyranges/ext/orfs.py +732 -0
  76. pyranges1-0.1.0/pyranges/ext/seqs.py +342 -0
  77. pyranges1-0.1.0/pyranges/ext/stats.py +865 -0
  78. pyranges1-0.1.0/pyranges/methods/__init__.py +0 -0
  79. pyranges1-0.1.0/pyranges/methods/boundaries.py +74 -0
  80. pyranges1-0.1.0/pyranges/methods/cluster.py +26 -0
  81. pyranges1-0.1.0/pyranges/methods/combine_positions.py +39 -0
  82. pyranges1-0.1.0/pyranges/methods/concat.py +87 -0
  83. pyranges1-0.1.0/pyranges/methods/coverage.py +72 -0
  84. pyranges1-0.1.0/pyranges/methods/itergrs.py +0 -0
  85. pyranges1-0.1.0/pyranges/methods/join.py +76 -0
  86. pyranges1-0.1.0/pyranges/methods/max_disjoint.py +15 -0
  87. pyranges1-0.1.0/pyranges/methods/merge.py +33 -0
  88. pyranges1-0.1.0/pyranges/methods/merge_cluster.py +0 -0
  89. pyranges1-0.1.0/pyranges/methods/nearest.py +158 -0
  90. pyranges1-0.1.0/pyranges/methods/overlap.py +145 -0
  91. pyranges1-0.1.0/pyranges/methods/sort.py +7 -0
  92. pyranges1-0.1.0/pyranges/methods/spliced_subsequence.py +104 -0
  93. pyranges1-0.1.0/pyranges/methods/split.py +37 -0
  94. pyranges1-0.1.0/pyranges/methods/statistics.py +38 -0
  95. pyranges1-0.1.0/pyranges/methods/subsequence.py +99 -0
  96. pyranges1-0.1.0/pyranges/methods/subtraction.py +44 -0
  97. pyranges1-0.1.0/pyranges/methods/summary.py +57 -0
  98. pyranges1-0.1.0/pyranges/methods/tile_genome.py +110 -0
  99. pyranges1-0.1.0/pyranges/methods/to_rle.py +41 -0
  100. pyranges1-0.1.0/pyranges/methods/windows.py +83 -0
  101. pyranges1-0.1.0/pyranges/orfs.py +1 -0
  102. pyranges1-0.1.0/pyranges/range_frame/__init__.py +0 -0
  103. pyranges1-0.1.0/pyranges/range_frame/range_frame.py +354 -0
  104. pyranges1-0.1.0/pyranges/range_frame/range_frame_validator.py +173 -0
  105. pyranges1-0.1.0/pyranges/readers.py +672 -0
  106. pyranges1-0.1.0/pyranges/seqs.py +5 -0
  107. pyranges1-0.1.0/pyranges/stats.py +12 -0
  108. pyranges1-0.1.0/pyranges1.egg-info/PKG-INFO +98 -0
  109. pyranges1-0.1.0/pyranges1.egg-info/SOURCES.txt +146 -0
  110. pyranges1-0.1.0/pyranges1.egg-info/dependency_links.txt +1 -0
  111. pyranges1-0.1.0/pyranges1.egg-info/requires.txt +34 -0
  112. pyranges1-0.1.0/pyranges1.egg-info/top_level.txt +4 -0
  113. pyranges1-0.1.0/setup.cfg +4 -0
  114. pyranges1-0.1.0/setup.py +9 -0
  115. pyranges1-0.1.0/tests/.fuse_hidden0000017200000002 +308 -0
  116. pyranges1-0.1.0/tests/helpers.py +61 -0
  117. pyranges1-0.1.0/tests/hi +0 -0
  118. pyranges1-0.1.0/tests/property_based/__init__.py +0 -0
  119. pyranges1-0.1.0/tests/property_based/hypothesis_helper.py +278 -0
  120. pyranges1-0.1.0/tests/property_based/new.py +274 -0
  121. pyranges1-0.1.0/tests/property_based/test_binary.py +543 -0
  122. pyranges1-0.1.0/tests/property_based/test_do_not_error.py +107 -0
  123. pyranges1-0.1.0/tests/property_based/test_unary.py +327 -0
  124. pyranges1-0.1.0/tests/run_doctest_tutorial_howto.py +13 -0
  125. pyranges1-0.1.0/tests/test_calculate_frame.py +0 -0
  126. pyranges1-0.1.0/tests/test_parallelism.py +41 -0
  127. pyranges1-0.1.0/tests/unit/__init__.py +1 -0
  128. pyranges1-0.1.0/tests/unit/chip_10.bed +10 -0
  129. pyranges1-0.1.0/tests/unit/conftest.py +103 -0
  130. pyranges1-0.1.0/tests/unit/f1.bed +3 -0
  131. pyranges1-0.1.0/tests/unit/f2.bed +2 -0
  132. pyranges1-0.1.0/tests/unit/getitem/test_getitem.py +0 -0
  133. pyranges1-0.1.0/tests/unit/hi +0 -0
  134. pyranges1-0.1.0/tests/unit/k_nearest.py +200 -0
  135. pyranges1-0.1.0/tests/unit/new_position/test_new_position.py +18 -0
  136. pyranges1-0.1.0/tests/unit/out/test_out.py +32 -0
  137. pyranges1-0.1.0/tests/unit/spliced_subsequence/test_spliced_subsequence.py +108 -0
  138. pyranges1-0.1.0/tests/unit/statistics.py +9 -0
  139. pyranges1-0.1.0/tests/unit/test_concat.py +32 -0
  140. pyranges1-0.1.0/tests/unit/test_count_overlaps.py +61 -0
  141. pyranges1-0.1.0/tests/unit/test_data/ensembl.gtf +16 -0
  142. pyranges1-0.1.0/tests/unit/test_data/test_sorted.bam +0 -0
  143. pyranges1-0.1.0/tests/unit/test_data/test_sorted.bam.bai +0 -0
  144. pyranges1-0.1.0/tests/unit/test_guessers.py +71 -0
  145. pyranges1-0.1.0/tests/unit/test_join.py +79 -0
  146. pyranges1-0.1.0/tests/unit/test_pandas_overrides.py +246 -0
  147. pyranges1-0.1.0/tests/unit/test_tostring.py +17 -0
  148. pyranges1-0.1.0/tests/unit/unit/__init__.py +0 -0
@@ -0,0 +1,49 @@
1
+ name: Build and Deploy
2
+ on: [workflow_dispatch]
3
+ jobs:
4
+ build-and-deploy:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - name: Checkout
8
+ uses: actions/checkout@v2.3.1
9
+
10
+ - name: Add conda to system path
11
+ run: |
12
+ # $CONDA is an environment variable pointing to the root of the miniconda directory
13
+ echo $CONDA/bin >> $GITHUB_PATH
14
+
15
+ - name: Install pyranges
16
+ run: |
17
+ pip install cython
18
+ pip install sorted_nearest
19
+ python setup.py install
20
+ pip install bamread
21
+ pip install fisher
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ conda config --set always_yes yes --set changeps1 no
26
+ conda config --add channels bioconda
27
+ conda config --add channels r
28
+ conda install mamba -n base -c conda-forge
29
+ mamba install -c r r
30
+ mamba install -c conda-forge r-reticulate
31
+ # mamba install -c conda-forge r-bookdown
32
+ mamba install -y conda-forge::ncurses
33
+ mamba install -c conda-forge matplotlib
34
+ mamba install -c conda-forge pandoc
35
+ mamba install -c bioconda pybigwig
36
+ echo 'install.packages("bookdown")' > install.R
37
+ Rscript install.R
38
+
39
+ - name: Build book
40
+ run: |
41
+ cd book
42
+ Rscript compile.R
43
+
44
+ - name: Deploy
45
+ uses: JamesIves/github-pages-deploy-action@4.1.9
46
+ with:
47
+ branch: gh-pages # The branch the action should deploy to.
48
+ folder: book/build # The folder the action should deploy.
49
+
@@ -0,0 +1,35 @@
1
+ name: Build and upload to PyPI
2
+
3
+ # Source: https://raw.githubusercontent.com/pypa/cibuildwheel/main/examples/github-deploy.yml
4
+
5
+ env:
6
+ CIBW_SKIP: "cp36-*"
7
+
8
+ # Build on every branch push, tag push, and pull request change:
9
+ on:
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ build_and_upload_wheels:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ with:
18
+ fetch-depth: 0
19
+
20
+ - name: Build SDist and wheel
21
+ run: pipx run build
22
+
23
+ - uses: actions/upload-artifact@v3
24
+ with:
25
+ path: dist/*
26
+
27
+ - name: Check metadata
28
+ run: pipx run twine check dist/*
29
+
30
+ - uses: pypa/gh-action-pypi-publish@v1.5.0
31
+ with:
32
+ user: ${{ secrets.PYPI_USER }}
33
+ password: ${{ secrets.PYPI_PROD_PASSWORD }}
34
+ verbose: true
35
+ # To test: repository_url: https://test.pypi.org/legacy/
@@ -0,0 +1,41 @@
1
+ name: check
2
+ on:
3
+ pull_request:
4
+ workflow_dispatch:
5
+ issue_comment:
6
+ types: [created]
7
+
8
+ concurrency:
9
+ group: check-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ test:
14
+ name: test with ${{ matrix.py }} on ${{ matrix.os }}
15
+ runs-on: ${{ matrix.os }}
16
+ if: >-
17
+ github.event_name == 'pull_request' ||
18
+ github.event_name == 'workflow_dispatch' ||
19
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/rerun-precommit'))
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ py:
24
+ - "3.12"
25
+ os:
26
+ - ubuntu-latest
27
+ # - macos-latest
28
+ steps:
29
+ - uses: actions/checkout@v3
30
+ with:
31
+ fetch-depth: 0
32
+ - name: Setup python for test ${{ matrix.py }}
33
+ uses: actions/setup-python@v4
34
+ with:
35
+ python-version: ${{ matrix.py }}
36
+ - name: Install tox
37
+ run: python -m pip install tox-gh>=1.2
38
+ - name: Setup test suite
39
+ run: tox -vv --notest
40
+ - name: Run test suite
41
+ run: tox --skip-pkg-install
@@ -0,0 +1,28 @@
1
+ name: property-tests
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: [linting-typechecking-doctests]
6
+ types: [completed]
7
+
8
+
9
+ jobs:
10
+ on-success:
11
+ runs-on: ubuntu-latest
12
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: actions/setup-python@v4
16
+ with:
17
+ python-version: "3.11.0"
18
+ - run: sudo apt-get install bedtools
19
+ - run: pip install hypothesis pytest pytest-xdist
20
+ - run: pip install .
21
+ - run: pytest -sv -n 2 tests/property_based
22
+ env:
23
+ GITHUB_ACTIONS: true
24
+ on-failure:
25
+ runs-on: ubuntu-latest
26
+ if: ${{ github.event.workflow_run.conclusion == 'failure' }}
27
+ steps:
28
+ - run: exit 1 # Fail the job
@@ -0,0 +1,34 @@
1
+ docs/chipseq.csv
2
+ docs/chipseq.gtf
3
+ docs/test.bed
4
+
5
+ *.swp
6
+ .snakemake/
7
+ wheelhouse/
8
+ .coverage
9
+ htmlcov/
10
+ *flycheck*
11
+ *.pyc*
12
+ *bk
13
+ .hypothesis/
14
+ *.RData
15
+ *.Rhistory
16
+ build/
17
+ _build/
18
+ workflow/data
19
+ *#*
20
+ *.pyc
21
+ *.bk
22
+ *cache/
23
+ build/
24
+ dist/
25
+
26
+
27
+ *.txt
28
+ *.so
29
+ *.cpp
30
+ *.lprof
31
+ *.egg-*
32
+
33
+ pyranges-*/
34
+ *.bw
@@ -0,0 +1,2 @@
1
+ # 0.1.0
2
+ New pyranges version, redesigned from scratch.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2019 Endre Bakken Stovner
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyranges1
3
+ Version: 0.1.0
4
+ Summary: GenomicRanges for Python.
5
+ Author-email: Endre Bakken Stovner <endbak@pm.me>
6
+ License: MIT
7
+ Project-URL: Homepage, http://github.com/pyranges/pyranges_1.x
8
+ Keywords: bioinformatics,genomicranges,genomics
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Other Environment
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: MacOS :: MacOS X
17
+ Classifier: Topic :: Scientific/Engineering
18
+ Requires-Python: >=3.11.0
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: pandas
22
+ Requires-Dist: ncls>=0.0.63
23
+ Requires-Dist: tabulate
24
+ Requires-Dist: sorted_nearest>=0.0.33
25
+ Requires-Dist: natsort
26
+ Provides-Extra: add-ons
27
+ Requires-Dist: pyrle>=0.0.39; extra == "add-ons"
28
+ Requires-Dist: bamread; extra == "add-ons"
29
+ Requires-Dist: bwread; extra == "add-ons"
30
+ Requires-Dist: fisher; extra == "add-ons"
31
+ Requires-Dist: pyfaidx; extra == "add-ons"
32
+ Requires-Dist: joblib; extra == "add-ons"
33
+ Provides-Extra: dev
34
+ Requires-Dist: tox; extra == "dev"
35
+ Requires-Dist: ruff==0.3.0; extra == "dev"
36
+ Requires-Dist: pyright; extra == "dev"
37
+ Requires-Dist: pandas-stubs; extra == "dev"
38
+ Requires-Dist: types-tabulate; extra == "dev"
39
+ Requires-Dist: pytest-watcher; extra == "dev"
40
+ Requires-Dist: pytest-xdist; extra == "dev"
41
+ Requires-Dist: hypothesis>=6.92.1; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: sphinx; extra == "docs"
44
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
45
+ Requires-Dist: sphinx-autoapi; extra == "docs"
46
+ Requires-Dist: sphinxcontrib-napoleon; extra == "docs"
47
+ Provides-Extra: all
48
+ Requires-Dist: pyranges[add-ons]; extra == "all"
49
+ Requires-Dist: pyranges[dev]; extra == "all"
50
+ Requires-Dist: pyranges[docs]; extra == "all"
51
+
52
+ # pyranges
53
+
54
+ [![Coverage Status](https://img.shields.io/coveralls/github/biocore-ntnu/pyranges.svg)](https://coveralls.io/github/biocore-ntnu/pyranges?branch=master) [![hypothesis tested](graphs/hypothesis-tested-brightgreen.svg)](http://hypothesis.readthedocs.io/) [![PyPI version](https://badge.fury.io/py/pyranges.svg)](https://badge.fury.io/py/pyranges) [![MIT](https://img.shields.io/pypi/l/pyranges.svg?color=green)](https://opensource.org/licenses/MIT) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyranges.svg) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/pyranges/README.html)
55
+
56
+ ## Missing:
57
+
58
+ - to_bigwig: needs a rewrite of the pyrle module
59
+
60
+ ## Introduction
61
+
62
+ PyRanges is a Python library specifically designed for efficient and intuitive manipulation of genomics data,
63
+ particularly genomic intervals (like genes, genomic features, or reads).
64
+ The library is optimized for fast querying and manipulation of genomic annotations.
65
+
66
+ *"Finally ... This was what Python badly needed for years."* - Heng Li
67
+
68
+ ## Documentation
69
+
70
+ The pyranges documentation, including installation instructions, API, tutorial, and how-to-pages, will soon become available.
71
+
72
+ ## Features
73
+
74
+ - fast
75
+ - memory-efficient
76
+ - featureful
77
+ - pythonic/pandastic
78
+ - supports chaining with a terse syntax
79
+ - is a proper subclass of Pandas DataFrames
80
+
81
+ ## Paper/Cite
82
+
83
+ Stovner EB, Sætrom P (2020) PyRanges: efficient comparison of genomic intervals in Python. *Bioinformatics 36(3):918-919* http://dx.doi.org/10.1093/bioinformatics/btz615
84
+
85
+ ## Supporting pyranges
86
+
87
+ - most importantly, cite pyranges if you use it. It is the main metric funding sources care about.
88
+ - use pyranges in Stack Overflow/biostars questions and answers
89
+ - star the repo (possibly important for github visibility and as a proxy for project popularity)
90
+
91
+ ## Asking for help
92
+
93
+ If you encounter bugs, or the documentation is not enough a cannot accomplish a specific task of interest, or if you'd like new features implemented, open an Issue at github: https://github.com/pyranges/pyranges/issues
94
+
95
+ ## Contributing to pyranges
96
+
97
+ Pyranges accepts code contributions in form of pull request. For details, visit https://pyranges.readthedocs.io/developer_guide.html
98
+
@@ -0,0 +1,47 @@
1
+ # pyranges
2
+
3
+ [![Coverage Status](https://img.shields.io/coveralls/github/biocore-ntnu/pyranges.svg)](https://coveralls.io/github/biocore-ntnu/pyranges?branch=master) [![hypothesis tested](graphs/hypothesis-tested-brightgreen.svg)](http://hypothesis.readthedocs.io/) [![PyPI version](https://badge.fury.io/py/pyranges.svg)](https://badge.fury.io/py/pyranges) [![MIT](https://img.shields.io/pypi/l/pyranges.svg?color=green)](https://opensource.org/licenses/MIT) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyranges.svg) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/pyranges/README.html)
4
+
5
+ ## Missing:
6
+
7
+ - to_bigwig: needs a rewrite of the pyrle module
8
+
9
+ ## Introduction
10
+
11
+ PyRanges is a Python library specifically designed for efficient and intuitive manipulation of genomics data,
12
+ particularly genomic intervals (like genes, genomic features, or reads).
13
+ The library is optimized for fast querying and manipulation of genomic annotations.
14
+
15
+ *"Finally ... This was what Python badly needed for years."* - Heng Li
16
+
17
+ ## Documentation
18
+
19
+ The pyranges documentation, including installation instructions, API, tutorial, and how-to-pages, will soon become available.
20
+
21
+ ## Features
22
+
23
+ - fast
24
+ - memory-efficient
25
+ - featureful
26
+ - pythonic/pandastic
27
+ - supports chaining with a terse syntax
28
+ - is a proper subclass of Pandas DataFrames
29
+
30
+ ## Paper/Cite
31
+
32
+ Stovner EB, Sætrom P (2020) PyRanges: efficient comparison of genomic intervals in Python. *Bioinformatics 36(3):918-919* http://dx.doi.org/10.1093/bioinformatics/btz615
33
+
34
+ ## Supporting pyranges
35
+
36
+ - most importantly, cite pyranges if you use it. It is the main metric funding sources care about.
37
+ - use pyranges in Stack Overflow/biostars questions and answers
38
+ - star the repo (possibly important for github visibility and as a proxy for project popularity)
39
+
40
+ ## Asking for help
41
+
42
+ If you encounter bugs, or the documentation is not enough a cannot accomplish a specific task of interest, or if you'd like new features implemented, open an Issue at github: https://github.com/pyranges/pyranges/issues
43
+
44
+ ## Contributing to pyranges
45
+
46
+ Pyranges accepts code contributions in form of pull request. For details, visit https://pyranges.readthedocs.io/developer_guide.html
47
+
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import argparse
4
+ import logging
5
+ import shlex
6
+ import subprocess
7
+ import sys
8
+
9
+ logging.basicConfig(level=logging.INFO)
10
+ LOGGER = logging.getLogger(__name__)
11
+ LOGGER.setLevel(logging.INFO)
12
+
13
+
14
+ parser = argparse.ArgumentParser(description="This script runs various checks and tests.")
15
+ parser.add_argument("-v", "--verbose", action="store_true", help="Show output from programs run.")
16
+ parser.add_argument("-l", "--list", action="store_true", help="List all checks and tests and exits.")
17
+ args = parser.parse_args()
18
+ verbose: bool = args.verbose
19
+ show_checks: bool = args.list
20
+
21
+
22
+ def run_command(command, *, show_output: bool) -> int:
23
+ """Run a shell command and return its exit status."""
24
+ result = subprocess.run(command, capture_output=not show_output, text=True, check=False) # noqa: S603
25
+ return result.returncode
26
+
27
+
28
+ def main() -> int:
29
+ """Run all continuous integration checks."""
30
+ commands = {
31
+ "ruff format": ["ruff", "format", "--check", "--diff", "pyranges"],
32
+ "ruff check": ["ruff", "check", "pyranges"],
33
+ "pyright": ["pyright", "pyranges"],
34
+ "pytest": ["pytest", "--doctest-modules", "pyranges/", "tests/unit/"],
35
+ "more doctest": ["python", "tests/run_doctest_tutorial_howto.py"],
36
+ }
37
+ if show_checks:
38
+ LOGGER.info("Available checks and tests:")
39
+ for task, command in commands.items():
40
+ LOGGER.info(" %s: %s", task, shlex.join(command))
41
+ sys.exit(0)
42
+
43
+ failed_tasks = []
44
+
45
+ for task, command in commands.items():
46
+ LOGGER.debug("Running: %s", shlex.join(command))
47
+ retcode = run_command(command, show_output=verbose)
48
+ if retcode != 0:
49
+ LOGGER.debug("Task %s failed!", task)
50
+ failed_tasks.append(task)
51
+
52
+ if failed_tasks:
53
+ LOGGER.warning("The following tasks failed:")
54
+ for task in failed_tasks:
55
+ LOGGER.warning("%s:\n %s", task, shlex.join(commands[task]))
56
+ return 1
57
+
58
+ LOGGER.debug("All tasks completed successfully.")
59
+ return 0
60
+
61
+
62
+ if __name__ == "__main__":
63
+ sys.exit(main())
@@ -0,0 +1,20 @@
1
+ import pytest
2
+ from hypothesis import settings
3
+
4
+
5
+ @pytest.fixture(autouse=True)
6
+ def set_max_console_width() -> None:
7
+ import pyranges
8
+
9
+ pyranges.options.set_option("console_width", 120)
10
+ # below: edit default dictionary so that reset_option() doesn't screw up testing
11
+ pyranges.options.options_default["console_width"] = (120, pyranges.options.options_in_use["console_width"][1])
12
+
13
+ def pytest_addoption(parser):
14
+ parser.addoption("--derandomize", action="store_true", default=False, help="Derandomize Hypothesis tests")
15
+
16
+
17
+ def pytest_configure(config):
18
+ if config.getoption("--derandomize"):
19
+ settings.register_profile("derandomize", derandomize=True)
20
+ settings.load_profile("derandomize")
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,17 @@
1
+
2
+ API reference
3
+ ~~~~~~~~~~~~~
4
+
5
+ #. :doc:`PyRanges objects <./pyranges_objects>` are the main data structure in pyranges
6
+ #. :doc:`The pyranges module <./pyranges_module>` offer file readers and other utilities
7
+ #. :doc:`Extensions submodules <./pyranges_extensions>` provide additional domain-specific functionalities
8
+ #. :doc:`RangeFrame <./range_frame>` is the parent class of PyRanges, supporting operations on simple intervals
9
+
10
+ .. toctree::
11
+ :maxdepth: 2
12
+ :caption: Contents:
13
+
14
+ pyranges_objects
15
+ pyranges_module
16
+ pyranges_extensions
17
+ range_frame
@@ -0,0 +1,79 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+
9
+ # If extensions (or modules to document with autodoc) are in another directory,
10
+ # add these directories to sys.path here. If the directory is relative to the
11
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
12
+ #
13
+ import os
14
+ import sys
15
+ # sys.path.insert(0, os.path.abspath('.'))
16
+
17
+ # sys.path.insert(0, os.path.abspath('..')) # Adjust this as necessary
18
+ #
19
+ # sys.path.insert(0, os.path.abspath('../pyranges')) # Adjust this as necessary
20
+ #
21
+ # sys.path.insert(0, os.path.abspath('.')) # Adjust this as necessary
22
+
23
+ # -- Project information -----------------------------------------------------
24
+
25
+ project = "pyranges"
26
+ copyright = "2020, Endre Bakken Stovner"
27
+ author = "Endre Bakken Stovner"
28
+
29
+
30
+ # -- General configuration ---------------------------------------------------
31
+
32
+ # Add any Sphinx extension module names here, as strings. They can be
33
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
34
+ # ones.
35
+
36
+
37
+ extensions = [
38
+ "sphinx.ext.napoleon",
39
+ # "sphinxcontrib.napoleon",
40
+ #"autoapi.extension",
41
+ "sphinx.ext.autodoc",
42
+ # "autoapi.extension",
43
+ "sphinx.ext.autosummary",
44
+
45
+ # "sphinx.ext.doctest"
46
+ ]
47
+
48
+ autosummary_generate = True # Enable summary table generation
49
+
50
+
51
+ autodoc_default_options = {
52
+ 'members': True,
53
+ 'imported-members': True,
54
+ # other options...
55
+ }
56
+
57
+ # Add any paths that contain templates here, relative to this directory.
58
+ templates_path = ["_templates"]
59
+
60
+ # List of patterns, relative to source directory, that match files and
61
+ # directories to ignore when looking for source files.
62
+ # This pattern also affects html_static_path and html_extra_path.
63
+ exclude_patterns = []
64
+
65
+ master_doc = "index"
66
+
67
+ # -- Options for HTML output -------------------------------------------------
68
+
69
+ # The theme to use for HTML and HTML Help pages. See the documentation for
70
+ # a list of builtin themes.
71
+ #
72
+ #html_theme = "alabaster"
73
+ html_theme = 'sphinx_rtd_theme'
74
+
75
+
76
+ # Add any paths that contain custom static files (such as style sheets) here,
77
+ # relative to this directory. They are copied after the builtin static files,
78
+ # so a file named "default.css" will overwrite the builtin "default.css".
79
+ html_static_path = ["_static"]