genoray-cli 0.1.0__tar.gz → 0.1.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.
@@ -0,0 +1,11 @@
1
+ ## 0.1.1 (2025-11-13)
2
+
3
+ ### Fix
4
+
5
+ - dosage field handling for SVAR writing
6
+
7
+ ## 0.1.0 (2025-10-09)
8
+
9
+ ### Feat
10
+
11
+ - commit for bumping
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genoray-cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Command line interface for genoray
5
5
  Author-email: David Laub <dlaub@ucsd.edu>
6
6
  License: MIT License
@@ -1,8 +1,9 @@
1
1
  #! /usr/bin/env python
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  from importlib.metadata import version
4
6
  from pathlib import Path
5
- from typing import Optional, Union
6
7
 
7
8
  from cyclopts import App
8
9
 
@@ -36,42 +37,55 @@ def write(
36
37
  out: Path,
37
38
  max_mem: str = "1g",
38
39
  overwrite: bool = False,
39
- dosages: Optional[Union[bool, Path]] = None,
40
+ dosages: bool | str | None = None,
40
41
  ) -> None:
41
42
  """
42
43
  Convert a VCF or PGEN file to a SVAR file.
43
44
 
44
45
  Parameters
45
46
  ----------
46
- source : Path
47
+ source
47
48
  Path to the input VCF or PGEN file.
48
- out : Path
49
+ out
49
50
  Path to the output SVAR file.
50
- max_mem : str, optional
51
+ max_mem
51
52
  Maximum memory to use for conversion e.g. 1g, 250 MB, etc.
52
- overwrite : bool, optional
53
+ overwrite
53
54
  Whether to overwrite the output file if it exists.
54
- dosages : bool | Path | None, optional
55
+ dosages
55
56
  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
+ If :code:`source` is a VCF, this must be the name of the FORMAT field to use for dosages.
57
58
  """
58
59
  from genoray import PGEN, VCF, SparseVar
59
60
  from genoray._utils import variant_file_type
60
61
 
61
62
  file_type = variant_file_type(source)
63
+
64
+ if dosages is None:
65
+ with_dosages = False
66
+ else:
67
+ with_dosages = True
68
+
62
69
  if file_type == "vcf":
63
- vcf = VCF(source)
64
- SparseVar.from_vcf(out, vcf, max_mem, overwrite, with_dosages=dosages)
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
+ if dosages is not None and Path(dosages).exists():
76
+ raise ValueError(
77
+ "The `dosages` argument appears to be a path to an existing file, but VCF requires a FORMAT field name."
78
+ )
79
+
80
+ vcf = VCF(source, dosage_field=dosages)
81
+ SparseVar.from_vcf(out, vcf, max_mem, overwrite, with_dosages=with_dosages)
65
82
  elif file_type == "pgen":
66
83
  if dosages is False:
67
84
  dosages = None
68
- with_dosages = False
69
85
  elif dosages is True:
70
86
  raise ValueError(
71
87
  "Dosages must be provided as a path to a PGEN if source is a PGEN."
72
88
  )
73
- else:
74
- with_dosages = True
75
89
 
76
90
  pgen = PGEN(source, dosage_path=dosages)
77
91
  SparseVar.from_pgen(out, pgen, max_mem, overwrite, with_dosages=with_dosages)
@@ -599,8 +599,8 @@ packages:
599
599
  requires_python: '>=3.9,<3.13'
600
600
  - pypi: ./
601
601
  name: genoray-cli
602
- version: 0.0.0
603
- sha256: b4c947d3fcdbe019bf00a19e26d110b11883b02b36f81b521ff8a1db816a9575
602
+ version: 0.1.0
603
+ sha256: d92e3195943936f36bb161a1469ef5615696138948fc81ba84bcfb8b116e31ee
604
604
  requires_dist:
605
605
  - genoray
606
606
  - cyclopts
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "genoray-cli"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Command line interface for genoray"
5
5
  authors = [{ name = "David Laub", email = "dlaub@ucsd.edu" }]
6
6
  readme = "README.md"
@@ -286,7 +286,7 @@ wheels = [
286
286
 
287
287
  [[package]]
288
288
  name = "genoray-cli"
289
- version = "0.1.0"
289
+ version = "0.1.1"
290
290
  source = { editable = "." }
291
291
  dependencies = [
292
292
  { name = "cyclopts" },
@@ -1,5 +0,0 @@
1
- ## 0.1.0 (2025-10-09)
2
-
3
- ### Feat
4
-
5
- - commit for bumping
File without changes
File without changes
File without changes
File without changes
File without changes