Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include robust check for extracting column names for fingerprints #447

Merged
merged 3 commits into from
Dec 13, 2024
Merged
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
9 changes: 6 additions & 3 deletions baybe/utils/chemistry.py
AdrianSosic marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,13 @@ def smiles_to_fingerprint_features(
)
name = f"{encoding.name}_"
prefix = prefix + "_" if prefix else ""
col_names = [
prefix + name + f.split("fingerprint")[1]
for f in fingerprint_encoder.get_feature_names_out()
feature_names_out = fingerprint_encoder.get_feature_names_out()
no_descriptor_names = all("fingerprint" in f for f in feature_names_out)
suffixes = [
f.split("fingerprint")[1] if no_descriptor_names else f
Scienfitz marked this conversation as resolved.
Show resolved Hide resolved
for f in feature_names_out
]
col_names = [prefix + name + suffix for suffix in suffixes]
df = pd.DataFrame(features, columns=col_names, dtype=DTypeFloatNumpy)

return df
Expand Down
Loading