genoray-cli 0.1.1__tar.gz → 0.1.2__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.
@@ -1,3 +1,9 @@
1
+ ## 0.1.2 (2025-11-18)
2
+
3
+ ### Fix
4
+
5
+ - type hints and dosage arg
6
+
1
7
  ## 0.1.1 (2025-11-13)
2
8
 
3
9
  ### Fix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genoray-cli
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Command line interface for genoray
5
5
  Author-email: David Laub <dlaub@ucsd.edu>
6
6
  License: MIT License
@@ -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: bool | str | None = None,
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. If :code:`source` is a PGEN, this must be a path to a PGEN of dosages.
57
- If :code:`source` is a VCF, this must be the name of the FORMAT field to use for dosages.
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: