# [SciPy-User] FW: curve fitting by a sum of gaussian with scipy

Stéphanie haaaaaaaa flower_des_iles@hotmail....
Thu Apr 18 07:24:50 CDT 2013

```Dear all,

I'm doing bioinformatics and we map small RNA on mRNA. We have the
mapping coordinate of a protein on each mRNA and we calculate the
relative distance between the place where the protein is bound on the mRNA and
the site that is bound by a small RNA.

I obtain the following dataset :

dist    eff
-69 3
-68 2
-67 1
-66 1
-60 1
-59 1
-58 1
-57 2
-56 1
-55 1
-54 1
-52 1
-50 2
-48 3
-47 1
-46 3
-45 1
-43 1
0   1
1   2
2   12
3   18
4   18
5   13
6   9
7   7
8   5
9   3
10  1
13  2
14  3
15  2
16  2
17  2
18  2
19  2
20  2
21  3
22  1
24  1
25  1
26  1
28  2
31  1
38  1
40  2

When i plot the data, i have 3 pics : 1 at around 3/4
another one around 20 and a last one around -50. (see attached file, upper graph)

I try cubic spline interpolation, but it does'nt work very well for my data (see attached file 2, red curve).

My idea was to do curve fitting with a sum of gaussians.
For example in my case, estimate 3 gaussian curve around the peak (at point 5,20 and -50).

How can i do so ?

I looked at scipy.optimize.curve_fit(), but how can i fit the curve at precise intervalle ?
How can i add the curve to have one single curve ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130418/ff7f15ac/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20m1.png
Type: image/png
Size: 18653 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20130418/ff7f15ac/attachment-0002.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interpol_20m1.png
Type: image/png
Size: 43311 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20130418/ff7f15ac/attachment-0003.png
```