Tested using develop branch but bug appears to also be present in main.
The following snippet calls animal.load_sdf and includes the reference_col keyword argument to signal that the reference_id SDF column should be used to register the HIPPO references:
animal = hippo.HIPPO(f"<TARGET>.sqlite", update_legacy=True)
animal.load_sdf(
target=target_name,
path="<PATH_TO_SDF>",
inspiration_col="inspiration_ids",
reference_col="reference_id",
compound_tags = ["<TAG>"],
pose_tags = ["<TAG>"],
name_col = "ID",
)
However animal.py lines 837-845 (in develop branch):
takes the first rows reference_id and assigns it to the reference variable. The following rows then skip these lines of code because the reference variable is not None. The result is that every pose is assigned to the first row's reference in the DB.
Suggestion:
Change animal.py lines 837-845 (develop branch) to something like this:
if not reference:
ref_str = row.get(reference_col)
if ref_str:
try:
row_reference = int(ref_str)
except ValueError:
row_reference = inspiration_map[ref_str]
else:
row_reference = None
elif isinstance(reference, Pose):
row_reference = reference.id
and lines 891-906 to:
data.append(
dict(
alias=alias,
compound_id=compound_id,
target_id=target.id,
path=pose_path,
metadata=metadata,
inspiration_ids=inspiration_list,
reference_id=row_reference,
mol=mol,
inchikey=inchikey,
smiles=smiles,
energy_score=energy_score,
distance_score=distance_score,
)
)
Note - introduction of row_reference
Tested using develop branch but bug appears to also be present in main.
The following snippet calls
animal.load_sdfand includes thereference_colkeyword argument to signal that thereference_idSDF column should be used to register the HIPPO references:However animal.py lines 837-845 (in develop branch):
takes the first rows
reference_idand assigns it to thereferencevariable. The following rows then skip these lines of code because thereferencevariable is notNone. The result is that every pose is assigned to the first row's reference in the DB.Suggestion:
Change animal.py lines 837-845 (develop branch) to something like this:
and lines 891-906 to:
Note - introduction of
row_reference