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

pycotools3: code for michaelis_menten model creation is not working #1

Closed
vibha15 opened this issue Jun 20, 2019 · 6 comments
Closed

Comments

@vibha15
Copy link

vibha15 commented Jun 20, 2019

Hi.
I am coding according to the pycotools3 documentation (release 12, Jan 2019).
First, i tried to code for importing all the dependencies. it worked.
Second, i tried to built michaelis_menten model according to the documentation.
It showed error by saying that "you should use loada in place of BuildAntimony" (files showing
errors are m_m modelerr1.png and m_m modelerr1-extended.png).
Third, when i use loada. it started showing some positional error in copasi file (related error showing file is m_m modelerr2.png .
Thank you so much in advance for your suggestion.

*My system is Ubuntu 16.04.
I downloaded Anaconda3 (2019.03) with python 3.6 on my ubuntu machine.
Obviously, downloaded pycotools3 using "pip install pycotools3".
My work is on chemical kinetics and model prediction, but i am doing the michaelis_menten model coding to see how pycotools3 works accroding to the given doc, prior to begin my project.

Thanks
Vibha

@CiaranWelsh
Copy link
Owner

Hello,

The documentation you are referring to sounds a bit old (12 Jan 2019?). I've developed the project more recently than that so my first suggestion would be to just ensure you are using the most up to date version of everything. You can find the documentation here. Also, try ensuring you are using the most recent pycotools.

$ pip uninstall pycotools3

then

$ pip install pycotools3 --no-cache-dir

the --no-cache-dir option just forces pip to redownload the package, rather than using a cached version.

I've tried the following on my own machine, which works as expected.

Let me know how it goes - all the best

Ciaran

import os
import site
from pycotools3 import model, tasks, viz

working_directory = <input working directory here>
if not os.path.isdir(working_directory):
    os.makedirs(working_directory)

copasi_file = os.path.join(working_directory, 'michaelis_menten.cps')

if os.path.isfile(copasi_file):
    os.remove(copasi_file)

antimony_string = """
model michaelis_menten()
    compartment cell = 1.0
    var E in cell
    var S in cell
    var ES in cell
    var P in cell

    kf = 0.1
    kb = 1
    kcat = 0.3
    E = 75
    S = 1000

    SBindE: S + E => ES; kf*S*E
    ESUnbind: ES => S + E; kb*ES
    ProdForm: ES => P + E; kcat*ES
end
"""

with model.BuildAntimony(copasi_file) as loader:
    mm = loader.load(antimony_string)

@vibha15
Copy link
Author

vibha15 commented Jun 20, 2019 via email

@CiaranWelsh
Copy link
Owner

CiaranWelsh commented Jun 20, 2019

Hi Vibha,

I've tested pycotools3 on both Copasi 4.24 and 4.25 and behavior is the same as far as I can tell so you're best off using the most recent version.

As for Python, I've also tested this on 3.7 but ran into troubles because of a dependency (tellurium). I haven't chased this up for a while so it may work. If you wanted to quickly test it, it would be a simple case of writing a script (or notebook) that works on Python 3.6, then switching to a Python 3.7 environment and seeing if it works. However, for the time being, 3.6 works well enough.

Jupyter notebooks also work well enough. These days I tend to just use Pycharm, but notebooks are the preference for many.

Pycotools dependencies should install themselves with pycotools. The only exception is COPASI itself. The assumption is that you already have COPASI installed and the path to the copasi/bin folder (i.e. where the copasi binaries are kept) are in your path environment variable. An easy way to test this is to run the command CopasiUI and see if it opens the COPASI GUI.

Good luck,

Ciaran

@vibha15
Copy link
Author

vibha15 commented Jun 21, 2019 via email

@vibha15
Copy link
Author

vibha15 commented Jun 23, 2019 via email

@CiaranWelsh
Copy link
Owner

CiaranWelsh commented Jun 24, 2019

Hi Vibha,

It looks like there are syntax errors in your antimony model - In antimony, parenthesis are reserved for functions. I suspect this will work if you were to just remove them from your variable naming.

You can find some documentation here.

Something else that can be helpful is to build you model in COPASI, export the SBML and then use a tellurium function tellurium.tellurium.sbmlToAntimony(sbml) here to create an antimony string. I found this useful when I was learning how to use Antimony.

Ciaran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants