jcrozum / pystablemotifs

Python library for attractor identification and control in Boolean networks
MIT License
28 stars 7 forks source link

using pystablemotifs in spyder via a conda enviroment #93

Closed Eugenio-Azpeitia closed 9 months ago

Eugenio-Azpeitia commented 10 months ago

Hi,

I have been trying to use pystable motifs from spyder, but I receive an error when using a simple code. Briefly, I created an environment in conda where I followed the Installation steps on the read me file, including clasp and gringo. I believe that the error may be related to gringo, which I installed in my conda environment. However, I am not sure about this. By any chance do you know how to solve the problem or how to install pystablemotifs in spyder?

Below I paste the simple code that I used to test the installation and the error that I reveive:

import pystablemotifs as sm

relative_path_to_model = "./models/simple_model.txt" rules='''xA=xB xB=xA xC=xA or not xD xD=xC xE=xB and xF xF=xE'''

primes = sm.format.create_primes(rules)

print("RULES") sm.format.pretty_print_prime_rules(primes) print()

ar = sm.AttractorRepertoire.from_primes(primes)

Everything seems fine, but I receive an error with the last line. The error says:

BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals)

File ~/.spyder-py3/temp.py:24 ar = sm.AttractorRepertoire.from_primes(primes)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pystablemotifs/AttractorRepertoire.py:98 in from_primes x.analyze_system(primes,max_simulate_size=max_simulate_size,max_simulate_size_vc=max_simulate_size_vc,max_stable_motifs=max_stable_motifs,max_in_degree=max_in_degree,MPBN_update=MPBN_update)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pystablemotifs/AttractorRepertoire.py:196 in analyze_system self.succession_diagram = sm_succession.build_succession_diagram(primes,max_simulate_size=max_simulate_size,max_simulate_size_vc=max_simulate_size_vc,max_stable_motifs=max_stable_motifs,max_in_degree=max_in_degree,MPBN_update=MPBN_update)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pystablemotifs/succession.py:515 in build_succession_diagram myMotifReduction=sm_reduction.MotifReduction(motif_history,fixed.copy(),primes,max_simulate_size=max_simulate_size,max_simulate_size_vc=max_simulate_size_vc,prioritize_source_motifs=prioritize_source_motifs,max_stable_motifs=max_stable_motifs,MPBN_update=MPBN_update)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pystablemotifs/reduction.py:413 in init self.stable_motifs = pyboolnet.trap_spaces.compute_trap_spaces(self.reduced_primes, "max",max_output=max_stable_motifs)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pyboolnet/trap_spaces.py:245 in compute_trap_spaces return potasscohandle(primes, type, bounds=bounds, project=[], max_output=max_output, fname_asp=fname_asp, representation=representation)

File ~/opt/anaconda3/envs/zanudo/lib/python3.8/site-packages/pyboolnet/external/potassco.py:74 in potassco_handle raise Exception

Exception

Regards,

jcrozum commented 10 months ago

Let's make sure the required software is properly installed. Can you verify that this script runs (from https://github.com/hklarner/pyboolnet/blob/master/tutorials/09_trap_spaces.py):


from pyboolnet.repository import get_primes
from pyboolnet.trap_spaces import compute_steady_states, compute_trap_spaces

if __name__ == "__main__":
    # compute minimal and maximal trap spaces

    primes = get_primes("remy_tumorigenesis")
    mints = compute_trap_spaces(primes, "min")
    print(len(mints))

    max_trap_spaces = compute_trap_spaces(primes, "max")
    print(len(max_trap_spaces))
    print(max_trap_spaces)

    # compute steady states using the ASP solver

    steady = compute_steady_states(primes)
    print(len(steady))
jcrozum commented 9 months ago

Closing due to inactivity. Will re-open upon request.