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

Installing and Utilizing Nuskell #2

Closed
jphuse opened this issue May 23, 2023 · 3 comments
Closed

Installing and Utilizing Nuskell #2

jphuse opened this issue May 23, 2023 · 3 comments

Comments

@jphuse
Copy link

jphuse commented May 23, 2023

Hello!

I know the last commit was over two years ago so I apologize for reopening this if it is deprecated. Please let me know if there is any assistance you can give as the documentation is not very friendly to someone who has never used the Nuskell library before.

I attempted installing Nuskell (of which the only way is by downloaded the source code and running python3 -m setup install --user) and it through errors and was difficult to troubleshoot as it kept saying I didn't have access to the egg file. Once I finally was able to get past this, I was trying to use Nuskell in a test python file where I tried the Quickstart python script in the documentation (found at https://www.dna.caltech.edu/~badelt/nuskell/#quickstart). Because it's a local install, I had to adjust the imports to handle the local build from the setup.py file. Here is the script and it's errors:

NuskellTest.py

from nuskell.build.lib.nuskell.dsdcompiler import translate, verify

testtube = translate('A+B->C', scheme='soloveichik2010.ts')

# Get the enumerated CRN
testtube.enumerate_reactions()

# Interpret the enumerated CRN, i.e. replace history species
interpretation = testtube.interpret_species(['A', 'B', 'C'], prune=True)

# Formulate reversible reactions as two irreversible reactions.
fcrn = [[['A', 'B'], ['C']]]
vcrn = []
for r in testtube.reactions:
    rxn = [map(str, r.reactants), map(str, r.products)]
    vcrn.append(rxn)

v = verify(fcrn, vcrn, fs, method='bisimulation')

if v:
    print("Input CRN and TestTube-Species are CRN bisimulation equivalent.")
else:
    print("Input CRN and TestTube-Species are not CRN bisimulation equivalent.")

Errors:

Traceback (most recent call last):
  File "C:\Users\jhuse\anaconda3\envs\GitHub\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 198, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/jhuse/OneDrive - University of Kentucky/Research/DNA Computing/GitHub/build/NuskellTest.py", line 2, in <module>
    from nuskell.build.lib.nuskell.dsdcompiler import translate, verify
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\jhuse\OneDrive - University of Kentucky\Research\DNA Computing\GitHub\build\nuskell\build\lib\nuskell\dsdcompiler\__init__.py", line 15, in <module>
    from .compiler import (translate, 
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\jhuse\OneDrive - University of Kentucky\Research\DNA Computing\GitHub\build\nuskell\build\lib\nuskell\dsdcompiler\compiler.py", line 17, in <module>
    from .interpreter import NuskellEnvironment 
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\jhuse\OneDrive - University of Kentucky\Research\DNA Computing\GitHub\build\nuskell\build\lib\nuskell\dsdcompiler\interpreter.py", line 23, in <module>
    from .objects import NuskellDomain, NuskellComplex, SingletonError
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\jhuse\OneDrive - University of Kentucky\Research\DNA Computing\GitHub\build\nuskell\build\lib\nuskell\dsdcompiler\objects.py", line 9, in <module>
    from dsdobjects import (SingletonError, clear_singletons)
  File "C:\Program Files\JetBrains\PyCharm 2022.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'dsdobjects'
@bad-ants-fleet
Copy link
Member

Hi,

Sorry for the rough installation experience and the outdated documentation. There are a few things to note here:

  1. dsdobjects is a dependency that should be resolved during installation. I just installed nuskell in a fresh conda enviroment with the command pip install . and everything works as expected. (e.g. you can test the installation with the command python setup.py test). I presume the --user flag for pip would work just as well. Can you try that? Alternatively, you'd have to call pip install dsdobjects, but who knows if the other dependencies are resolved correctly then...
  2. the example script from the documentation is really out of date. I will remove it with the next commit. There main script that the command line utility "nuskell" refers to is nuskell/framework.py. If you are planning to develop on the nuskell compiler, or if you realize that you would like to do things differently, then this is the best place to start.
  3. The main interface to nuskell is the command line utility, and this should be sufficient for most users! Type nuskell --help for all the possible options. Try the call from the README: echo "A + B <=> X + Y; X -> A" | nuskell --ts srinivas2015.ts --verify crn-bisimulation to compile the given CRN into a DSD system using the translation scheme srinivas2015.ts. (Use the flag -v to get more information on what is happening step by step.) More information on translation schemes are found at nuskell/dsdcompiler/schemes. If the nuskell cannot find the specified translation scheme, you can also download a scheme from there and then provide the relative file path using --ts. Generally, if the specified translation scheme was not found, then nuskell provides an Error message with all available built-in translation schemes.
  4. Nuskell is poorly documented at this point, and I cannot promise that I will find time to improve this any time soon. However, feel free to ask questions here, provide feedback, or even update some documentation files and I will gladly accept/revise your pull request!

I hope that helps, let me know!
cheers,
Stefan

@bad-ants-fleet
Copy link
Member

I have now updated the documentation, so I am closing this issue for now. Feel free to reopen if needed.
cheers,
Stefan

@jphuse
Copy link
Author

jphuse commented Jun 5, 2023

This issue is fixed with the updated README.md documentation and in Pull Request #4.

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