1 static char const rcsid[] = "$Id: splutil.c,v 6.7 2003/05/30 17:25:38 coulouri Exp $";
2
3 /* splutil.c
4 * ===========================================================================
5 *
6 * PUBLIC DOMAIN NOTICE
7 * National Center for Biotechnology Information (NCBI)
8 *
9 * This software/database is a "United States Government Work" under the
10 * terms of the United States Copyright Act. It was written as part of
11 * the author's official duties as a United States Government employee and
12 * thus cannot be copyrighted. This software/database is freely available
13 * to the public for use. The National Library of Medicine and the U.S.
14 * Government do not place any restriction on its use or reproduction.
15 * We would, however, appreciate having the NCBI and the author cited in
16 * any work or product based on this material
17 *
18 * Although all reasonable efforts have been taken to ensure the accuracy
19 * and reliability of the software and data, the NLM and the U.S.
20 * Government do not and cannot warrant the performance or results that
21 * may be obtained by using this software or data. The NLM and the U.S.
22 * Government disclaim all warranties, express or implied, including
23 * warranties of performance, merchantability or fitness for any particular
24 * purpose.
25 *
26 * ===========================================================================
27 *
28 * File Name: splutil.c
29 *
30 * Author: Sarah Wheelan
31 *
32 * $Revision: 6.7 $
33 *
34 * Contents: splice site matrices and associated utilites
35 *
36 * ==========================================================================
37 *
38 * $Log: splutil.c,v $
39 * Revision 6.7 2003/05/30 17:25:38 coulouri
40 * add rcsid
41 *
42 * Revision 6.6 2000/04/22 15:56:04 wheelan
43 * changed is_donor to take a FloatHiPtr instead of returning a FloatHi
44 *
45 * Revision 6.5 1998/09/24 12:46:17 wheelan
46 * put in log and revision stuff
47 *
48 *
49 *
50 */
51
52 #include <ncbi.h>
53 #include <sequtil.h>
54 #include <sqnutils.h>
55 #include <splutil.h>
56 /**********
57 #include <salutil.h>
58 #include <bandalgn.h>
59 #include <blast.h>
60 **********/
61
is_donor(CharPtr str,Int4 len,FloatHiPtr score)62 extern void is_donor (CharPtr str, Int4 len, FloatHiPtr score)
63 {
64 FloatHi one[4]={0.35, 0.35, 0.19, 0.11};
65 FloatHi two[4]={0.59, 0.13, 0.14, 0.14};
66 FloatHi three[4]={0.08, 0.02, 0.82, 0.08};
67 FloatHi four[4]={0.01, 0.01, 1.00, 0.01};
68 FloatHi five[4]={0.01, 0.01, 0.01, 1.00};
69 FloatHi six[4]={0.51, 0.03, 0.43, 0.03};
70 FloatHi seven[4]={0.71, 0.08, 0.12, 0.09};
71 FloatHi eight[4]={0.06, 0.05, 0.84, 0.05};
72 FloatHi nine[4]={0.15, 0.16, 0.17, 0.52};
73 FloatHi score1;
74 Int4 i;
75 Int4 PNTR num=NULL;
76
77 if (score == NULL)
78 return;
79 if ((num = MemNew((len+2)*sizeof(Int4)))==NULL) {
80 /* memory error */
81 return;
82 }
83
84 for (i = 0; i <= len; i++){
85 if (str[i]=='A')
86 num[i] = 0;
87 if (str[i]=='C')
88 num[i] = 1;
89 if (str[i]=='G')
90 num[i] = 2;
91 if (str[i]=='T')
92 num[i] = 3;
93 }
94 score1 = one[num[0]];
95 score1 *= two[num[1]];
96 score1 *= three[num[2]];
97 score1 *= four[num[3]];
98 score1 *= five[num[4]];
99 score1 *= six[num[5]];
100 score1 *= seven[num[6]];
101 score1 *= eight[num[7]];
102 score1 *= nine[num[8]];
103
104 MemFree(num);
105 num=NULL;
106
107 *score = score1;
108 return;
109 }
110
getSplicePos(CharPtr str,Int4 overlaplength)111 extern Int4 getSplicePos (CharPtr str, Int4 overlaplength)
112 {
113 Int4 offset = -1;
114 Int4 xcursor = 0;
115 Int4 c;
116 FloatHi topscore = 0.00,score;
117 Char tmpstr[9];
118
119 if (str == NULL)
120 return 0;
121
122 while (xcursor <= overlaplength)
123 {
124 for (c = 0; c < 9; c++)
125 {
126 tmpstr[c] = str[xcursor+c];
127 }
128 is_donor(tmpstr, 8, &score);
129 if (score > topscore)
130 {
131 topscore = score;
132 offset = xcursor;
133 }
134 xcursor += 1;
135 }
136 if (topscore > 0 && offset >=0)
137 return offset;
138 return 0;
139 }
140
141
is_acceptor(CharPtr str,Int4 len)142 extern FloatHi is_acceptor (CharPtr str, Int4 len)
143 {
144 FloatHi aone[4]={0.06, 0.44, 0.05, 0.44};
145 FloatHi atwo[4]={0.08, 0.37, 0.05, 0.49};
146 FloatHi athree[4]={0.27, 0.28, 0.22, 0.23};
147 FloatHi afour[4]={0.04, 0.74, 0.001, 0.22};
148 FloatHi afive[4]={1.00, 0.01, 0.01, 0.01};
149 FloatHi asix[4]={0.01, 0.01, 0.99, 0.01};
150 FloatHi aseven[4]={0.25, 0.16, 0.50, 0.09};
151 FloatHi ascore;
152 Int4 i;
153 Int4 PNTR num;
154
155
156 if ((num = MemNew(len*sizeof(Int4)))==NULL) {
157 /* memory error */
158 return(0);
159 }
160
161 for (i = 0; i <= len; i++){
162 if (str[i]=='A')
163 num[i] = 0;
164 if (str[i]=='C')
165 num[i] = 1;
166 if (str[i]=='G')
167 num[i] = 2;
168 if (str[i]=='T')
169 num[i] = 3;
170 }
171
172
173 ascore = aone[num[len-6]];
174 ascore *= atwo[num[len-5]];
175 ascore *= athree[num[len-4]];
176 ascore *= afour[num[len-3]];
177 ascore *= afive[num[len-2]];
178 ascore *= asix[num[len-1]];
179 ascore *= aseven[num[len]];
180
181 MemFree(num);
182 num=NULL;
183
184 return ascore;
185
186 }
187
188
189
190
191