Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CodeEntropy/config/arg_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"force_partitioning": {"type": float, "help": "Force partitioning", "default": 0.5},
"water_entropy": {
"type": bool,
"help": "Calculate water entropy",
"default": False,
"help": "If set to False, disables the calculation of water entropy",
"default": True,
},
}

Expand Down
29 changes: 23 additions & 6 deletions CodeEntropy/config/data_logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import re

from tabulate import tabulate

Expand All @@ -23,13 +24,19 @@ def save_dataframes_as_json(self, molecule_df, residue_df, output_file):
with open(output_file, "w") as out:
json.dump(data, out, indent=4)

def add_results_data(self, molecule, level, type, S_molecule):
def clean_residue_name(self, resname):
"""Ensures residue names are stripped and cleaned before being stored"""
return re.sub(r"[-–—]", "", str(resname))

def add_results_data(self, resname, level, entropy_type, value):
"""Add data for molecule-level entries"""
self.molecule_data.append([molecule, level, type, f"{S_molecule}"])
resname = self.clean_residue_name(resname)
self.molecule_data.append((resname, level, entropy_type, value))

def add_residue_data(self, molecule, residue, type, S_trans_residue):
def add_residue_data(self, resid, resname, level, entropy_type, value):
"""Add data for residue-level entries"""
self.residue_data.append([molecule, residue, type, f"{S_trans_residue}"])
resname = self.clean_residue_name(resname)
self.residue_data.append([resid, resname, level, entropy_type, value])

def log_tables(self):
"""Log both tables at once"""
Expand All @@ -38,8 +45,10 @@ def log_tables(self):
logger.info("Molecule Data Table:")
table_str = tabulate(
self.molecule_data,
headers=["Molecule ID", "Level", "Type", "Result (J/mol/K)"],
headers=["Residue Name", "Level", "Type", "Result (J/mol/K)"],
tablefmt="grid",
numalign="center",
stralign="center",
)
logger.info(f"\n{table_str}")

Expand All @@ -48,7 +57,15 @@ def log_tables(self):
logger.info("Residue Data Table:")
table_str = tabulate(
self.residue_data,
headers=["Molecule ID", "Residue", "Type", "Result (J/mol/K)"],
headers=[
"Residue ID",
"Residue Name",
"Level",
"Type",
"Result (J/mol/K)",
],
tablefmt="grid",
numalign="center",
stralign="center",
)
logger.info(f"\n{table_str}")
Loading