Comments (4)
Ok... I created a pull request. Let's see what happens :)
from driven.
Yes. sympy is using a 5 argument version of ast.Call which was
removed in Py3.5. see https://greentreesnakes.readthedocs.io/en/latest/nodes.html#Call
from driven.
Here's a monkey patch (might create a pull request if I have time)
from cobra.core.gene import parse_gpr
from sympy import Mul, Add, Symbol, Max, Min
from ast import And, Or, NodeTransformer
class Transform(NodeTransformer):
def visit_Name(self, node):
return Symbol(node.id)
def visit_BoolOp(self, node):
values = [self.visit(v) for v in node.values]
if isinstance(node.op, And):
return Mul(*values)
if isinstance(node.op, Or):
return Add(*values)
return node
def parse_expr(s):
a, genes = parse_gpr(s.strip())
a = Transform().visit(a)
return a.body
def _map_gene_to_rxn(self, reaction, gene_values, by):
rule = reaction.gene_reaction_rule
expression = parse_expr(rule)
if by == "or2max_and2min":
expression = expression.replace(Mul, Min).replace(Add, Max)
elif by == "or2sum_and2min":
expression = expression.replace(Mul, Min)
return expression.subs(gene_values).evalf()
from driven.data_sets.expression_profile import ExpressionProfile
ExpressionProfile._map_gene_to_rxn = _map_gene_to_rxn
from driven.
thank you very much it helped indeed :)
from driven.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from driven.