Closed luciansmith closed 10 years ago
Odd, since it works. SelectionRecord is something form the roadrunner python api.
Herbert
On 9/11/2014 3:30 PM, luciansmith wrote:
In the three 'reset' functions in tellurium.py at
https://github.com/sys-bio/tellurium/blob/master/tellurium.py
it uses 'SelectionRecord', which is undefined.
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu mailto:hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog http://blog.analogmachine.org Text Books: First edition: Enzyme Kinetics for Systems Biology http://tinyurl.com/3w4b9al Second edition: Enzyme Kinetics for Systems Biology http://www.amazon.com/Enzyme-Kinetics-Systems-Biology-Herbert/dp/0982477333/ref=sr_1_3?s=books&ie=UTF8&qid=1398554192&sr=1-3&keywords=enzyme+kinetics New book: Essentials for Biochemical Modeling http://tinyurl.com/3w4b9al
Aha, that explains it--since tellurium.py only says 'import roadrunner' and not 'import * from roadrunner', SelectionRecord isn't its own thing--you either have to 'import SelectionRecord from roadrunner' at the top, or use 'roadrunner.SelectionRecord' in those functions. However, it would work accidentally in scripts that had 'import * from roadrunner' in them (I'm guessing?)
Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING)
TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
This is something for Andy to comment on.
H
On 9/11/2014 3:55 PM, luciansmith wrote:
Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME roadrunner.SelectionRecord.RATE roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55340726.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu mailto:hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog http://blog.analogmachine.org Text Books: First edition: Enzyme Kinetics for Systems Biology http://tinyurl.com/3w4b9al Second edition: Enzyme Kinetics for Systems Biology http://www.amazon.com/Enzyme-Kinetics-Systems-Biology-Herbert/dp/0982477333/ref=sr_1_3?s=books&ie=UTF8&qid=1398554192&sr=1-3&keywords=enzyme+kinetics New book: Essentials for Biochemical Modeling http://tinyurl.com/3w4b9al
What is the self object here?
the RoadRunner does take an integer, was the standard RoadRunner reset replaced by a method in tellurium?
I'm not sure what the reason for replacing it would be because it it is called without args, it defaults to the combination specified here.
Sent from my iPad
On Sep 11, 2014, at 7:04 PM, hsauro hsauro@u.washington.edu wrote:
This is something for Andy to comment on.
H
On 9/11/2014 3:55 PM, luciansmith wrote: Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
— Reply to this email directly or view it on GitHub.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog Text Books: First edition: Enzyme Kinetics for Systems Biology Second edition: Enzyme Kinetics for Systems Biology New book: Essentials for Biochemical Modeling
I couldn't tell you why it was added--the version in tellurium.py does indeed seem to override the built-in function in the API. Maybe we should just remove it/them?
In Python, I think most object - associated functions have an implied first argument of 'self', which is why the error message talks about two arguments instead of one. In this case, it'd be the roadrunner object.
-Lucian On Sep 11, 2014 5:26 PM, "Herbert Sauro" notifications@github.com wrote:
What is the self object here?
the RoadRunner does take an integer, was the standard RoadRunner reset replaced by a method in tellurium?
I'm not sure what the reason for replacing it would be because it it is called without args, it defaults to the combination specified here.
Sent from my iPad
On Sep 11, 2014, at 7:04 PM, hsauro hsauro@u.washington.edu wrote:
This is something for Andy to comment on.
H
On 9/11/2014 3:55 PM, luciansmith wrote: Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
— Reply to this email directly or view it on GitHub.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog Text Books: First edition: Enzyme Kinetics for Systems Biology Second edition: Enzyme Kinetics for Systems Biology New book: Essentials for Biochemical Modeling
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55347404.
I think this is your code?
H
Sent from my iPad
On Sep 11, 2014, at 5:25 PM, Andy Somogyi somogyie@umail.iu.edu wrote:
What is the self object here?
the RoadRunner does take an integer, was the standard RoadRunner reset replaced by a method in tellurium?
I'm not sure what the reason for replacing it would be because it it is called without args, it defaults to the combination specified here.
Sent from my iPad
On Sep 11, 2014, at 7:04 PM, hsauro hsauro@u.washington.edu wrote:
This is something for Andy to comment on.
H
On 9/11/2014 3:55 PM, luciansmith wrote: Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
— Reply to this email directly or view it on GitHub.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog Text Books: First edition: Enzyme Kinetics for Systems Biology Second edition: Enzyme Kinetics for Systems Biology New book: Essentials for Biochemical Modeling
The tellurium package must retain reset, resetall and resetfromorigin. How they are implemented I don't care. We use them in our modeling workshops, they are extremely useful. Just make sure they work as expected.
By the way in today's workshop the students were very mixed up about using the model keyword to access methods. I've decided that on the tellurium side, all roadrunner methods will be on the same level to avoid confusion. Andy you need to advice me on how to get getvalue working at the top level. This is the second time I've had students confused by this.
H
Sent from my iPad
On Sep 11, 2014, at 6:36 PM, luciansmith notifications@github.com wrote:
I couldn't tell you why it was added--the version in tellurium.py does indeed seem to override the built-in function in the API. Maybe we should just remove it/them?
In Python, I think most object - associated functions have an implied first argument of 'self', which is why the error message talks about two arguments instead of one. In this case, it'd be the roadrunner object.
-Lucian On Sep 11, 2014 5:26 PM, "Herbert Sauro" notifications@github.com wrote:
What is the self object here?
the RoadRunner does take an integer, was the standard RoadRunner reset replaced by a method in tellurium?
I'm not sure what the reason for replacing it would be because it it is called without args, it defaults to the combination specified here.
Sent from my iPad
On Sep 11, 2014, at 7:04 PM, hsauro hsauro@u.washington.edu wrote:
This is something for Andy to comment on.
H
On 9/11/2014 3:55 PM, luciansmith wrote: Hmm, even fixing that, I still get an error:
self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given)
(I assume the first argument is 'self'.)
Are you sure it works for you? You've called 'rr.reset()', etc?
— Reply to this email directly or view it on GitHub.
Herbert M Sauro Associate Professor Department of Bioengineering University of Washington William H. Foege Building Box 355061, Seattle, WA 98195-5061 206.685.2119 (tel), 206.685.3300 (shared fax) Email: hsauro@u.washington.edu Work Website: http://www.sys-bio.org
Blog Text Books: First edition: Enzyme Kinetics for Systems Biology Second edition: Enzyme Kinetics for Systems Biology New book: Essentials for Biochemical Modeling
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55347404.
— Reply to this email directly or view it on GitHub.
I'm not sure what the problem with the tellurim resetAll and resetToOrigin is, they get attached to the roadrunner object and they work fine, just tried them. The only thing worth changing on them is defining them so they are hidden at package scope.
RoadRunner already has a getValue method, it just forwards all the sbml ids to the model object. It also can do all the eigen, and metabolic analysis selections in addition to the model ones.
Just tried them here:
r=te.RoadRunner("feedback.xml")
r.simulate();
r.model.items()
[('S1', 1.2678499928513147),
('S2', 0.7302161321683196),
('S3', 0.7076310997667816),
('S4', 1.140097401988697)]
r.resetToOrigin()
r.model.items()
[('S1', 0.0),
('S2', 0.0),
('S3', 0.0),
('S4', 0.0)]
This was in Tellurium, what exactly is the problem with them?
None of the various 'reset*' functions defined in tellurium.py work for me, presumably because I have a different python environment than the two of you. If I add 'rrInstance.reset()' to one of the tests in tester.py, I get the error that it doesn't know what 'SelectionRecord' is. Then, if I fix tellurium.py to have 'roadrunner.SelectionRecord' instead of just 'SelectionRecord', I get:
File "tester.py", line 578, in checkSetSpeciesInitialConcentrations rrInstance.reset()
File "C:\Python27\lib\site-packages\tellurium\tellurium.py", line 554, in reset self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING)
TypeError: reset() takes exactly 1 argument (2 given)
This is running tester.py from main.py in that directory, in the Spyder/Tellurium IDE.
-Lucian
On Thu, Sep 11, 2014 at 10:09 PM, Andy Somogyi notifications@github.com wrote:
I'm not sure what the problem with the tellurim resetAll and resetToOrigin is, they get attached to the roadrunner object and they work fine, just tried them. The only thing worth changing on them is defining them so they are hidden at package scope.
RoadRunner already has a getValue method, it just forwards all the sbml ids to the model object. It also can do all the eigen, and metabolic analysis selections in addition to the model ones.
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55362128.
For what it's worth, here's my output from the exact same set of commands:
r = te.RoadRunner("feedback.xml") Notice: performing conserved moiety conversion Notice: source document is level 2, version 1, converting to level 3, version 1 for Moiety Conservation Conversion r.simulate() array([[ 0. , 0. , 0. , 0. , 0. ], [ 0.1 , 0.6522865 , 0.0454743 , 0.01195563, 0.1665238 ], [ 0.2 , 1.1019966 , 0.14999053, 0.07156689, 0.36923238], [ 0.3 , 1.47036753, 0.26339715, 0.16309412, 0.55249569], [ 0.4 , 1.78893355, 0.37599974, 0.26822826, 0.7200364 ], [ 0.5 , 2.07216102, 0.48650079, 0.37903724, 0.87584706], [ 0.6 , 2.32836241, 0.59488217, 0.49224153, 1.02261358], [ 0.7 , 2.56283288, 0.70131147, 0.6063808 , 1.16213536], [ 0.8 , 2.77875763, 0.80597113, 0.72074033, 1.2956325 ], [ 0.9 , 2.97654276, 0.90900603, 0.83494788, 1.4238803 ], [ 1. , 3.15086641, 1.01049658, 0.94879742, 1.54711834], [ 1.1 , 3.2848805 , 1.11039076, 1.06216843, 1.66464746], [ 1.2 , 3.34566352, 1.20850393, 1.17489363, 1.77403801], [ 1.3 , 3.29581134, 1.30415878, 1.28683175, 1.87065314], [ 1.4 , 3.12536017, 1.39624992, 1.39770134, 1.94833189], [ 1.5 , 2.86514722, 1.48329375, 1.50708325, 2.00167871], [ 1.6 , 2.56099704, 1.56367923, 1.6144153 , 2.02774709], [ 1.7 , 2.24861749, 1.63592472, 1.71903811, 2.02621246], [ 1.8 , 1.94887612, 1.69876298, 1.82023105, 1.99851027], [ 1.9 , 1.67220381, 1.75116953, 1.9172475 , 1.94714618], [ 2. , 1.4230699 , 1.79236314, 2.00934957, 1.87520252], [ 2.1 , 1.20275191, 1.82174353, 2.09579621, 1.78605986], [ 2.2 , 1.01072119, 1.83891121, 2.17586083, 1.68326622], [ 2.3 , 0.84544309, 1.8436621 , 2.24883051, 1.5704211 ], [ 2.4 , 0.7048052 , 1.83599695, 2.31401131, 1.45106771], [ 2.5 , 0.58635073, 1.81614374, 2.37073078, 1.32861662], [ 2.6 , 0.48748139, 1.784568 , 2.41834619, 1.20621978], [ 2.7 , 0.40557065, 1.7419915 , 2.4562694 , 1.08666853], [ 2.8 , 0.33809548, 1.68937063, 2.48396136, 0.97231951], [ 2.9 , 0.28272003, 1.6279021 , 2.50096389, 0.86499249], [ 3. , 0.23734994, 1.55896505, 2.506918 , 0.76596926], [ 3.1 , 0.20018239, 1.48408149, 2.5015748 , 0.67598201], [ 3.2 , 0.16969623, 1.40483115, 2.48482937, 0.5952825 ], [ 3.3 , 0.14464817, 1.32279256, 2.45670845, 0.52372605], [ 3.4 , 0.12405139, 1.23947852, 2.41739373, 0.46084468], [ 3.5 , 0.10711786, 1.15626746, 2.36721877, 0.4059917 ], [ 3.6 , 0.09323788, 1.07435148, 2.30666896, 0.35843889], [ 3.7 , 0.08198562, 0.99474757, 2.23637363, 0.31740848], [ 3.8 , 0.07310229, 0.91827491, 2.15709021, 0.28220544], [ 3.9 , 0.06654889, 0.84558677, 2.06970501, 0.25227194], [ 4. , 0.06262297, 0.77723281, 1.97522963, 0.22728786], [ 4.1 , 0.06221976, 0.71376854, 1.8748172 , 0.20732914], [ 4.2 , 0.06740158, 0.65595198, 1.76981575, 0.19318172], [ 4.3 , 0.08255826, 0.60508933, 1.66189191, 0.18690021], [ 4.4 , 0.11652725, 0.56359102, 1.55328738, 0.19271736], [ 4.5 , 0.18510383, 0.53560118, 1.44726033, 0.2178204 ], [ 4.6 , 0.309345 , 0.52681932, 1.34859871, 0.27094659], [ 4.7 , 0.50130443, 0.54196292, 1.26356071, 0.35649595], [ 4.8 , 0.74661104, 0.58092772, 1.19840008, 0.4691409 ], [ 4.9 , 1.01211929, 0.63844017, 1.15707001, 0.59729495], [ 5. , 1.26790101, 0.70765451, 1.1401031 , 0.73025188]]) r.model.items() [('S1', 1.2679010065193668), ('S3', 0.7076545135713277), ('S4', 1.1401030993151677), ('S2', 0.730251877700298), ('X0', 10.0), ('X1', 0.0), ('[S1]', 1.2679010065193668), ('[S3]', 0.7076545135713277), ('[S4]', 1.1401030993151677), ('[S2]', 0.730251877700298), ('[X0]', 10.0), ('[X1]', 0.0), ('compartment', 1.0), ('J0_VM1', 10.0), ('J0_Keq1', 10.0), ('J0_h', 10.0), ('J4_V4', 2.5), ('J4_KS4', 0.5), ('init(J0_VM1)', 10.0), ('init(J0_Keq1)', 10.0), ('init(J0_h)', 10.0), ('init(J4_V4)', 2.5), ('init(J4_KS4)', 0.5), ('J0', 6.179068415871885), ('J1', 3.7418059528718577), ('J2', 2.414862921291052), ('J3', 1.6842511158178797), ('J4', 1.7378527907654444), ('init([S1])', 0.0), ('init([S3])', 0.0), ('init([S4])', 0.0), ('init([S2])', 0.0), ('init(S1)', 0.0), ('init(S3)', 0.0), ('init(S4)', 0.0), ('init(S2)', 0.0), ("S1'", 2.4372624630000277), ("S3'", 0.7306118054731725), ("S4'", -0.05360167494756474), ("S2'", 1.3269430315808055)] r.reset() Traceback (most recent call last): File "
", line 1, in File "C:\Python27\lib\site-packages\tellurium\tellurium.py", line 554, in reset self.reset(roadrunner.SelectionRecord.TIME | roadrunner.SelectionRecord.RATE | roadrunner.SelectionRecord.FLOATING) TypeError: reset() takes exactly 1 argument (2 given) r.resetToOrigin() Traceback (most recent call last): File " ", line 1, in File "C:\Python27\lib\site-packages\tellurium\tellurium.py", line 544, in resetToOrigin self.reset(roadrunner.SelectionRecord.ALL) TypeError: reset() takes exactly 1 argument (2 given)
On Thu, Sep 11, 2014 at 10:16 PM, Andy Somogyi notifications@github.com wrote:
Just tried them here:
r=te.RoadRunner("feedback.xml")r.simulate();r.model.items() [('S1', 1.2678499928513147), ('S2', 0.7302161321683196), ('S3', 0.7076310997667816), ('S4', 1.140097401988697)] r.resetToOrigin()r.model.items() [('S1', 0.0), ('S2', 0.0), ('S3', 0.0), ('S4', 0.0)]
This was in Tellurium, what exactly is the problem with them?
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55362424.
I think you have a very old version of tellurium.
FYI, the following just just from a plain python console directly at a shell prompt, with NO Spylder and NO tellurium:
In [1]: import roadrunner
In [2]: r=roadrunner.RoadRunner("feedback.xml")
In [3]: r.reset()
In [4]: r.reset(roadrunner.SelectionRecord.ALL)
You just need to import the roadrunner package.
I think tellurium a while back tried to override the RoadRunner.reset()
method, but this was removed a while back. It now just uses the built in RoadRunner.reset()
and adds resetAll
and resetToOrigin
If we all we have to do is remove it, that's great--it's still there in https://github.com/sys-bio/tellurium/blob/master/tellurium.py Maybe it accidentally got re-added? I can confirm that if I remove everything with 'reset' in it from tellurium.py, everything works again.
Herbert, it's probably best if you're the one to remove the various 'reset' functions from tellurium.py and check them in.
-Lucian
On Thu, Sep 11, 2014 at 10:39 PM, Andy Somogyi notifications@github.com wrote:
I think tellurium a while back tried to override the RoadRunner.reset() method, but this was removed a while back. It now just uses the built in RoadRunner.reset() and adds resetAll and resetToOrigin
— Reply to this email directly or view it on GitHub https://github.com/sys-bio/tellurium/issues/24#issuecomment-55363536.
I don't think there is anything wrong with tellurium.py, I think you just have an old version.
The two functions there, resetAll
and resetToOrigin
work fine and there is no reason for removing them.
Hunh! OK, then! I could have sworn that I saw 'reset' in there, but it must have been 'resetToOrigin'. OK, updated my copy.
However, updating to the most recent version of tellurium.py revealed why Herbert was having problems with setValue: it was incorrectly forwarding explicitly (and incorrectly) to 'setvalue', which a) it shouldn't do, and b) has incorrect capitalization. Also, 'getValue' forwards to 'getalue', which it also shouldn't do, and is missing the 'V' entirely. I think we can just remove those commands from tellurium.py altogether.
In the three 'reset' functions in tellurium.py at
https://github.com/sys-bio/tellurium/blob/master/tellurium.py
it uses 'SelectionRecord', which is undefined.