bam2tensor 0.0.1__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.
- bam2tensor-0.0.1/LICENSE +21 -0
- bam2tensor-0.0.1/PKG-INFO +109 -0
- bam2tensor-0.0.1/README.md +88 -0
- bam2tensor-0.0.1/pyproject.toml +117 -0
- bam2tensor-0.0.1/src/bam2tensor/__init__.py +1 -0
- bam2tensor-0.0.1/src/bam2tensor/__main__.py +12 -0
- bam2tensor-0.0.1/src/bam2tensor/functions.py +35 -0
- bam2tensor-0.0.1/src/bam2tensor/py.typed +0 -0
bam2tensor-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2023 Nick Semenkovich \<semenko@alum.mit.edu\>
|
|
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.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bam2tensor
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Bam2Tensor
|
|
5
|
+
Home-page: https://github.com/mcwdsi/bam2tensor
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: Nick Semenkovich
|
|
8
|
+
Author-email: semenko@alum.mit.edu
|
|
9
|
+
Requires-Python: >=3.9,<4.0
|
|
10
|
+
Classifier: Development Status :: 1 - Planning
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Requires-Dist: click (>=8.0.1)
|
|
17
|
+
Project-URL: Changelog, https://github.com/mcwdsi/bam2tensor/releases
|
|
18
|
+
Project-URL: Documentation, https://mcwdsi.github.io/bam2tensor
|
|
19
|
+
Project-URL: Repository, https://github.com/mcwdsi/bam2tensor
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Bam2Tensor
|
|
23
|
+
|
|
24
|
+
[][pypi status]
|
|
25
|
+
[][pypi status]
|
|
26
|
+
[][pypi status]
|
|
27
|
+
[][license]
|
|
28
|
+
|
|
29
|
+
[][documentation]
|
|
30
|
+
[][tests]
|
|
31
|
+
[][sonarcov]
|
|
32
|
+
[][sonarquality]
|
|
33
|
+
|
|
34
|
+
[][pre-commit]
|
|
35
|
+
[][black]
|
|
36
|
+
[](https://github.com/astral-sh/ruff)
|
|
37
|
+
[][poetry]
|
|
38
|
+
|
|
39
|
+
[pypi status]: https://pypi.org/project/bam2tensor/
|
|
40
|
+
[documentation]: https://mcwdsi.github.io/bam2tensor
|
|
41
|
+
[tests]: https://github.com/mcwdsi/bam2tensor/actions?workflow=Tests
|
|
42
|
+
|
|
43
|
+
[sonarcov]: https://sonarcloud.io/summary/overall?id=mcwdsi_bam2tensor
|
|
44
|
+
[sonarquality]: https://sonarcloud.io/summary/overall?id=mcwdsi_bam2tensor
|
|
45
|
+
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
46
|
+
[black]: https://github.com/psf/black
|
|
47
|
+
[poetry]: https://python-poetry.org/
|
|
48
|
+
|
|
49
|
+
bam2tensor is a Python package for converting .bam files to dense representations of methylation data (as .npz NumPy arrays). It is designed to evaluate all CpG sites and store methylation states for loading into other deep learning pipelines.
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
- Parses .bam files using [pysam](https://github.com/pysam-developers/pysam)
|
|
53
|
+
- Extracts methylation data from all CpG sites
|
|
54
|
+
- Easily parallelizable
|
|
55
|
+
- Supports any genome (Hg38, T2T-CHM13, mm10, etc.)
|
|
56
|
+
- Stores methylation data as .npz NumPy arrays
|
|
57
|
+
- Stores data in sparse format (COO matrix) for efficient loading
|
|
58
|
+
|
|
59
|
+
## Requirements
|
|
60
|
+
|
|
61
|
+
- Python 3.8+
|
|
62
|
+
- pysam, numpy, scipy, tqdm
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
You can install _Bam2Tensor_ via [pip] from [PyPI]:
|
|
67
|
+
|
|
68
|
+
```console
|
|
69
|
+
pip install bam2tensor
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
Please see the [Reference Guide] for details.
|
|
75
|
+
|
|
76
|
+
## Contributing
|
|
77
|
+
|
|
78
|
+
Contributions are welcome! Please see the [Contributor Guide].
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
Distributed under the terms of the [MIT license][license],
|
|
83
|
+
_Bam2Tensor_ is free and open source.
|
|
84
|
+
|
|
85
|
+
## Issues
|
|
86
|
+
|
|
87
|
+
If you encounter any problems,
|
|
88
|
+
please [file an issue] along with a detailed description.
|
|
89
|
+
|
|
90
|
+
## Credits
|
|
91
|
+
|
|
92
|
+
This project is developed and maintained by [Nick Semenkovich (@semenko)], as part of the Medical College of Wisconsin's [Data Science Institute].
|
|
93
|
+
|
|
94
|
+
This project was generated from [Statistics Norway]'s [SSB PyPI Template].
|
|
95
|
+
|
|
96
|
+
[Nick Semenkovich (@semenko)]: https://nick.semenkovich.com/
|
|
97
|
+
[Data Science Institute]: https://www.mcw.edu/departments/data-science-institute
|
|
98
|
+
[statistics norway]: https://www.ssb.no/en
|
|
99
|
+
[pypi]: https://pypi.org/
|
|
100
|
+
[ssb pypi template]: https://github.com/statisticsnorway/ssb-pypitemplate
|
|
101
|
+
[file an issue]: https://github.com/mcwdsi/bam2tensor/issues
|
|
102
|
+
[pip]: https://pip.pypa.io/
|
|
103
|
+
|
|
104
|
+
<!-- github-only -->
|
|
105
|
+
|
|
106
|
+
[license]: https://github.com/mcwdsi/bam2tensor/blob/main/LICENSE
|
|
107
|
+
[contributor guide]: https://github.com/mcwdsi/bam2tensor/blob/main/CONTRIBUTING.md
|
|
108
|
+
[reference guide]: https://mcwdsi.github.io/bam2tensor/reference.html
|
|
109
|
+
q
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Bam2Tensor
|
|
2
|
+
|
|
3
|
+
[][pypi status]
|
|
4
|
+
[][pypi status]
|
|
5
|
+
[][pypi status]
|
|
6
|
+
[][license]
|
|
7
|
+
|
|
8
|
+
[][documentation]
|
|
9
|
+
[][tests]
|
|
10
|
+
[][sonarcov]
|
|
11
|
+
[][sonarquality]
|
|
12
|
+
|
|
13
|
+
[][pre-commit]
|
|
14
|
+
[][black]
|
|
15
|
+
[](https://github.com/astral-sh/ruff)
|
|
16
|
+
[][poetry]
|
|
17
|
+
|
|
18
|
+
[pypi status]: https://pypi.org/project/bam2tensor/
|
|
19
|
+
[documentation]: https://mcwdsi.github.io/bam2tensor
|
|
20
|
+
[tests]: https://github.com/mcwdsi/bam2tensor/actions?workflow=Tests
|
|
21
|
+
|
|
22
|
+
[sonarcov]: https://sonarcloud.io/summary/overall?id=mcwdsi_bam2tensor
|
|
23
|
+
[sonarquality]: https://sonarcloud.io/summary/overall?id=mcwdsi_bam2tensor
|
|
24
|
+
[pre-commit]: https://github.com/pre-commit/pre-commit
|
|
25
|
+
[black]: https://github.com/psf/black
|
|
26
|
+
[poetry]: https://python-poetry.org/
|
|
27
|
+
|
|
28
|
+
bam2tensor is a Python package for converting .bam files to dense representations of methylation data (as .npz NumPy arrays). It is designed to evaluate all CpG sites and store methylation states for loading into other deep learning pipelines.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
- Parses .bam files using [pysam](https://github.com/pysam-developers/pysam)
|
|
32
|
+
- Extracts methylation data from all CpG sites
|
|
33
|
+
- Easily parallelizable
|
|
34
|
+
- Supports any genome (Hg38, T2T-CHM13, mm10, etc.)
|
|
35
|
+
- Stores methylation data as .npz NumPy arrays
|
|
36
|
+
- Stores data in sparse format (COO matrix) for efficient loading
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Python 3.8+
|
|
41
|
+
- pysam, numpy, scipy, tqdm
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
You can install _Bam2Tensor_ via [pip] from [PyPI]:
|
|
46
|
+
|
|
47
|
+
```console
|
|
48
|
+
pip install bam2tensor
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
Please see the [Reference Guide] for details.
|
|
54
|
+
|
|
55
|
+
## Contributing
|
|
56
|
+
|
|
57
|
+
Contributions are welcome! Please see the [Contributor Guide].
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Distributed under the terms of the [MIT license][license],
|
|
62
|
+
_Bam2Tensor_ is free and open source.
|
|
63
|
+
|
|
64
|
+
## Issues
|
|
65
|
+
|
|
66
|
+
If you encounter any problems,
|
|
67
|
+
please [file an issue] along with a detailed description.
|
|
68
|
+
|
|
69
|
+
## Credits
|
|
70
|
+
|
|
71
|
+
This project is developed and maintained by [Nick Semenkovich (@semenko)], as part of the Medical College of Wisconsin's [Data Science Institute].
|
|
72
|
+
|
|
73
|
+
This project was generated from [Statistics Norway]'s [SSB PyPI Template].
|
|
74
|
+
|
|
75
|
+
[Nick Semenkovich (@semenko)]: https://nick.semenkovich.com/
|
|
76
|
+
[Data Science Institute]: https://www.mcw.edu/departments/data-science-institute
|
|
77
|
+
[statistics norway]: https://www.ssb.no/en
|
|
78
|
+
[pypi]: https://pypi.org/
|
|
79
|
+
[ssb pypi template]: https://github.com/statisticsnorway/ssb-pypitemplate
|
|
80
|
+
[file an issue]: https://github.com/mcwdsi/bam2tensor/issues
|
|
81
|
+
[pip]: https://pip.pypa.io/
|
|
82
|
+
|
|
83
|
+
<!-- github-only -->
|
|
84
|
+
|
|
85
|
+
[license]: https://github.com/mcwdsi/bam2tensor/blob/main/LICENSE
|
|
86
|
+
[contributor guide]: https://github.com/mcwdsi/bam2tensor/blob/main/CONTRIBUTING.md
|
|
87
|
+
[reference guide]: https://mcwdsi.github.io/bam2tensor/reference.html
|
|
88
|
+
q
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "bam2tensor"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Bam2Tensor"
|
|
5
|
+
authors = ["Nick Semenkovich <semenko@alum.mit.edu>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
homepage = "https://github.com/mcwdsi/bam2tensor"
|
|
9
|
+
repository = "https://github.com/mcwdsi/bam2tensor"
|
|
10
|
+
documentation = "https://mcwdsi.github.io/bam2tensor"
|
|
11
|
+
classifiers = ["Development Status :: 1 - Planning"]
|
|
12
|
+
|
|
13
|
+
[tool.poetry.urls]
|
|
14
|
+
Changelog = "https://github.com/mcwdsi/bam2tensor/releases"
|
|
15
|
+
|
|
16
|
+
[tool.poetry.dependencies]
|
|
17
|
+
python = "^3.9"
|
|
18
|
+
click = ">=8.0.1"
|
|
19
|
+
|
|
20
|
+
[tool.poetry.group.dev.dependencies]
|
|
21
|
+
pygments = ">=2.10.0"
|
|
22
|
+
black = { extras = ["jupyter"], version = ">=23.1.0" }
|
|
23
|
+
coverage = { extras = ["toml"], version = ">=6.2" }
|
|
24
|
+
darglint = ">=1.8.1"
|
|
25
|
+
furo = ">=2021.11.12"
|
|
26
|
+
mypy = ">=0.930"
|
|
27
|
+
pre-commit = ">=2.16.0"
|
|
28
|
+
pre-commit-hooks = ">=4.1.0"
|
|
29
|
+
ruff = ">=0.0.284"
|
|
30
|
+
pytest = ">=6.2.5"
|
|
31
|
+
sphinx = ">=6.2.1"
|
|
32
|
+
sphinx-autobuild = ">=2021.3.14"
|
|
33
|
+
sphinx-autodoc-typehints = ">=1.24.0"
|
|
34
|
+
sphinx-click = ">=3.0.2"
|
|
35
|
+
typeguard = ">=2.13.3"
|
|
36
|
+
xdoctest = { extras = ["colors"], version = ">=0.15.10" }
|
|
37
|
+
myst-parser = { version = ">=0.16.1" }
|
|
38
|
+
ipykernel = ">=6.0.0"
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
pythonpath = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.poetry.scripts]
|
|
44
|
+
bam2tensor = "bam2tensor.__main__:main"
|
|
45
|
+
|
|
46
|
+
[tool.coverage.paths]
|
|
47
|
+
source = ["src", "*/site-packages"]
|
|
48
|
+
tests = ["tests", "*/tests"]
|
|
49
|
+
|
|
50
|
+
[tool.coverage.run]
|
|
51
|
+
branch = true
|
|
52
|
+
source = ["bam2tensor", "tests"]
|
|
53
|
+
|
|
54
|
+
[tool.coverage.report]
|
|
55
|
+
show_missing = true
|
|
56
|
+
fail_under = 20
|
|
57
|
+
|
|
58
|
+
[tool.mypy]
|
|
59
|
+
strict = true
|
|
60
|
+
warn_unreachable = true
|
|
61
|
+
pretty = true
|
|
62
|
+
show_column_numbers = true
|
|
63
|
+
show_error_context = true
|
|
64
|
+
|
|
65
|
+
[tool.ruff]
|
|
66
|
+
force-exclude = true # Apply excludes to pre-commit
|
|
67
|
+
show-fixes = true
|
|
68
|
+
src = ["src", "tests"]
|
|
69
|
+
target-version = "py39" # Minimum Python version supported
|
|
70
|
+
|
|
71
|
+
# Ruff rules may be customized as desired: https://docs.astral.sh/ruff/rules/
|
|
72
|
+
select = [
|
|
73
|
+
"E", # pycodestyle
|
|
74
|
+
"F", # pyflakes
|
|
75
|
+
]
|
|
76
|
+
ignore = [
|
|
77
|
+
"ANN101", # Supress missing-type-self.
|
|
78
|
+
"D100", # Supress undocumented-public-module. Only doc of public api required.
|
|
79
|
+
"E402", # Supress module-import-not-at-top-of-file, needed in jupyter notebooks.
|
|
80
|
+
"E501", # Supress line-too-long warnings: trust black's judgement on this one.
|
|
81
|
+
]
|
|
82
|
+
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
|
|
83
|
+
extend-exclude = [
|
|
84
|
+
"__pycache__",
|
|
85
|
+
"old",
|
|
86
|
+
".ipynb_checkpoints",
|
|
87
|
+
"noxfile.py",
|
|
88
|
+
"docs/conf.py",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[tool.ruff.isort]
|
|
92
|
+
force-single-line = true
|
|
93
|
+
|
|
94
|
+
[tool.ruff.mccabe]
|
|
95
|
+
max-complexity = 15
|
|
96
|
+
|
|
97
|
+
[tool.ruff.pydocstyle]
|
|
98
|
+
convention = "google" # You can also use "numpy".
|
|
99
|
+
|
|
100
|
+
[tool.ruff.pep8-naming]
|
|
101
|
+
classmethod-decorators = ["classmethod", "validator", "root_validator", "pydantic.validator"]
|
|
102
|
+
|
|
103
|
+
[tool.ruff.per-file-ignores]
|
|
104
|
+
"*/__init__.py" = ["F401"]
|
|
105
|
+
"**/tests/*" = [
|
|
106
|
+
# asserts are encouraged in pytest
|
|
107
|
+
"S101",
|
|
108
|
+
# return annotations don't add value for test functions
|
|
109
|
+
"ANN201",
|
|
110
|
+
# docstrings are overkill for test functions
|
|
111
|
+
"D103",
|
|
112
|
+
"D100",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[build-system]
|
|
116
|
+
requires = ["poetry-core>=1.0.0"]
|
|
117
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Bam2Tensor."""
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""A collection of useful functions.
|
|
2
|
+
|
|
3
|
+
The template and this example uses Google style docstrings as described at:
|
|
4
|
+
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def example_function(number1: int, number2: int) -> str:
|
|
10
|
+
"""Compare two integers.
|
|
11
|
+
|
|
12
|
+
This is merely an example function can be deleted. It is used to show and test generating
|
|
13
|
+
documentation from code, type hinting, testing, and testing examples
|
|
14
|
+
in the code.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
number1: The first number.
|
|
19
|
+
number2: The second number, which will be compared to number1.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
A string describing which number is the greatest.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
Examples should be written in doctest format, and should illustrate how
|
|
26
|
+
to use the function.
|
|
27
|
+
|
|
28
|
+
>>> example_function(1, 2)
|
|
29
|
+
1 is less than 2
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
if number1 < number2:
|
|
33
|
+
return f"{number1} is less than {number2}"
|
|
34
|
+
|
|
35
|
+
return f"{number1} is greater than or equal to {number2}"
|
|
File without changes
|