Changes between Initial Version and Version 1 of MussaPython


Ignore:
Timestamp:
12/05/2006 06:14:58 PM (17 years ago)
Author:
diane
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MussaPython

    v1 v1  
     1= Python Embedded into Mussa =
     2
     3There are two ways to interact with mussa via python. One is via the embedded interpreter, the other by a python extension module. The advantage to the embedded interpreter is that it is possible to launch a Mussa GUI window to view an analysis that was created via python. The advantage to the extension module is that it doesn't replace your interpreter and that its easier to run scripts from the shell. (There's also the problem that the embedded interpreter probably wont work under Microsoft Windows).
     4
     5== Building Python Enabled Mussa ==
     6
     7Patches [493] and [494] currently force building the python version. Soon I'll add a CMake configuration variable to make building this optional.
     8
     9The result of this is a mussa executable which has a python interpreter embedded in it.
     10
     11[http://mussagl-universal-b494.dmg OS X Universal Binary of Mussa with Python]
     12
     13=== Running ===
     14
     15To run the embedded version of mussa you will need to launch mussa from the command line.
     16
     17{{{ mussagl --python }}}
     18
     19Though on OS X the executable is buried deep within the mussa application folder.
     20
     21{{{ ./mussagl.app/Contents/MacOS/mussagl --python }}}
     22
     23The interpreter will be preloaded with the mussa and mussaqui modules.
     24
     25== Building Mussa Python Extension ==
     26
     27Also the current build system produces an extension module which can be imported into a currently running python interpreter. Though I'm not currently shipping a binary that includes it.
     28
     29I hope there's some way of building a python binary egg from this CMake generated module.
     30
     31For this, if you have the python module, it just needs to be placed on your python path. and then
     32
     33{{{
     34$ python
     35>>> import mussa
     36}}}
     37
     38should work.
     39
     40== Using Mussa from Python ==
     41
     42To actually use Mussa from python.
     43
     44The following code will construct a three-way mussa analysis, and run it with a threshold of 8 base-pairs matching in 10 base-pair window.
     45
     46(Sometime soon I'll try to fix .add_sequence() to also take strings)
     47
     48{{{
     49  s1 = mussa.Sequence("A"*10)
     50  s2 = mussa.Sequence("GG"+"A"*8+"GG")
     51  s3 = mussa.Sequence("T"*10)
     52  m = mussa.Mussa()
     53  m.window = 10
     54  m.threshold = 8
     55  m.add_sequence(s1)
     56  m.add_sequence(s2)
     57  m.add_sequence(s3)
     58  m.analyze()
     59}}}