genoray-cli 0.1.0__py3-none-any.whl
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.
genoray_cli/__init__.py
ADDED
|
File without changes
|
genoray_cli/__main__.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional, Union
|
|
6
|
+
|
|
7
|
+
from cyclopts import App
|
|
8
|
+
|
|
9
|
+
app = App(
|
|
10
|
+
help_on_error=True,
|
|
11
|
+
version=f"[magenta]genoray[/magenta] {version('genoray')}\n[cyan]genoray-cli[/cyan] {version('genoray-cli')}",
|
|
12
|
+
version_format="rich",
|
|
13
|
+
help="Tools for genoray, including SVAR files.",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.command
|
|
18
|
+
def index(source: Path):
|
|
19
|
+
"""Create a genoray index for a VCF or PGEN file."""
|
|
20
|
+
from genoray import PGEN, VCF
|
|
21
|
+
from genoray._utils import variant_file_type
|
|
22
|
+
|
|
23
|
+
file_type = variant_file_type(source)
|
|
24
|
+
if file_type == "vcf":
|
|
25
|
+
vcf = VCF(source)
|
|
26
|
+
vcf._write_gvi_index()
|
|
27
|
+
elif file_type == "pgen":
|
|
28
|
+
_ = PGEN(source)
|
|
29
|
+
else:
|
|
30
|
+
raise ValueError(f"Unsupported file type: {source}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@app.command
|
|
34
|
+
def write(
|
|
35
|
+
source: Path,
|
|
36
|
+
out: Path,
|
|
37
|
+
max_mem: str = "1g",
|
|
38
|
+
overwrite: bool = False,
|
|
39
|
+
dosages: Optional[Union[bool, Path]] = None,
|
|
40
|
+
) -> None:
|
|
41
|
+
"""
|
|
42
|
+
Convert a VCF or PGEN file to a SVAR file.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
source : Path
|
|
47
|
+
Path to the input VCF or PGEN file.
|
|
48
|
+
out : Path
|
|
49
|
+
Path to the output SVAR file.
|
|
50
|
+
max_mem : str, optional
|
|
51
|
+
Maximum memory to use for conversion e.g. 1g, 250 MB, etc.
|
|
52
|
+
overwrite : bool, optional
|
|
53
|
+
Whether to overwrite the output file if it exists.
|
|
54
|
+
dosages : bool | Path | None, optional
|
|
55
|
+
Whether to write dosages. If :code:`source` is a PGEN, this must be a path to a PGEN of dosages.
|
|
56
|
+
If :code:`source` is a VCF, this should be a boolean.
|
|
57
|
+
"""
|
|
58
|
+
from genoray import PGEN, VCF, SparseVar
|
|
59
|
+
from genoray._utils import variant_file_type
|
|
60
|
+
|
|
61
|
+
file_type = variant_file_type(source)
|
|
62
|
+
if file_type == "vcf":
|
|
63
|
+
vcf = VCF(source)
|
|
64
|
+
SparseVar.from_vcf(out, vcf, max_mem, overwrite, with_dosages=dosages)
|
|
65
|
+
elif file_type == "pgen":
|
|
66
|
+
if dosages is False:
|
|
67
|
+
dosages = None
|
|
68
|
+
with_dosages = False
|
|
69
|
+
elif dosages is True:
|
|
70
|
+
raise ValueError(
|
|
71
|
+
"Dosages must be provided as a path to a PGEN if source is a PGEN."
|
|
72
|
+
)
|
|
73
|
+
else:
|
|
74
|
+
with_dosages = True
|
|
75
|
+
|
|
76
|
+
pgen = PGEN(source, dosage_path=dosages)
|
|
77
|
+
SparseVar.from_pgen(out, pgen, max_mem, overwrite, with_dosages=with_dosages)
|
|
78
|
+
else:
|
|
79
|
+
raise ValueError(f"Unsupported file type: {source}")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
app()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: genoray-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command line interface for genoray
|
|
5
|
+
Author-email: David Laub <dlaub@ucsd.edu>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 David Laub
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Python: <3.13,>=3.9
|
|
29
|
+
Requires-Dist: cyclopts
|
|
30
|
+
Requires-Dist: genoray
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# genoray-cli
|
|
34
|
+
CLI for genoray
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
genoray_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
genoray_cli/__main__.py,sha256=plHNL0CBZkzFDegi2mXXcIVrtHnF0vBPZh5SikeXqlA,2430
|
|
3
|
+
genoray_cli-0.1.0.dist-info/METADATA,sha256=3oUsBcWj4FTbIDWjnpeB3o5FgHtRHINUuTUjha3n42E,1546
|
|
4
|
+
genoray_cli-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
genoray_cli-0.1.0.dist-info/entry_points.txt,sha256=zEVH4akzYLF810qEzeFM9J9tdcSYXopO_8X8SgCIshw,53
|
|
6
|
+
genoray_cli-0.1.0.dist-info/licenses/LICENSE,sha256=ubiV4_yGkI9lmTqj0wsoakQI38ZaN4qgI_psNvVWpW4,1067
|
|
7
|
+
genoray_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Laub
|
|
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.
|