bedspec 0.2.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 (57) hide show
  1. bedspec-0.2.0/CONTRIBUTING.md +39 -0
  2. bedspec-0.2.0/LICENSE +21 -0
  3. bedspec-0.2.0/PKG-INFO +110 -0
  4. bedspec-0.2.0/README.md +86 -0
  5. bedspec-0.2.0/bedspec/__init__.py +18 -0
  6. bedspec-0.2.0/bedspec/_bedspec.py +444 -0
  7. bedspec-0.2.0/bedspec/py.typed +0 -0
  8. bedspec-0.2.0/build.py +26 -0
  9. bedspec-0.2.0/cgranges/.git +1 -0
  10. bedspec-0.2.0/cgranges/.gitignore +4 -0
  11. bedspec-0.2.0/cgranges/LICENSE.txt +23 -0
  12. bedspec-0.2.0/cgranges/MANIFEST.in +1 -0
  13. bedspec-0.2.0/cgranges/Makefile +13 -0
  14. bedspec-0.2.0/cgranges/README.md +133 -0
  15. bedspec-0.2.0/cgranges/cgranges.c +330 -0
  16. bedspec-0.2.0/cgranges/cgranges.h +87 -0
  17. bedspec-0.2.0/cgranges/cpp/IITree.h +110 -0
  18. bedspec-0.2.0/cgranges/cpp/IITreeBFS.h +87 -0
  19. bedspec-0.2.0/cgranges/cpp/Makefile +5 -0
  20. bedspec-0.2.0/cgranges/cpp/example.cpp +16 -0
  21. bedspec-0.2.0/cgranges/example.c +21 -0
  22. bedspec-0.2.0/cgranges/khash.h +627 -0
  23. bedspec-0.2.0/cgranges/python/README.rst +9 -0
  24. bedspec-0.2.0/cgranges/python/cgranges.c +11571 -0
  25. bedspec-0.2.0/cgranges/python/cgranges.pyx +70 -0
  26. bedspec-0.2.0/cgranges/setup.py +51 -0
  27. bedspec-0.2.0/cgranges/test/3rd-party/AIList/AIList.c +400 -0
  28. bedspec-0.2.0/cgranges/test/3rd-party/AIList/AIList.h +40 -0
  29. bedspec-0.2.0/cgranges/test/3rd-party/AITree/AITree.c +187 -0
  30. bedspec-0.2.0/cgranges/test/3rd-party/AITree/compiler.h +15 -0
  31. bedspec-0.2.0/cgranges/test/3rd-party/AITree/interval_tree.c +12 -0
  32. bedspec-0.2.0/cgranges/test/3rd-party/AITree/interval_tree.h +27 -0
  33. bedspec-0.2.0/cgranges/test/3rd-party/AITree/interval_tree_generic.h +193 -0
  34. bedspec-0.2.0/cgranges/test/3rd-party/AITree/rbtree.c +549 -0
  35. bedspec-0.2.0/cgranges/test/3rd-party/AITree/rbtree.h +108 -0
  36. bedspec-0.2.0/cgranges/test/3rd-party/AITree/rbtree_augmented.h +245 -0
  37. bedspec-0.2.0/cgranges/test/3rd-party/NCList/intervaldb.c +658 -0
  38. bedspec-0.2.0/cgranges/test/3rd-party/NCList/intervaldb.h +189 -0
  39. bedspec-0.2.0/cgranges/test/3rd-party/README.md +1 -0
  40. bedspec-0.2.0/cgranges/test/IntervalTree.h +345 -0
  41. bedspec-0.2.0/cgranges/test/Makefile +29 -0
  42. bedspec-0.2.0/cgranges/test/bedcov-cr.c +112 -0
  43. bedspec-0.2.0/cgranges/test/bedcov-cr.js +108 -0
  44. bedspec-0.2.0/cgranges/test/bedcov-cr.py +32 -0
  45. bedspec-0.2.0/cgranges/test/bedcov-cr1.py +42 -0
  46. bedspec-0.2.0/cgranges/test/bedcov-cr2.py +32 -0
  47. bedspec-0.2.0/cgranges/test/bedcov-iitree.cpp +127 -0
  48. bedspec-0.2.0/cgranges/test/bedcov-itree.cpp +131 -0
  49. bedspec-0.2.0/cgranges/test/bedcov-naive.js +125 -0
  50. bedspec-0.2.0/cgranges/test/bedcov-ncls.py +43 -0
  51. bedspec-0.2.0/cgranges/test/bedcov-py-iitree.py +158 -0
  52. bedspec-0.2.0/cgranges/test/bedcov-qs.py +33 -0
  53. bedspec-0.2.0/cgranges/test/kseq.h +147 -0
  54. bedspec-0.2.0/cgranges/test/test1.bed +4 -0
  55. bedspec-0.2.0/cgranges/test/test2.bed +3 -0
  56. bedspec-0.2.0/pyproject.toml +117 -0
  57. bedspec-0.2.0/setup.py +32 -0
@@ -0,0 +1,39 @@
1
+ # Development and Testing
2
+
3
+ ## Local Installation
4
+
5
+ First install the Python packaging and dependency management tool [`poetry`](https://python-poetry.org/docs/#installation).
6
+ You must have Python 3.12 or greater available on your system path, which could be managed by [`pyenv`](https://github.com/pyenv/pyenv) or another package manager.
7
+ Finally, install the dependencies of the project with:
8
+
9
+ ```console
10
+ poetry install
11
+ ```
12
+
13
+ ## Running Tests
14
+
15
+ To test the codebase, run the following command:
16
+
17
+ ```console
18
+ poetry run pytest
19
+ ```
20
+
21
+ The command will:
22
+
23
+ - Execute unit tests with [`pytest`](https://docs.pytest.org/)
24
+ - Test the language typing with [`mypy`](https://mypy-lang.org/)
25
+ - Test for linting and styling errors with [`ruff`](https://docs.astral.sh/ruff/)
26
+ - Emit a testing coverage report with [`coverage`](https://coverage.readthedocs.io/)
27
+
28
+ To format the code in the library, run the following commands:
29
+
30
+ ```console
31
+ poetry run ruff check --select I --fix
32
+ poetry run ruff format bedspec tests
33
+ ```
34
+
35
+ To generate a code coverage report locally, run the following command:
36
+
37
+ ```console
38
+ poetry run coverage html
39
+ ```
bedspec-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2024 Clint Valentine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
bedspec-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.1
2
+ Name: bedspec
3
+ Version: 0.2.0
4
+ Summary: An HTS-specs compliant BED toolkit.
5
+ Home-page: https://github.com/clintval/bedspec
6
+ License: MIT
7
+ Keywords: bioinformatics
8
+ Author: Clint Valentine
9
+ Author-email: valentine.clint@gmail.com
10
+ Requires-Python: >=3.12,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
19
+ Classifier: Topic :: Software Development :: Documentation
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Project-URL: Repository, https://github.com/clintval/bedspec
22
+ Description-Content-Type: text/markdown
23
+
24
+ # bedspec
25
+
26
+ [![PyPi Release](https://badge.fury.io/py/bedspec.svg)](https://badge.fury.io/py/bedspec)
27
+ [![CI](https://github.com/clintval/bedspec/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/clintval/bedspec/actions/workflows/tests.yml?query=branch%3Amain)
28
+ [![Python Versions](https://img.shields.io/badge/python-3.12-blue)](https://github.com/clintval/bedspec)
29
+ [![MyPy Checked](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
30
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
31
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
32
+
33
+ An HTS-specs compliant BED toolkit.
34
+
35
+ ## Installation
36
+
37
+ The package can be installed with `pip`:
38
+
39
+ ```console
40
+ pip install bedspec
41
+ ```
42
+
43
+ ## Quickstart
44
+
45
+ ### Writing
46
+
47
+ ```python
48
+ from bedspec import BedWriter, Bed3
49
+
50
+ bed = Bed3("chr1", start=2, end=8)
51
+
52
+ with BedWriter(open("test.bed", "w")) as writer:
53
+ writer.write(bed)
54
+ ```
55
+
56
+ ### Reading
57
+
58
+ ```python
59
+ from bedspec import BedReader, Bed3
60
+
61
+ with BedReader[Bed3](open("test.bed")) as reader:
62
+ for bed in reader:
63
+ print(bed)
64
+ ```
65
+ ```console
66
+ Bed3(contig="chr1", start=2, start=8)
67
+ ```
68
+
69
+ ### BED Types
70
+
71
+ This package provides pre-defined classes for the following BED formats:
72
+
73
+ ```python
74
+ from bedspec import Bed2
75
+ from bedspec import Bed3
76
+ from bedspec import Bed4
77
+ from bedspec import Bed5
78
+ from bedspec import Bed6
79
+ from bedspec import BedPE
80
+ ```
81
+
82
+ ### Custom BED Types
83
+
84
+ To create a custom BED record, inherit from the relevent BED-type:
85
+
86
+ | Type | Description |
87
+ | --- | --- |
88
+ | `PointBed` | BED records that are a single point (1-length) only. |
89
+ | `SimpleBed` | BED records that are a single interval. |
90
+ | `PairBed` | BED records that are a pair of intervals. |
91
+
92
+ For example, to create a custom BED3+1 class:
93
+
94
+ ```python
95
+ from dataclasses import dataclass
96
+
97
+ from bedspec import SimpleBed
98
+
99
+ @dataclass
100
+ class MyCustomBed(SimpleBed):
101
+ contig: str
102
+ start: int
103
+ end: int
104
+ my_custom_field: float
105
+ ```
106
+
107
+ ## Development and Testing
108
+
109
+ See the [contributing guide](./CONTRIBUTING.md) for more information.
110
+
@@ -0,0 +1,86 @@
1
+ # bedspec
2
+
3
+ [![PyPi Release](https://badge.fury.io/py/bedspec.svg)](https://badge.fury.io/py/bedspec)
4
+ [![CI](https://github.com/clintval/bedspec/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/clintval/bedspec/actions/workflows/tests.yml?query=branch%3Amain)
5
+ [![Python Versions](https://img.shields.io/badge/python-3.12-blue)](https://github.com/clintval/bedspec)
6
+ [![MyPy Checked](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7
+ [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
8
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
9
+
10
+ An HTS-specs compliant BED toolkit.
11
+
12
+ ## Installation
13
+
14
+ The package can be installed with `pip`:
15
+
16
+ ```console
17
+ pip install bedspec
18
+ ```
19
+
20
+ ## Quickstart
21
+
22
+ ### Writing
23
+
24
+ ```python
25
+ from bedspec import BedWriter, Bed3
26
+
27
+ bed = Bed3("chr1", start=2, end=8)
28
+
29
+ with BedWriter(open("test.bed", "w")) as writer:
30
+ writer.write(bed)
31
+ ```
32
+
33
+ ### Reading
34
+
35
+ ```python
36
+ from bedspec import BedReader, Bed3
37
+
38
+ with BedReader[Bed3](open("test.bed")) as reader:
39
+ for bed in reader:
40
+ print(bed)
41
+ ```
42
+ ```console
43
+ Bed3(contig="chr1", start=2, start=8)
44
+ ```
45
+
46
+ ### BED Types
47
+
48
+ This package provides pre-defined classes for the following BED formats:
49
+
50
+ ```python
51
+ from bedspec import Bed2
52
+ from bedspec import Bed3
53
+ from bedspec import Bed4
54
+ from bedspec import Bed5
55
+ from bedspec import Bed6
56
+ from bedspec import BedPE
57
+ ```
58
+
59
+ ### Custom BED Types
60
+
61
+ To create a custom BED record, inherit from the relevent BED-type:
62
+
63
+ | Type | Description |
64
+ | --- | --- |
65
+ | `PointBed` | BED records that are a single point (1-length) only. |
66
+ | `SimpleBed` | BED records that are a single interval. |
67
+ | `PairBed` | BED records that are a pair of intervals. |
68
+
69
+ For example, to create a custom BED3+1 class:
70
+
71
+ ```python
72
+ from dataclasses import dataclass
73
+
74
+ from bedspec import SimpleBed
75
+
76
+ @dataclass
77
+ class MyCustomBed(SimpleBed):
78
+ contig: str
79
+ start: int
80
+ end: int
81
+ my_custom_field: float
82
+ ```
83
+
84
+ ## Development and Testing
85
+
86
+ See the [contributing guide](./CONTRIBUTING.md) for more information.
@@ -0,0 +1,18 @@
1
+ # ruff: noqa: F401
2
+ from ._bedspec import COMMENT_PREFIXES
3
+ from ._bedspec import MISSING_FIELD
4
+ from ._bedspec import Bed2
5
+ from ._bedspec import Bed3
6
+ from ._bedspec import Bed4
7
+ from ._bedspec import Bed5
8
+ from ._bedspec import Bed6
9
+ from ._bedspec import BedColor
10
+ from ._bedspec import BedPE
11
+ from ._bedspec import BedReader
12
+ from ._bedspec import BedStrand
13
+ from ._bedspec import BedType
14
+ from ._bedspec import BedWriter
15
+ from ._bedspec import PairBed
16
+ from ._bedspec import PointBed
17
+ from ._bedspec import SimpleBed
18
+ from ._bedspec import Stranded