Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pablormier committed Sep 2, 2024
1 parent c3c3c08 commit 245b151
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions corneto/contrib/networkx.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def networkx_to_corneto_graph(G: Union[NxGraph, NxDiGraph]):
for edge in G.edges():
e_data = G.get_edge_data(edge[0], edge[1], default=dict())
Gc.add_edge(edge[0], edge[1], **e_data)
# Also add node attributes
for node, data in G.nodes(data=True):
Gc.add_vertex(node, **data)
return Gc


Expand Down
5 changes: 4 additions & 1 deletion corneto/methods/steiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,13 @@ def exact_steiner_tree(
# TODO: Take as argument, read from graph
if edge_weights is None:
edge_weights = np.array([prop.get("weight", 0) for prop in Gc.get_attr_edges()])
elif isinstance(edge_weights, (list, tuple)):
elif isinstance(edge_weights, (list, tuple, np.ndarray)):
ew = np.zeros(Gc.ne)
ew[: len(edge_weights)] = np.array(edge_weights)
edge_weights = ew
# If is a number, generate a list with the same value for all edges
elif isinstance(edge_weights, (int, float)):
edge_weights = np.array([edge_weights for _ in range(Gc.ne)])
else:
raise ValueError("Unknown type for edge_weights (list or tuple)")

Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
:width: 320px
```

<h3 style="text-align: center; margin-top: 20px;"> Unified Framework for Omics-Driven Network Inference </h3>
<h3 style="text-align: center; margin-top: 20px;"> Unified knowledge-driven network inference from omics data </h3>

CORNETO (Constraint-based Optimization for the Reconstruction of NETworks from Omics) is a package for unified biological network inference and contextualisation from prior knowledge, developed and maintained by the [Saez-Rodriguez Lab](https://saezlab.github.io/) at Heidelberg University.
CORNETO (Constraint-based Optimization for the Reconstruction of NETworks from Omics) is a package for unified biological network inference and contextualisation from prior knowledge, developed and maintained by the [Saez-Rodriguez Lab](https://saezlab.github.io/).

The library is designed with minimal dependencies and is easily extendable, making it a powerful tool for both end-users and developers. To install CORNETO with open-source mathematical solvers (HIGHs and SCIP), use the following command:

Expand Down

0 comments on commit 245b151

Please sign in to comment.