Skip to content

Commit 2e39e04

Browse files
author
David Prihoda
committed
Fix ovo init when new OVO_HOME is set
1 parent e84fd39 commit 2e39e04

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

ovo/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ def get_scheduler(scheduler_key: str) -> Scheduler:
8181
# Additional imports at the bottom to avoid circular dependencies
8282
from ovo.core.logic import design_logic, descriptor_logic, job_logic, project_logic, import_export_logic
8383

84-
except OVONotInitializedError:
84+
except OVONotInitializedError as e:
8585
if ("init" in sys.argv and "home" in sys.argv) or "-h" in sys.argv or "--help" in sys.argv:
8686
# Ignore initialization error if we are initializing the home dir
8787
pass
8888
else:
89-
message = "\n[green]OVO_HOME[/green] env variable not set.\n"
90-
91-
if shell_config_path := get_shell_config_path():
92-
with open(shell_config_path, "r") as f:
93-
contents = f.read()
94-
if "OVO_HOME" in contents:
95-
message += (
96-
f"\nLooks like you have already initialized OVO and added [green]OVO_HOME[/green] "
97-
f"to your {os.path.basename(shell_config_path)}, please run:\n" + get_source_command()
98-
)
99-
else:
100-
message += (
101-
"\nPlease initialize OVO using [bold]ovo init home[/bold] or set [green]OVO_HOME[/green] env var."
102-
)
89+
if os.getenv("OVO_HOME"):
90+
message = str(e)
91+
else:
92+
message = (
93+
"\nPlease initialize OVO using [bold]ovo init home[/bold] or set [green]OVO_HOME[/green] env var."
94+
)
95+
if shell_config_path := get_shell_config_path():
96+
with open(shell_config_path, "r") as f:
97+
contents = f.read()
98+
if "OVO_HOME" in contents:
99+
message = (
100+
f"\n[green]OVO_HOME[/green] env variable not set.\nLooks like you have already initialized OVO and added [green]OVO_HOME[/green] "
101+
f"to your {os.path.basename(shell_config_path)}, please run:\n" + get_source_command()
102+
)
103103
console.print(Panel.fit(message, title="⚠️ OVO not initialized", border_style="red"))
104104
sys.exit(2)

ovo/app/pages/rfdiffusion/binder_design.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def intro_step():
100100
- Percentage of individual amino acids
101101
- Charge at pH 7.4 and 5.5, isoelectric point
102102
- Aromaticity
103-
- Sequence entropy, highlighting repetitive sequences
103+
- Sequence entropy, highlighting sequences with compositionally biased regions
104104
- And more; computed using BioPython ProteinAnalysis<sup>[4]</sup>
105105
106106
#### Rosetta descriptors<sup>[2]</sup>

ovo/app/pages/rfdiffusion/scaffold_design.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def intro_step():
8686
8787
- Percentage of individual amino acids
8888
- Charge at pH 7.4 and 5.5, isoelectric point
89-
- Sequence entropy, highlighting repetitive sequences
89+
- Sequence entropy, highlighting sequences with compositionally biased regions
9090
- Aromaticity
9191
- And more; computed using BioPython ProteinAnalysis<sup>[6]</sup>
9292

ovo/cli/init.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def home(
120120
All paths can be customized later in the [bold]config.yml[/bold] file.
121121
""")
122122
home_dir = yes or Prompt.ask(
123-
prompt="Enter path, or press [bold]Enter[/bold] to select the default", default=DEFAULT_OVO_HOME
123+
prompt="Enter path, or press [bold]Enter[/bold] to select the default",
124+
default=os.getenv("OVO_HOME", DEFAULT_OVO_HOME), # Use OVO_HOME env var if set already
124125
)
125126

126127
home_dir = os.path.abspath(os.path.expanduser(home_dir))

ovo/core/configuration.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ def load_config(home_dir: str) -> OVOConfig:
273273
if not os.path.exists(home_dir) or not os.path.exists(config_path):
274274
# Config dir does not exist yet, print error and exit
275275
if home_dir != DEFAULT_OVO_HOME:
276+
# Custom OVO_HOME set but invalid
276277
if not os.path.exists(home_dir):
277-
raise OVOCliError(f"OVO_HOME directory does not exist: {home_dir}")
278+
raise OVONotInitializedError(f"OVO_HOME directory set but is not accessible: {home_dir}")
278279
else:
279-
raise OVOCliError(f"OVO config file not found in OVO_HOME: {home_dir}")
280+
raise OVONotInitializedError(f"OVO config file not found in OVO_HOME: {home_dir}")
280281
else:
281-
raise OVONotInitializedError()
282+
# Default OVO_HOME, raise not initialized error
283+
raise OVONotInitializedError("OVO not initialized")
282284

283285
console.print(f"[bold]OVO home[/bold] [green]{home_dir}[/green]")
284286

ovo/core/database/descriptors_proteinqc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454

455455
ENTROPY = NumericGlobalDescriptor(
456456
name="Sequence entropy",
457-
description="Diversity/orderedness of amino acids in a protein sequence; high values = more variety, low values = more repetition. For each overlapping 21-residue window (if sequence is longer than 21), the binary Shannon entropy of the amino acid composition is calculated and averaged to produce a single metric for the sequence. A sequence of identical amino acids has entropy 0, while a sequence with a uniform distribution of all 20 amino acids in each segment reaches log2(20) ~ 4.32.",
457+
description="Diversity/orderedness of amino acids in a protein sequence; high values = more variety, low values = more compositional bias. For each overlapping 21-residue window (if sequence is longer than 21), the binary Shannon entropy of the amino acid composition is calculated and averaged to produce a single metric for the sequence. A sequence of identical amino acids has entropy 0, while a sequence with a uniform distribution of all 20 amino acids in each segment reaches log2(20) ~ 4.32.",
458458
tool="Sequence composition",
459459
key="proteinqc|seq_composition|avg_entropy",
460460
comparison="higher_is_better",

0 commit comments

Comments
 (0)