genoray-cli 0.1.2__tar.gz → 0.2.0__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.2.0 (2026-02-04)
2
+
3
+ ### Feat
4
+
5
+ - specifying number of threads. fix(perf): write PGEN index without loading it entirely
6
+
1
7
  ## 0.1.2 (2025-11-18)
2
8
 
3
9
  ### Fix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genoray-cli
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Command line interface for genoray
5
5
  Author-email: David Laub <dlaub@ucsd.edu>
6
6
  License: MIT License
@@ -25,9 +25,9 @@ License: MIT License
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
27
  License-File: LICENSE
28
- Requires-Python: <3.13,>=3.9
28
+ Requires-Python: <3.14,>=3.10
29
29
  Requires-Dist: cyclopts
30
- Requires-Dist: genoray
30
+ Requires-Dist: genoray>=2.1.0
31
31
  Description-Content-Type: text/markdown
32
32
 
33
33
  # genoray-cli
@@ -19,7 +19,8 @@ app = App(
19
19
  @app.command
20
20
  def index(source: Path):
21
21
  """Create a genoray index for a VCF or PGEN file."""
22
- from genoray import PGEN, VCF
22
+ from genoray import VCF
23
+ from genoray._pgen import _write_index
23
24
  from genoray._utils import variant_file_type
24
25
 
25
26
  file_type = variant_file_type(source)
@@ -27,7 +28,16 @@ def index(source: Path):
27
28
  vcf = VCF(source)
28
29
  vcf._write_gvi_index()
29
30
  elif file_type == "pgen":
30
- _ = PGEN(source)
31
+ index = source.with_suffix(".pvar")
32
+
33
+ if not index.exists():
34
+ index = source.with_suffix(".pvar.zst")
35
+
36
+ if not index.exists():
37
+ raise FileNotFoundError("No index file found.")
38
+
39
+ index = index.with_suffix(f"{index.suffix}.gvi")
40
+ _write_index(index)
31
41
  else:
32
42
  raise ValueError(f"Unsupported file type: {source}")
33
43
 
@@ -39,6 +49,7 @@ def write(
39
49
  max_mem: str = "1g",
40
50
  overwrite: bool = False,
41
51
  dosages: Union[str, None] = None,
52
+ threads: int | None = None,
42
53
  ) -> None:
43
54
  """
44
55
  Convert a VCF or PGEN file to a SVAR file.
@@ -58,6 +69,8 @@ def write(
58
69
  If `source` is a PGEN, this must be a path to a PGEN of dosages.
59
70
  If `source` is a VCF, this must be the name of the FORMAT field to use for dosages.
60
71
  If not provided, dosages will not be written.
72
+ threads
73
+ Number of threads to use for conversion. Defaults to the number of available CPU cores.
61
74
  """
62
75
  from genoray import PGEN, VCF, SparseVar
63
76
  from genoray._utils import variant_file_type
@@ -69,6 +82,9 @@ def write(
69
82
  else:
70
83
  with_dosages = True
71
84
 
85
+ if threads is None:
86
+ threads = -1
87
+
72
88
  if file_type == "vcf":
73
89
  if dosages is not None and Path(dosages).exists():
74
90
  raise ValueError(
@@ -76,10 +92,14 @@ def write(
76
92
  )
77
93
 
78
94
  vcf = VCF(source, dosage_field=dosages)
79
- SparseVar.from_vcf(out, vcf, max_mem, overwrite, with_dosages=with_dosages)
95
+ SparseVar.from_vcf(
96
+ out, vcf, max_mem, overwrite, with_dosages=with_dosages, n_jobs=threads
97
+ )
80
98
  elif file_type == "pgen":
81
99
  pgen = PGEN(source, dosage_path=dosages)
82
- SparseVar.from_pgen(out, pgen, max_mem, overwrite, with_dosages=with_dosages)
100
+ SparseVar.from_pgen(
101
+ out, pgen, max_mem, overwrite, with_dosages=with_dosages, n_jobs=threads
102
+ )
83
103
  else:
84
104
  raise ValueError(f"Unsupported file type: {source}")
85
105