genoray-cli 0.1.1__py3-none-any.whl → 0.1.2__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/__main__.py +6 -15
- {genoray_cli-0.1.1.dist-info → genoray_cli-0.1.2.dist-info}/METADATA +1 -1
- genoray_cli-0.1.2.dist-info/RECORD +7 -0
- genoray_cli-0.1.1.dist-info/RECORD +0 -7
- {genoray_cli-0.1.1.dist-info → genoray_cli-0.1.2.dist-info}/WHEEL +0 -0
- {genoray_cli-0.1.1.dist-info → genoray_cli-0.1.2.dist-info}/entry_points.txt +0 -0
- {genoray_cli-0.1.1.dist-info → genoray_cli-0.1.2.dist-info}/licenses/LICENSE +0 -0
genoray_cli/__main__.py
CHANGED
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from importlib.metadata import version
|
|
6
6
|
from pathlib import Path
|
|
7
|
+
from typing import Union
|
|
7
8
|
|
|
8
9
|
from cyclopts import App
|
|
9
10
|
|
|
@@ -37,7 +38,7 @@ def write(
|
|
|
37
38
|
out: Path,
|
|
38
39
|
max_mem: str = "1g",
|
|
39
40
|
overwrite: bool = False,
|
|
40
|
-
dosages:
|
|
41
|
+
dosages: Union[str, None] = None,
|
|
41
42
|
) -> None:
|
|
42
43
|
"""
|
|
43
44
|
Convert a VCF or PGEN file to a SVAR file.
|
|
@@ -53,8 +54,10 @@ def write(
|
|
|
53
54
|
overwrite
|
|
54
55
|
Whether to overwrite the output file if it exists.
|
|
55
56
|
dosages
|
|
56
|
-
Whether to write dosages.
|
|
57
|
-
If
|
|
57
|
+
Whether to write dosages.
|
|
58
|
+
If `source` is a PGEN, this must be a path to a PGEN of dosages.
|
|
59
|
+
If `source` is a VCF, this must be the name of the FORMAT field to use for dosages.
|
|
60
|
+
If not provided, dosages will not be written.
|
|
58
61
|
"""
|
|
59
62
|
from genoray import PGEN, VCF, SparseVar
|
|
60
63
|
from genoray._utils import variant_file_type
|
|
@@ -67,11 +70,6 @@ def write(
|
|
|
67
70
|
with_dosages = True
|
|
68
71
|
|
|
69
72
|
if file_type == "vcf":
|
|
70
|
-
if isinstance(dosages, bool):
|
|
71
|
-
raise ValueError(
|
|
72
|
-
"Dosages must be provided as a string for a VCF FORMAT field if the source is a VCF."
|
|
73
|
-
)
|
|
74
|
-
|
|
75
73
|
if dosages is not None and Path(dosages).exists():
|
|
76
74
|
raise ValueError(
|
|
77
75
|
"The `dosages` argument appears to be a path to an existing file, but VCF requires a FORMAT field name."
|
|
@@ -80,13 +78,6 @@ def write(
|
|
|
80
78
|
vcf = VCF(source, dosage_field=dosages)
|
|
81
79
|
SparseVar.from_vcf(out, vcf, max_mem, overwrite, with_dosages=with_dosages)
|
|
82
80
|
elif file_type == "pgen":
|
|
83
|
-
if dosages is False:
|
|
84
|
-
dosages = None
|
|
85
|
-
elif dosages is True:
|
|
86
|
-
raise ValueError(
|
|
87
|
-
"Dosages must be provided as a path to a PGEN if source is a PGEN."
|
|
88
|
-
)
|
|
89
|
-
|
|
90
81
|
pgen = PGEN(source, dosage_path=dosages)
|
|
91
82
|
SparseVar.from_pgen(out, pgen, max_mem, overwrite, with_dosages=with_dosages)
|
|
92
83
|
else:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
genoray_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
genoray_cli/__main__.py,sha256=MsRY1SYTk_OIDPwPcToX1nvvno86HnEpFFl9-IqDvok,2504
|
|
3
|
+
genoray_cli-0.1.2.dist-info/METADATA,sha256=KcBMLujL41z47WFzdpmT4w79IUERlgacKTHN-MMQ8vA,1546
|
|
4
|
+
genoray_cli-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
genoray_cli-0.1.2.dist-info/entry_points.txt,sha256=zEVH4akzYLF810qEzeFM9J9tdcSYXopO_8X8SgCIshw,53
|
|
6
|
+
genoray_cli-0.1.2.dist-info/licenses/LICENSE,sha256=ubiV4_yGkI9lmTqj0wsoakQI38ZaN4qgI_psNvVWpW4,1067
|
|
7
|
+
genoray_cli-0.1.2.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
genoray_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
genoray_cli/__main__.py,sha256=kmKfuqiAPVefh8b7D-ZNWIENNQG-x3klIymFxXxTBdo,2830
|
|
3
|
-
genoray_cli-0.1.1.dist-info/METADATA,sha256=5AuOMhu4upgNzQpBH_94LAx7B5iwhCtUjX0yGGPUlN4,1546
|
|
4
|
-
genoray_cli-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
-
genoray_cli-0.1.1.dist-info/entry_points.txt,sha256=zEVH4akzYLF810qEzeFM9J9tdcSYXopO_8X8SgCIshw,53
|
|
6
|
-
genoray_cli-0.1.1.dist-info/licenses/LICENSE,sha256=ubiV4_yGkI9lmTqj0wsoakQI38ZaN4qgI_psNvVWpW4,1067
|
|
7
|
-
genoray_cli-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|