Skip to content

Commit 59c9dcf

Browse files
committed
Fix issues with pandas any and all that must have keyword argument.
1 parent 75609f9 commit 59c9dcf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

padmet/utils/exploration/dendrogram_reactions_distance.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ def create_intersection_files(root, cluster_leaf_species, reactions_dataframe, o
191191
intersect_ancestor_reactions = []
192192
ancestors = []
193193
for ancestor in element.iterancestors():
194-
ancestor_reactions = reactions_dataframe[reactions_dataframe[cluster_leaf_species[ancestor.tag]].all(1)==True]
194+
ancestor_reactions = reactions_dataframe[reactions_dataframe[cluster_leaf_species[ancestor.tag]].all(axis=1)==True]
195195
intersect_ancestor_reactions.extend(ancestor_reactions.index.tolist())
196196
ancestors.append(ancestor.tag)
197-
element_reactions = reactions_dataframe[reactions_dataframe[cluster_leaf_species[element.tag]].all(1)==True]
197+
element_reactions = reactions_dataframe[reactions_dataframe[cluster_leaf_species[element.tag]].all(axis=1)==True]
198198
# Option to select only reactions present in our subgroup and not in other species.
199-
#element_reactions = element_reactions[element_reactions[list(set(reactions_dataframe.columns.tolist()) - set(cluster_leaf_species[element.tag]))].any(1)==False]
199+
#element_reactions = element_reactions[element_reactions[list(set(reactions_dataframe.columns.tolist()) - set(cluster_leaf_species[element.tag]))].any(axis=1)==False]
200200
intersect_element_reactions = element_reactions.index.tolist()
201201
only_intersect_element = list(set(intersect_element_reactions) - set(intersect_ancestor_reactions))
202202
for reaction in only_intersect_element:
@@ -523,13 +523,13 @@ def absent_and_specific_reactions(reactions_dataframe, output_folder_tree_cluste
523523
specific_writer.writerow(['Organism', 'NB reactions', 'Unique reactions', 'Absent reactions'])
524524
for species in sorted(organisms):
525525
reactions_in_species = set(reactions_dataframe[reactions_dataframe[species]==True].index.tolist())
526-
reactions_absent_in_others = set(reactions_dataframe[reactions_dataframe[list(set(organisms)-{species})].any(1)==False].index.tolist())
526+
reactions_absent_in_others = set(reactions_dataframe[reactions_dataframe[list(set(organisms)-{species})].any(axis=1)==False].index.tolist())
527527
reactions_only_in_species = list(reactions_in_species.intersection(reactions_absent_in_others))
528528
tmp_reactions_dataframe = reactions_dataframe.loc[reactions_only_in_species]
529529
tmp_reactions_dataframe.to_csv(output_folder_specific+species+'.tsv', sep='\t')
530530

531531
reactions_not_in_species = set(reactions_dataframe[reactions_dataframe[species]==False].index.tolist())
532-
reactions_in_others = set(reactions_dataframe[reactions_dataframe[list(set(organisms)-{species})].all(1)==True].index.tolist())
532+
reactions_in_others = set(reactions_dataframe[reactions_dataframe[list(set(organisms)-{species})].all(axis=1)==True].index.tolist())
533533
reactions_only_not_in_species = list(reactions_not_in_species.intersection(reactions_in_others))
534534
tmp_reactions_dataframe = reactions_dataframe.loc[reactions_only_not_in_species]
535535
tmp_reactions_dataframe.to_csv(output_folder_absent+species+'.tsv', sep='\t')
@@ -656,7 +656,7 @@ def reaction_figure_creation(reaction_file, output_folder, upset_cluster=None, p
656656
node_label = 'cluster_'+str(node.id).zfill(len_longest_cluster_id)
657657
if d[node_label] == []:
658658
species = cluster_leaf_species[node_label]
659-
tmp_reactions = reactions_dataframe[reactions_dataframe[species].all(1) == True]
659+
tmp_reactions = reactions_dataframe[reactions_dataframe[species].all(axis=1) == True]
660660
post_order_clusters[node_label] = tmp_reactions.index.tolist()
661661
else:
662662
if set(post_order_clusters[d[node_label][0]]).intersection(set(post_order_clusters[d[node_label][1]])) != set():

0 commit comments

Comments
 (0)