root/trunk/cartwheel-clients/canal/examples/create-pairwise-analysis.py

Revision 118, 1.2 kB (checked in by t, 2 years ago)

added blastz/lagan vista analyses to xmlrpc

  • Property svn:executable set to *
Line 
1 #! /usr/bin/env python
2 """
3 A simple example script that shows how to add a pairwise analysis.
4 """
5
6 # first, add the directory containing 'canalAPI' into sys.path:
7 import os.path
8 thisdir = os.path.dirname(__file__)
9 libdir = os.path.join(thisdir, '../')
10 libdir = os.path.normpath(libdir)
11
12 import sys
13 if libdir not in sys.path:
14     sys.path.insert(0, libdir)
15
16 # now, get a connection:
17 if len(sys.argv) != 4:
18     sys.stderr.write('''\
19
20 You need to specify a server, a username, and a password
21 e.g.
22
23     %s http://woodward.caltech.edu/canal/ <user> <pass>
24
25 ''' % (sys.argv[0],))
26     sys.exit(-1)
27
28 from canalAPI.xmlrpc import get_xmlrpc_instance
29
30 # connect:
31 conn = get_xmlrpc_instance(sys.argv[1])
32
33 # authenticate:
34 conn.authenticate(sys.argv[2], sys.argv[3])
35
36 # finally, create an analysis folder, add sequences, create pairwise
37 # analysis...
38
39 lab = conn.get_current_lab()
40 folder = lab.create_leaf_folder('my new folder')
41
42 seq1 = folder.add_sequence("seq1", "ATGCCGGGNAGGAGATGGT", "DNA")
43 seq2 = folder.add_sequence("seq2", "GAGAGNAGAGAGAGATATATAGC", "DNA")
44
45 pair = folder.add_pair_analysis_group("pairwise group", seq1, seq2)
46
47 pair.add_seqcomp_analysis('test seqcomp', 20, 0.7)
48 pair.add_blastz_analysis('test blastz')
49 pair.add_lagan_vista_analysis('lagan/vista', 100, 0.7)
Note: See TracBrowser for help on using the browser.