Skip to content
Kelvin Li edited this page May 24, 2014 · 18 revisions

Setup

Python on Windows

Python 2.x needs to be setup such that it is invokable from the command-line as python. Try it out now: type python into the command prompt. If you get a Python prompt, then you are all set. If you get an error about python not existing, then keep reading.

You need to locate the directory where you installed Python. If you used the installer's default path, then it probably looks something like C:\Python27. This directory needs to be added to your PATH environment variable. To do that, open Windows Explorer, right-click on Computer, and click on Properties in the drop-down menu. In the left-hand pane, click Advanced system settings. In the dialog box, click the Environment Variables... button.

In that dialog box, look at the upper box labeled User variables for and click on the button New... corresponding to that box.

In the New User Variable dialog box:

  • Variable name: PATH
  • Variable value: %PATH%;C:\Python27

Be sure to enter all the funny characters exactly as shown.

Then click OK on all the dialog boxes, save all your open documents, and log out. Log back in again, open command prompt, and try out python.

Biopython

You will need Biopython installed for some of the Python functions to work. Get it at the Biopython download page.

To see whether it works, type python into the command prompt/terminal and then type import Bio. If you don't see any messages, then it worked. If you see an ImportError, then it's broken or missing.

installing on Windows

Type python --version in the command prompt to see your Python version. If it is 2.7.x, then use this installer.

Command bar examples

Wrapping external Python code

Reverse complement via BioPython

clotho.run2("py_biorc", ["atcgc"])

Importing a test Python module in src/main/python/lib/hello.py

clotho.run("org.andersonlab.py_greet", [])

Bill Cao's PCR predictor (please fill in a better example here)

clotho.run2("py_pcr", ["CGCTCCAAGCTGGGCTGTGTG", "CGATAGTTACCGGATAAGGC", "CGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCG"])

Mina Li's NCBI NucSeq fetcher

clotho.run2("py_nucseqfetch", ['123746834', '1322'])

Accessing ServerSideAPI

Returns its own code via a clotho.get call

clotho.run("org.andersonlab.py_selfie", [])

Modifies itself via a clotho.set call

clotho.run2("py_selfsetter", [])

Makes a clotho.run call which fails, and the Python function catches the resulting ClothoError

clotho.run2("py_error_recover", [])

Handling crashes

Die at various stages of execution (should expect a run error and a clotho.say message)

clotho.run2("py_die_early", [])
clotho.run2("py_die_run", [])

Simulates Python process crashing really hard (shows that Clotho will cleanup properly)

clotho.run2("py_die_abrupt", [])
Clone this wiki locally