ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/help/osprai-doc.html
Revision: 32
Committed: Fri Jul 23 01:23:44 2010 UTC (9 years, 2 months ago) by clausted
File size: 9271 byte(s)
Log Message:
Add a new directory to contain Osprai documentation files.  Help files consist of html and css.
Line File contents
1 <html>
2
3 <head>
4 <meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
5 <link rel="STYLESHEET" href="./osprai-doc.css" type="text/css" />
6 <title>OSPRAI Tutorial</title>
7 </head>
8
9 <body>
10 <h1>
11 OSPRAI Documentation
12 </h1>
13
14 <p>
15 OSPRAI is the Open-source SPR Analysis and Integration software.
16 </p>
17
18 <h2>
19 Getting Started
20 </h2>
21
22 <h3>
23 1. Software installation
24 </h3>
25 OSPRAI is written in Python so as to run on all popular platforms, including Linux, Windows, and Macintosh.
26 Install Python 2.4 (or newer) and the following libraries: python-tk, matplotlib, and scipy.
27 Additionally, it is useful to install IPython, the interaction Python shell, as well as a good python-aware text editor, such as Scite or gedit.
28 OSPRAI is hosted by Bioinformatics.org and managed using the Subversion version control system.
29 It can be obtained from the website or by using a Subversion client such as Svn, RapidSVN, or TortoiseSVN.
30 Windows users can install all of the necessary prerequisites by installing PythonXY (link), while Ubuntu Linux users can find everything they need in the Ubuntu repositories.
31 An example for Ubuntu users follows.
32
33 <pre>
34 > sudo apt-get install python-tk python-matplotlib scipy ipython scite
35 > svn checkout svn://bioinformatics.org/svnroot/osprai/osprai
36 </pre>
37
38
39 <h3>
40 2. Viewing data from an SPR file
41 </h3>
42 Analysis begins with viewing data generated by a biosensor instrument such as a Biacore or Plexera.
43 Launch a python interpreter such as the standard interpreter or IPython and navigate to the directory containing the OSPRAI code and example data files.
44 Enter the following commands to load and view an example data file.
45
46 <pre>
47 >>> from osprai_one import *
48 >>> ba1 = readicmtxt("example-icm.txt")
49 <em>This ICM files has 6034 datapoints for 25 ROIs.</em>
50 >>> linegraph(ba1)
51 <img src="figure02.png">
52 </pre>
53
54 The first line imports all of the functions and data classes needed by the user.
55 Function <samp>readicmtxt()</samp> reads an SPR data file saved by the Plexera Instrument Control Software.
56 Other data formats are supported and described later.
57 A object of the class Biosensor_array is created named <var>ba1</var> containing the data.
58 Function <samp>linegraph()</samp> plots the data as a sensorgram--the SPR signal versus time.
59
60 <h3>
61 3. Calibration and background subtraction
62 </h3>
63 Data produced by a biosensing instrument can be reported as angle shift, reflectance, wavelength shift, resonance units (RU), or other units.
64 This data can come from a single surface or channel, in which case the bulk refractive index changes of the samples and washes can be seen, or it may be the difference between two surfaces or channels.
65 The example file used here is uncalibrated and unreferenced.
66 Enter the following commands for calibration and referencing.
67
68 <pre>
69 >>> ba2 = calibrate(ba1, ba1, 2850, 3120, 1333000, 1334000)
70 >>> linegraph(ba2, "Calibrated SPR Data")
71 <img src="figure03a.png">
72 >>> bgset(ba2, 16)
73 >>> ba3 = bgsubt(ba2)
74 >>> dotgraph(ba3, "Referenced SPR Data")
75 <img src="figure03b.png">
76 >>> dualgraph(ba2, ba3, "Unreferenced and Referenced SPR Data")
77 <img src="figure03c.png">
78 </pre>
79
80 Function <samp>calibrate()</samp> uses the data in <var>ba1</var> to calibrate the data in <var>ba1</var> and place it in a new object <var>ba2</var>.
81 The two-point calibration uses the time points (t1,t2) where the refractive indices (n1,n2) are known.
82 In this case, we use t1=2850s with n1=1333000 <i>&#181</i>RIU, and t2=3120 with n2=1334000.
83 Function <samp>bgset()</samp> is used to specify one ROI as the reference for all ROIs in the ba object.
84 In this case, ROI number 16 is used.
85 No data is affected by this step.
86 To apply background subtraction, we call the <samp>bgsubt()</samp> function.
87 This creates a new object <var>ba3</var>.
88 Function <samp>dotgraph()</samp> provides a slightly different display, with dotted data points instead of continuous lines.
89 Function <samp>dualgraph()</samp> displays both dotted and continuous sensorgrams.
90 This feature is useful for comparing two related Biosensor_array objects of the same size.
91
92
93 <h3>
94 4. Data simulation
95 </h3>
96 Now we will create some simulated sensorgrams using a simple 1:1 interaction model.
97 ...the model is a reference to a function...
98 ...the parameters are provided as a list of lists...
99
100 <pre>
101 >>> reset
102 >>> from osprai_one import *
103 >>> dpar = {}
104 >>> dpar['t1'] = dict(value=30.0, min=30.0, max=30.0, fixed='fixed')
105 >>> dpar['rmax'] = dict(value=100.0, min=1.0, max=1000.0, fixed='fixed')
106 >>> dpar['conc'] = dict(value=1e-5, min=1e-12, max=1e1, fixed='fixed')
107 >>> dpar['cofa'] = dict(value=1.0, min=1e-10, max=1e10, fixed='fixed')
108 >>> dpar['kon'] = dict(value=2e4, min=1e1, max=1e10, fixed='fixed')
109 >>> dpar['t2'] = dict(value=150.0, min=150.0, max=150.0, fixed='fixed')
110 >>> dpar['koff'] = dict(value=1e-2, min=1e-5, max=1e-1, fixed='fixed')
111 >>> dpar['t3'] = dict(value=270.0, min=270.0, max=270.0, fixed='fixed')
112 >>> dpar
113 <em>{'cofa': {'fixed': 'fixed', 'max': 10000000000.0, 'min': 1e-010, 'value
114 'conc': {'fixed': 'fixed','max': 10.0,'min': 1.0e-012,'value': 1.0e-005},
115 'koff': {'fixed': 'fixed','max': 0.1,'min': 1.0e-005,'value': 0.01},
116 'kon': {'fixed': 'fixed','max': 10000000000.0,'min': 10.0,'value': 20000.0},
117 'rmax': {'fixed': 'fixed', 'max': 1000.0, 'min': 1.0, 'value': 100.0},
118 't1': {'fixed': 'fixed', 'max': 30.0, 'min': 30.0, 'value': 30.0},
119 't2': {'fixed': 'fixed', 'max': 150.0, 'min': 150.0, 'value': 150.0},
120 't3': {'fixed': 'fixed', 'max': 270.0, 'min': 270.0, 'value': 270.0}}</em>
121
122 >>> ba1 = BiosensorArray(3,300)
123 >>> for roi in ba1.roi:
124 >>> roi.time = arange(300, dtype=float) ## Samples every 1 second.
125 >>> roi.value = zeros(300, dtype=float) + 20 ## Baseline signal is 20 units.
126 >>> roi.params = deepcopy(dpar)
127 >>> roi.model = simple1to1
128 >>> ba1.roi[0].params['cofa']['value'] = 1.0 / 27
129 >>> ba1.roi[1].params['cofa']['value'] = 1.0 / 9
130 >>> ba1.roi[2].params['cofa']['value'] = 1.0 / 3
131 >>> for roi in ba1.roi:
132 >>> roi.value = roi.model(roi.time, roi.value, roi.params)
133 >>> linegraph(ba1, "Simulation")
134 <img src="figure04.png">
135 </pre>
136
137
138 <h3>
139 5. Curve-fitting
140 </h3>
141 ...LME algorithm example...
142
143 <pre>
144 ## Constrain rmax belowtrue value to show what happens.
145 print "Testing the fitting..."
146 ba1 = deepcopy(ba0)
147 ## Set one kon, koff, rmax to float.
148 ba1.roi[0].params['koff']['fixed'] = 'float'
149 ba1.roi[0].params['kon']['fixed'] = 'float'
150 ba1.roi[0].params['rmax'] = {'value':10.0, 'min':1.0, 'max':80.0, 'fixed':'float'}
151 ba1.roi[1].params['koff']['fixed'] = 0
152 ba1.roi[1].params['kon']['fixed'] = 0
153 ba1.roi[1].params['rmax']['fixed'] = 0
154 ba1.roi[2].params['koff']['fixed'] = 0
155 ba1.roi[2].params['kon']['fixed'] = 0
156 ba1.roi[2].params['rmax']['fixed'] = 0
157 ## Fit and then plot.
158 mclma(ba1.roi)
159 for roi in ba1.roi:
160 roi.value =roi.model(roi.time, roi.value, roi.params)
161 dualgraph(ba0, ba1, "Fitted Data with an incorrect rmax constraint")
162 print "Done with test test_mdl_module_fit_module."
163 return
164 </pre>
165
166 <pre>
167 from osprai_one import *
168 def demo_mtl():
169 print "Test the model module..."
170 ba0 = BiosensorArray(1,300) ## Create ba1 with one ROI and 300 datapoints.
171 roi0 = ba0.roi[0]
172 roi0.time = arange(300, dtype=float) ## Samples every 1 second.
173 roi0.value = zeros(300, dtype=float) + 20 ## Baseline signal is 20 units.
174 roi0.params = {'t1': {'value':30.0, 'min':30.0, 'max':30.0, 'fixed':True} }
175 roi0.params['rmax'] = {'value': 100.0}
176 roi0.params['conc'] = {'value': 1e-6}
177 roi0.params['kon'] = {'value': 5e4}
178 roi0.params['t2'] = {'value': 150.0}
179 roi0.params['koff'] = {'value': 5e-3}
180 roi0.params['t3'] = {'value': 270.0}
181 roi0.params['kmtl'] = {'value': 2e6}
182 roi0.name = "kmtl=2e6"
183 roi0.model = simple1to1_mtl
184 roi0.value =roi0.model(roi0.time, roi0.value, roi0.params)
185
186 ba1 = deepcopy(ba0)
187 roi0 = ba1.roi[0]
188 roi0.name = "No MTL"
189 roi0.model = simple1to1
190 roi0.value =roi0.model(roi0.time, roi0.value, roi0.params)
191 dualgraph(ba0, ba1, "With and without MTL")
192 print "Done with test demo_mtl."
193 </pre>
194
195
196 <h3>
197 6. File format conversion
198 </h3>
199 ...examples of formats...
200
201 <pre>
202 print "Test of scatterplot using time points 500, 1000, 1500, 2000"
203 scatterplot(ba3, 3600, 4200, 3600, 4700, "Scatterplot")
204
205 print "Cutting out an interval..."
206 ba3 = copyinterval(ba3, 2800, 6200)
207 linegraph(ba3)
208 print "Done with test test_cal_module_vu_module."
209 return
210 </pre>
211
212 <pre>
213 from osprai_one import *
214 print "Loading SPR data files..."
215 ba1 = readbiosensor("example-biosensor.txt")
216 ba1 = readicmtxt("example-icm.txt")
217 ba1 = readsprit("example-sprit.txt")
218 ba1 = applykey(ba1, "example-key.tsv")
219 print "Writing SPR data files..."
220 writesprit(ba1,"testwritesprit.txt")
221 writeclamp(ba1,"testwriteclamp.txt")
222 writebiosensor(ba1, "testwritebiosensor.txt")
223 print "Done with test_io_module."
224 </pre>
225
226 <hr>
227 <i>
228 Written by Christopher Lausted <br>
229 21 July 2010 <br>
230 Institute for Systems Biology <br>
231 </i>
232
233 </html>