Skip to content

Commit

Permalink
flake8/linter cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed Jan 13, 2025
1 parent 490e8fb commit 78eaa4d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
9 changes: 6 additions & 3 deletions experiments/chem_info/bulk_sims.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@
top_indices = sorted(range(len(similarities)), key=lambda j: -similarities[j])[:6] # Include self
top_neighbors = [
{"query_id": compound_ids[i], "neighbor_id": compound_ids[j], "similarity": similarities[j]}
for j in top_indices if compound_ids[j] != compound_ids[i]
][:5] # Exclude self and limit to top 5
for j in top_indices
if compound_ids[j] != compound_ids[i]
][
:5
] # Exclude self and limit to top 5
results.extend(top_neighbors)

# Convert results to a DataFrame
Expand All @@ -44,4 +47,4 @@
query_id = tox_df[id_column].iloc[1]
query_neighbors_df = neighbors_df[neighbors_df["query_id"] == query_id]
print(f"\nBULK: Neighbors for query ID {query_id}:")
print(query_neighbors_df)
print(query_neighbors_df)
1 change: 0 additions & 1 deletion experiments/chem_info/knn_sims.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Workbench Imports
from workbench.api.df_store import DFStore
from workbench.utils.chem_utils import compute_morgan_fingerprints
Expand Down
6 changes: 2 additions & 4 deletions src/workbench/algorithms/graph/light/proximity_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ def get_neighborhood(self, node_id: Union[str, int], radius: int = 1) -> nx.Grap
if __name__ == "__main__":
from workbench.algorithms.dataframe.fingerprint_proximity import FingerprintProximity
from workbench.web_interface.components.plugins.graph_plot import GraphPlot
from workbench.api import FeatureSet, DFStore, GraphStore
from workbench.api import DFStore, GraphStore
from workbench.utils.chem_utils import compute_morgan_fingerprints


# Example DataFrame for FeaturesProximity
feature_data = {
"id": [1, 2, 3, 4],
Expand Down Expand Up @@ -174,7 +173,7 @@ def get_neighborhood(self, node_id: Union[str, int], radius: int = 1) -> nx.Grap

# Now a real dataset with fingerprints
"""
from workbench.api import FeatureSet
fs = FeatureSet("aqsol_mol_descriptors")
df = fs.pull_dataframe()
df = df.sample(1000)
Expand All @@ -199,7 +198,6 @@ def get_neighborhood(self, node_id: Union[str, int], radius: int = 1) -> nx.Grap
g_store.upsert("test/fingerprint_graph", nx_graph)
"""


# Pull in the tox21 data
tox_df = DFStore().get("/datasets/chem_info/tox21")
tox_df = tox_df.sample(1000)
Expand Down
3 changes: 2 additions & 1 deletion src/workbench/repl/workbench_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,10 @@ def switch_to_direct_meta(self):
def get_meta(self):
return self.meta

def plot_manager(self, data, plot_type: str="table", **kwargs):
def plot_manager(self, data, plot_type: str = "table", **kwargs):
"""Plot Manager for Workbench"""
from workbench.web_interface.components.plugins import ag_table, graph_plot, scatter_plot

if plot_type == "table":
# Check what type of data we have
if isinstance(data, pd.DataFrame):
Expand Down

0 comments on commit 78eaa4d

Please sign in to comment.