Skip to content

TypeError in expression_profile.py #19

Description

@jotech

I encountered an error when calling the imat function:

imat(recon, exprof, (0, 30), condition="cond1")
[...]
TypeError: Call constructor takes at most 3 positional arguments

I can track it down to a sympy call by parse_expr:

./driven/data_sets/expression_profile.py in _map_gene_to_rxn(self, reaction, gene_values, by)
    333         rule = reaction.gene_reaction_rule.replace("and", "*").replace("or",
    334                                                                        "+")
--> 335         expression = parse_expr(rule, local_dict)
    336         if by == "or2max_and2min":
    337             expression = expression.replace(Mul, Min).replace(Add, Max)

A minimal example to reproduce the error would be:

from sympy import Symbol
from sympy.parsing.ast_parser import parse_expr
local_dict = {'5161.0': 5161.0,
 '1738.0': 1738.0,
 '5160.0': 5160.0,
 '1737.0': 1737.0,
 '5162.0': 5162.0,
 '8050.0': 8050.0}
rule = '(1738.0 * 8050.0) * (5161.0 * 5162.0) * (1737.0) + (1738.0 * 8050.0) * (5160.0 * 5162.0) * (1737.0)'
expression = parse_expr(rule, local_dict)
[...]
TypeError: Call constructor takes at most 3 positional arguments

Do you have any clue what's going on here?

extended log file
python 3.7.2+
sympy 1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions