genome-entropy 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.
Files changed (59) hide show
  1. {genome_entropy-0.1.1/src/genome_entropy.egg-info → genome_entropy-0.1.2}/PKG-INFO +4 -3
  2. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/README.md +3 -2
  3. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/pyproject.toml +1 -1
  4. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/estimate_tokens.py +24 -0
  5. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/encoder.py +1 -1
  6. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/logging_config.py +5 -3
  7. {genome_entropy-0.1.1 → genome_entropy-0.1.2/src/genome_entropy.egg-info}/PKG-INFO +4 -3
  8. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_cli_smoke.py +22 -0
  9. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_logging_config.py +0 -14
  10. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/LICENSE +0 -0
  11. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/setup.cfg +0 -0
  12. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/__init__.py +0 -0
  13. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/__init__.py +0 -0
  14. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/__init__.py +0 -0
  15. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/download.py +0 -0
  16. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/encode3di.py +0 -0
  17. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/entropy.py +0 -0
  18. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/orf.py +0 -0
  19. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/run.py +0 -0
  20. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/commands/translate.py +0 -0
  21. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/cli/main.py +0 -0
  22. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/config.py +0 -0
  23. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/__init__.py +0 -0
  24. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/encoding.py +0 -0
  25. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/gpu_utils.py +0 -0
  26. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/multi_gpu.py +0 -0
  27. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/prostt5.py +0 -0
  28. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/token_estimator.py +0 -0
  29. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/encode3di/types.py +0 -0
  30. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/entropy/__init__.py +0 -0
  31. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/entropy/shannon.py +0 -0
  32. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/errors.py +0 -0
  33. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/io/__init__.py +0 -0
  34. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/io/fasta.py +0 -0
  35. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/io/genbank.py +0 -0
  36. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/io/jsonio.py +0 -0
  37. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/orf/__init__.py +0 -0
  38. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/orf/finder.py +0 -0
  39. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/orf/types.py +0 -0
  40. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/pipeline/__init__.py +0 -0
  41. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/pipeline/runner.py +0 -0
  42. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/translate/__init__.py +0 -0
  43. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy/translate/translator.py +0 -0
  44. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy.egg-info/SOURCES.txt +0 -0
  45. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy.egg-info/dependency_links.txt +0 -0
  46. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy.egg-info/entry_points.txt +0 -0
  47. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy.egg-info/requires.txt +0 -0
  48. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/src/genome_entropy.egg-info/top_level.txt +0 -0
  49. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_basic.py +0 -0
  50. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_encoder_methods.py +0 -0
  51. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_entropy.py +0 -0
  52. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_genbank.py +0 -0
  53. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_gpu_discovery.py +0 -0
  54. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_multi_gpu_encoding.py +0 -0
  55. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_orf_finder.py +0 -0
  56. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_prostt5_integration.py +0 -0
  57. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_token_budget_batches.py +0 -0
  58. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_token_estimator.py +0 -0
  59. {genome_entropy-0.1.1 → genome_entropy-0.1.2}/tests/test_translation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genome_entropy
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Quantify information content across multiple biological representations derived from genomic sequences
5
5
  Author-email: Rob Edwards <raedwards@gmail.com>
6
6
  License: MIT
@@ -43,9 +43,10 @@ Dynamic: license-file
43
43
  # genome_entropy
44
44
 
45
45
  [![Edwards Lab](https://img.shields.io/badge/Bioinformatics-EdwardsLab-03A9F4)](https://edwards.flinders.edu.au/)
46
-
46
+ [![DOI](https://zenodo.org/badge/1132511885.svg)](https://doi.org/10.5281/zenodo.18312206)
47
47
  [![Python CI](https://github.com/linsalrob/genome_entropy/workflows/Python%20CI/badge.svg)](https://github.com/linsalrob/genome_entropy/actions)
48
- [![Documentation](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
48
+ [![GH Pages Docs](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
49
+ [![Read The Docs](https://readthedocs.org/projects/orf-entropy/badge/?version=latest)](https://orf-entropy.readthedocs.io/en/latest/?badge=latest)
49
50
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
50
51
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
51
52
 
@@ -1,9 +1,10 @@
1
1
  # genome_entropy
2
2
 
3
3
  [![Edwards Lab](https://img.shields.io/badge/Bioinformatics-EdwardsLab-03A9F4)](https://edwards.flinders.edu.au/)
4
-
4
+ [![DOI](https://zenodo.org/badge/1132511885.svg)](https://doi.org/10.5281/zenodo.18312206)
5
5
  [![Python CI](https://github.com/linsalrob/genome_entropy/workflows/Python%20CI/badge.svg)](https://github.com/linsalrob/genome_entropy/actions)
6
- [![Documentation](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
6
+ [![GH Pages Docs](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
7
+ [![Read The Docs](https://readthedocs.org/projects/orf-entropy/badge/?version=latest)](https://orf-entropy.readthedocs.io/en/latest/?badge=latest)
7
8
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
8
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
10
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "genome_entropy"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Quantify information content across multiple biological representations derived from genomic sequences"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,5 +1,6 @@
1
1
  """Token size estimation command."""
2
2
 
3
+ from pathlib import Path
3
4
  from typing import Optional
4
5
  import traceback
5
6
 
@@ -51,6 +52,17 @@ def estimate_token_size_command(
51
52
  "-b",
52
53
  help="Approximate length of individual proteins (amino acids)",
53
54
  ),
55
+ log_level: str = typer.Option(
56
+ "INFO",
57
+ "--log-level",
58
+ "-l",
59
+ help="Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)",
60
+ ),
61
+ log_file: Optional[Path] = typer.Option(
62
+ None,
63
+ "--log-file",
64
+ help="Path to log file (default: log to STDOUT)",
65
+ ),
54
66
  ) -> None:
55
67
  """Estimate optimal token size for GPU encoding.
56
68
 
@@ -61,8 +73,20 @@ def estimate_token_size_command(
61
73
  The recommended token size is returned as 90% of the maximum for safety.
62
74
  """
63
75
  try:
76
+ from ...config import VALID_LOG_LEVELS
77
+ from ...logging_config import configure_logging
64
78
  from ...encode3di import ProstT5ThreeDiEncoder, estimate_token_size
65
79
 
80
+ # Validate and configure logging
81
+ if log_level.upper() not in VALID_LOG_LEVELS:
82
+ typer.echo(
83
+ f"Error: Invalid log level '{log_level}'. Must be one of: {', '.join(VALID_LOG_LEVELS)}",
84
+ err=True,
85
+ )
86
+ raise typer.Exit(2)
87
+
88
+ configure_logging(level=log_level.upper(), log_file=log_file)
89
+
66
90
  typer.echo("=" * 60)
67
91
  typer.echo("Token Size Estimation")
68
92
  typer.echo("=" * 60)
@@ -117,7 +117,7 @@ class ProstT5ThreeDiEncoder:
117
117
 
118
118
  # only GPUs support half-precision currently; if you want to run on
119
119
  # CPU use full-precision (not recommended, much slower)
120
- _ = self.model.full() if self.device == "cpu" else self.model.half()
120
+ _ = self.model.float() if self.device == "cpu" else self.model.half()
121
121
 
122
122
  def token_budget_batches(
123
123
  self,
@@ -48,12 +48,14 @@ def configure_logging(
48
48
  global _configured, _log_file, _log_level
49
49
 
50
50
  # Convert string level to int if needed
51
+ ori_level = level
51
52
  if isinstance(level, str):
52
53
  level = getattr(logging, level.upper(), logging.INFO)
53
54
 
54
- # Skip if already configured (unless force=True)
55
- if _configured and not force:
56
- return
55
+ # We always reconfigure, whether or not we are forced to.
56
+ # this is now here to prevent an error :)
57
+ if force:
58
+ logging.info("force is deprecated in logging - we always switch levels")
57
59
 
58
60
  # Clear any existing handlers
59
61
  root_logger = logging.getLogger()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genome_entropy
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Quantify information content across multiple biological representations derived from genomic sequences
5
5
  Author-email: Rob Edwards <raedwards@gmail.com>
6
6
  License: MIT
@@ -43,9 +43,10 @@ Dynamic: license-file
43
43
  # genome_entropy
44
44
 
45
45
  [![Edwards Lab](https://img.shields.io/badge/Bioinformatics-EdwardsLab-03A9F4)](https://edwards.flinders.edu.au/)
46
-
46
+ [![DOI](https://zenodo.org/badge/1132511885.svg)](https://doi.org/10.5281/zenodo.18312206)
47
47
  [![Python CI](https://github.com/linsalrob/genome_entropy/workflows/Python%20CI/badge.svg)](https://github.com/linsalrob/genome_entropy/actions)
48
- [![Documentation](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
48
+ [![GH Pages Docs](https://github.com/linsalrob/genome_entropy/workflows/Documentation/badge.svg)](https://linsalrob.github.io/genome_entropy/)
49
+ [![Read The Docs](https://readthedocs.org/projects/orf-entropy/badge/?version=latest)](https://orf-entropy.readthedocs.io/en/latest/?badge=latest)
49
50
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
50
51
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
51
52
 
@@ -93,3 +93,25 @@ def test_estimate_tokens_command_help() -> None:
93
93
  assert "token size" in result.stdout.lower()
94
94
  assert "model" in result.stdout.lower()
95
95
  assert "device" in result.stdout.lower()
96
+ # Remove ANSI codes to check for options
97
+ import re
98
+
99
+ clean_output = re.sub(r"\x1b\[[0-9;]*m", "", result.stdout)
100
+ assert "--log-level" in clean_output
101
+ assert "--log-file" in clean_output
102
+
103
+
104
+ def test_estimate_tokens_log_level_option() -> None:
105
+ """Test that estimate-tokens accepts --log-level option."""
106
+ # Just checking help to ensure the option is recognized
107
+ result = runner.invoke(app, ["estimate-tokens", "--help"])
108
+ assert result.exit_code == 0
109
+ # Remove ANSI codes and check
110
+ import re
111
+
112
+ clean_output = re.sub(r"\x1b\[[0-9;]*m", "", result.stdout)
113
+ assert "--log-level" in clean_output
114
+ # Make sure it describes logging level
115
+ assert (
116
+ "logging level" in result.stdout.lower() or "log level" in result.stdout.lower()
117
+ )
@@ -134,20 +134,6 @@ def test_configure_logging_creates_parent_dirs():
134
134
  assert log_file.parent.exists()
135
135
 
136
136
 
137
- def test_configure_logging_no_reconfigure_without_force():
138
- """Test that logging is not reconfigured without force=True."""
139
- configure_logging(level="INFO", force=True)
140
- initial_level = get_log_level()
141
-
142
- # Try to reconfigure without force (should not change)
143
- configure_logging(level="DEBUG", force=False)
144
- assert get_log_level() == initial_level
145
-
146
- # Reconfigure with force (should change)
147
- configure_logging(level="DEBUG", force=True)
148
- assert get_log_level() == logging.DEBUG
149
-
150
-
151
137
  def test_logging_format():
152
138
  """Test that logging format includes expected components."""
153
139
  with tempfile.TemporaryDirectory() as tmpdir:
File without changes
File without changes