Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all unique reaction combinations added to cyclic pathways #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions metquest/pathway_assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ def _populate_table(rxns, temp_rxn_list_current, currentcolumnidx):
if succmets in pathway_table:
if succmets in metabs_in_cycle:
if succmets in cyclic_pathways:
cyclic_pathways[succmets].update(
{len(reaction_combntn): [list(reaction_combntn)]})
# multiple reaction_combntn sets may exist the metabolite in a column k, check whether cmbnt exists before appending
if not any(set(reaction_combntn) == existing_set for existing_set in cyclic_pathways[succmets].get(len(reaction_combntn), [])):
cyclic_pathways[succmets].setdefault(len(reaction_combntn), []).append(set(reaction_combntn))
# change from .update to .setdefault method
# cyclic_pathways[succmets].update(
# {len(reaction_combntn): [list(reaction_combntn)]})
else:
cyclic_pathways[succmets] = \
{len(reaction_combntn): [list(reaction_combntn)]}
Expand Down