Skip to content

Commit 1da984f

Browse files
committed
reformat with ruff
1 parent d2a36d2 commit 1da984f

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

chebi_utils/dataset_builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def _count_molecules_per_class(closure: nx.DiGraph, mol_ids: set[str]) -> dict[s
3636
counts[mid] += 1
3737
return dict(counts)
3838

39+
3940
def build_labeled_dataset(
4041
chebi_graph: nx.DiGraph,
4142
molecules: pd.DataFrame,

chebi_utils/obo_extractor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def build_chebi_graph(filepath: str | Path) -> nx.DiGraph:
115115

116116
return graph
117117

118+
118119
def get_hierarchy_subgraph(chebi_graph: nx.DiGraph) -> nx.Graph:
119120
"""Subgraph of ChEBI including only edges corresponding to hierarchical relations (is_a). Also removes nodes that are not connected by any is_a edges to other nodes."""
120121
return chebi_graph.edge_subgraph(

chebi_utils/sdf_extractor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def extract_molecules(filepath: str | Path) -> pd.DataFrame:
166166

167167
return df
168168

169+
169170
if __name__ == "__main__":
170171
df = extract_molecules("data/chebi.sdf.gz")
171-
print(df.head())
172+
print(df.head())

tests/test_dataset_builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def simple_molecules() -> pd.DataFrame:
5656
}
5757
)
5858

59+
5960
class TestBuildLabeledDataset:
6061
def test_returns_dataframe_with_base_columns(self, simple_graph, simple_molecules):
6162
df, labels = build_labeled_dataset(simple_graph, simple_molecules, min_molecules=2)

tests/test_obo_extractor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def test_node_name_attribute(self):
4141

4242
def test_smiles_extracted_from_property_value(self):
4343
g = build_chebi_graph(SAMPLE_OBO)
44-
expected = "COc1cc2c3cc1Oc1c(O)c(OC)cc4c1[C@H](Cc1ccc(O)c(c1)Oc1ccc(cc1)C[C@@H]3N(C)CC2)N(C)CC4"
44+
expected = (
45+
"COc1cc2c3cc1Oc1c(O)c(OC)cc4c1[C@H](Cc1ccc(O)c(c1)Oc1ccc(cc1)C[C@@H]3N(C)CC2)N(C)CC4"
46+
)
4547
assert g.nodes["10"]["smiles"] == expected
4648

4749
def test_smiles_none_when_absent(self):

0 commit comments

Comments
 (0)