Skip to content

Commit

Permalink
correct bipartite_type to handle tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
r-trimbour committed Sep 4, 2023
1 parent 4f31767 commit 3e200b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hummuspy/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hummuspy"
version = "0.0.42"
version = "0.0.43"
description = "HuMMuS is a novel method for the inference of regulatory mechanisms from multi-omics data with any type and number of omics, through a heterogeneous multilayer network framework."
authors = ["Rémi Trimbour <[email protected]>"]
license = "GPL-3.0-only"
Expand Down
6 changes: 4 additions & 2 deletions hummuspy/src/hummuspy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,20 +212,22 @@ def general_config(

# if type of bipartites not associated to their names already,
# we create a dict with the same order as the bipartites
if type(bipartites_type) == list:
if type(bipartites_type) == list or type(bipartites_type) == tuple:
print("bipartites_type has been provided throguh a list, make sure " +
"the order matches the one of the 'bipartites' dictionary' keys."
)
temp = dict()
for i in range(len(bipartites)):
temp[list(bipartites.keys())[i]] = bipartites_type[i]
bipartites_type = temp
elif type(bipartites_type) == list:
elif type(bipartites_type) == dict:
assert list(bipartites.keys()).sort() == list(
bipartites_type.keys()).sort(),\
"The keys of the 'bipartites_type' and of the 'bipartites' " +\
"dictionary doesn't seem to match. " + \
"Please provide identical keys for each dictionary."
else:
raise TypeError("bipartites_type should be a list, a tuple or a dictionary")

# we add the bipartites
for bipartite in bipartites:
Expand Down
3 changes: 2 additions & 1 deletion hummuspy/src/hummuspy/explore_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ def get_output_from_dicts(
tf_multiplex: str = 'TF',
peak_multiplex: str = 'peaks',
rna_multiplex: str = 'RNA',
bipartites_type=('00', '00'),
update_config=True,
save=False,
return_df=True,
Expand Down Expand Up @@ -959,7 +960,7 @@ def get_output_from_dicts(
suffix='.tsv',
self_loops=0,
restart_prob=0.7,
bipartites_type=('00', '00'),
bipartites_type=bipartites_type,
save_configfile=False,
config_filename=config_filename)

Expand Down

0 comments on commit 3e200b1

Please sign in to comment.