Skip to content

Commit

Permalink
Specific and minimum logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniekmateusz committed Feb 14, 2025
1 parent 39f2cad commit 13ef252
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ties/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def workdir(self, cwd):
# current directory
self._workdir = pathlib.Path(os.getcwd()) / 'ties'
self._workdir.mkdir(exist_ok=True)
logger.info(f'Working Directory: {self._workdir}')
logger.debug(f'Working Directory: {self._workdir}')

# --------------- general
@property
Expand Down Expand Up @@ -492,7 +492,7 @@ def ligands_contain_q(self):
if ligand_ext in {'.mol2', '.ac', '.prep'}:
# if all charges are 0, then recompute
self._ligands_contain_q = self._guess_ligands_contain_q()
logger.info('Appears that charges are provided based on the filetype .ac/.mol2')
logger.info(f'Existing atom charges detected (filetype .ac/.mol2). ')
elif ligand_ext == '.pdb':
self._ligands_contain_q = False
logger.debug('Assuming that charges are not provided in the given .pdb ligand files. ')
Expand Down
6 changes: 2 additions & 4 deletions ties/ligand.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,8 @@ def antechamber_prepare_mol2(self, **kwargs):
"""
self.config.set_configs(**kwargs)

if self.config.ligands_contain_q:
logger.info('Antechamber: Generating .mol2 file with BCC charges')
if not self.config.antechamber_charge_type:
logger.info('Antechamber: Ignoring atom charges. The user-provided atom charges will be used. ')
if self.config.ligands_contain_q or not self.config.antechamber_charge_type:
logger.info(f'Antechamber: User-provided atom charges will be reused ({self.current.name})')

mol2_cwd = self.config.lig_dir / self.internal_name

Expand Down
10 changes: 5 additions & 5 deletions ties/topology_superimposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ def remove_node_pair(self, node_pair):
for bound_pair, bond_type in bound_pairs:
if bond_type[0] != bond_type[1]:
# fixme - this requires more attention
logger.info('While removing a pair noticed that it has a different bond type')
logger.debug('While removing a pair noticed that it has a different bond type')
# remove their binding to the removed pair
bound_pair_bonds = self.matched_pairs_bonds[bound_pair]
bound_pair_bonds.remove((node_pair, bond_type))
Expand Down Expand Up @@ -3223,7 +3223,7 @@ def superimpose_topologies(top1_nodes,
def take_largest(x, y):
return x if len(x) > len(y) else y
reduce(take_largest, suptops).align_ligands_using_mcs()
logger.info(f'RMSD of the best suptop: {suptops[0].align_ligands_using_mcs()}')
logger.info(f'RMSD of the best overlay: {suptops[0].align_ligands_using_mcs():.2f}')

# fixme - you might not need because we are now doing this on the way back
# if useCoords:
Expand Down Expand Up @@ -3378,7 +3378,7 @@ def take_largest(x, y):

# print a general summary
logger.info('-------- Summary -----------')
logger.info(f'Final number of matched pairs: {len(suptop.matched_pairs)} out of {len(top1_nodes)}L/{len(top2_nodes)}R')
logger.info(f'Number of matched pairs: {len(suptop.matched_pairs)} out of {len(top1_nodes)}L/{len(top2_nodes)}R')
logger.info(f'Disappearing atoms: { (len(top1_nodes) - len(suptop.matched_pairs)) / len(top1_nodes) * 100:.1f}%')
logger.info(f'Appearing atoms: { (len(top2_nodes) - len(suptop.matched_pairs)) / len(top2_nodes) * 100:.1f}%')

Expand Down Expand Up @@ -3656,7 +3656,7 @@ def get_starting_configurations(left_atoms, right_atoms, fraction=0.2, filter_ri
right_count_by_type = sum([1 for right_atom in right_atoms if right_atom.type == atom_type])
per_type_max_counter[atom_type] = min(left_count_by_type, right_count_by_type)
max_overlap_size = sum(per_type_max_counter.values())
logger.info(f'Superimposition - simple max overlap size: {max_overlap_size}')
logger.info(f'Largest MCS size: {max_overlap_size}')

left_atoms_starting = left_atoms_noh[:]
right_atoms_starting = right_atoms_noh[:]
Expand Down Expand Up @@ -3824,7 +3824,7 @@ def _superimpose_topologies(top1_nodes, top2_nodes, mda1_nodes=None, mda2_nodes=
# clean the overlays by removing sub_overlays.
# ie if all atoms in an overlay are found to be a bigger part of another overlay,
# then that overlay is better
logger.info(f"Found altogether overlays {len(suptops)}")
logger.info(f"Found overlays: {len(suptops)}")

# finally, once again, order the suptops and return the best one
suptops = extract_best_suptop(suptops, ignore_coords, weights, get_list=True)
Expand Down

0 comments on commit 13ef252

Please # to comment.