NCBI C++ ToolKit
thrdspea.c
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: thrdspea.c 52148 2011-12-01 14:12:00Z thiessen $
2 *===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name: thrdspea.c
27 *
28 * Author: Stephen Bryant
29 *
30 * Initial Version Creation Date: 08/16/2000
31 *
32 * $Revision: 52148 $
33 *
34 * File Description: threader
35 */
36 
37 
38 
41 
42 /* Update segment pair energies as they are stored during alignment sampling. */
43 /* The segment pairwise term contains the sum of the pairwise components of */
44 /* the side-chain to side-chain contact potential. The segment term contains */
45 /* the sum of side-chain "profile" terms, including side-chain to side-chain */
46 /* hydrophobic components, side-chain to peptide hydrophobic and pairwise */
47 /* components, and side-chain to fixed-residue pairwise and hydrohobic */
48 /* components. */
49 
50 /*int*/ void spea(Cor_Def* cdf, Cxl_Als** cpa, Cur_Aln* sai, Cur_Loc* sli,
51  int n, int h, Seg_Gsm* spe, Seq_Mtf* psm, Seg_Cmp* spc) {
52 /*--------------------------------------------------------*/
53 /* cpa: Contacts by segment, given current location */
54 /* sli: Current locations of core segments in the motif */
55 /* sai: Current alignment of query sequence with core */
56 /* n: Segment for which partial sums are to be updated */
57 /* h: If zero, include only hydropohobic/profile terms */
58 /* spe: Partial sums of contact energies by segment pair */
59 /* psm: Sequence motif parameters */
60 /* cdf: Core definition data structure */
61 /* spc: Residue type composition of current threaded seq */
62 /*--------------------------------------------------------*/
63 
64 int nsc; /* Number of threaded segments in core definition */
65 int i,j; /* Counters */
66 int r1,r2; /* Residue indices in core motif */
67 int s1,s2; /* Segment indices in core motif */
68 int t1,t2; /* Residue type indices */
69 Cxl_Als *ca; /* Pointer to contact list of the current segment */
70 int gs; /* Potential profile energy sum */
71 int ms; /* Motif energy sum */
72 int mn, mx;
73 /*int nrt;*/ /* Number of residue types in potential */
74 
75 
76 /* Parameters */
77 
78 nsc=sai->nsc;
79 /*nrt=spc->nrt;*/
80 
81 /* Set pointer to current contact list */
82 
83 ca=cpa[n];
84 /* printf("nsc:%d n:%d\n",nsc,n); */
85 
86 
87 /* Zero segment pairwise sums for the current segment */
88 
89 /* if(h!=0) for(i=0;i<nsc;i++) { spe->gss[n][i]=0; spe->gss[i][n]=0; } */
90 for(i=0;i<nsc;i++) { spe->gss[n][i]=0; spe->gss[i][n]=0; }
91 
92 
93 /* Sum potential for residue-residue contacts */
94 
95 if(h!=0) for(i=0; i<ca->rr.n; i++) {
96  r1=ca->rr.r1[i];
97  t1=sai->sq[r1];
98  if(t1<0) continue;
99  s1=sli->cr[r1];
100  r2=ca->rr.r2[i];
101  t2=sai->sq[r2];
102  if(t2<0) continue;
103  s2=sli->cr[r2];
104  /* printf("i:%d r1:%d r2:%d s1:%d s2:%d t1:%d t2:%d\n",
105  i,r1,r2,s1,s2,t1,t2); */
106  spe->gss[s1][s2]+= ca->rr.e[i][t1][t2];
107  /* printf("spe->gss[%d][%d]:%d\n",s1,s2,spe->gss[s1][s2]); */
108  }
109 
110 
111 /* Sum energies for "profile" terms */
112 
113 /* Sum potential hydr/pept/fixed energies */
114 
115 gs=0;
116 for(i=0;i<ca->r.n;i++) {
117  t1=sai->sq[ca->r.r[i]];
118  if(t1<0) continue;
119  gs+=ca->r.e[i][sai->sq[ca->r.r[i]]];
120  }
121 spe->gs[n]=gs;
122 
123 /* for(j=0; j<nsc; j++) {
124  for(i=0; i<nsc; i++) printf("%d ",spe->gss[j][i]);
125  printf("spe->gss[%d]\n",j); }
126 for(i=0; i<nsc; i++) printf("%d ",spe->gs[i]); printf("spe->gs\n"); */
127 
128 /* Sum motif energies */
129 
130 ms=0; /*s0=0;*/
131  mn=cdf->sll.rfpt[n]-sli->no[n];
132  mx=cdf->sll.rfpt[n]+sli->co[n];
133 
134 /*printf("\nAligned segment number:");printf("%d\n",n);
135 printf("sll.rfpt[n],cdf->sll.nomn[n],cdf->sll.comn[n]:");
136 printf("%d,%d,%d\n",cdf->sll.rfpt[n],
137 cdf->sll.nomn[n],cdf->sll.comn[n]);
138 printf("sai->al[n]:");printf("%d\n",sai->al[n]);
139 printf("mn,mx:");printf("%d,%d\n",mn,mx);*/
140 
141 
142 for(j=mn;j<=mx;j++) {
143  t1=sai->sq[j];
144  if(t1<0) continue;
145  ms+=psm->ww[j][t1];
146 
147 /* for(k=0;k<psm->AlphabetSize;k++){
148  s0+=psm->ww[j][k]*spc->rt[k]; } */
149 
150  }
151 
152 /*printf("Sequence of aligned segment");printf("%d,%d\n",sai->sq[j],ms);}*/
153 
154 
155 spe->ms[n]=ms;
156 
157 /* Sum conservation energies */
158 
159 /*
160 cs=0;
161 spe->cs[n]=cs;
162 */
163 
164 /* Sum loopout energies */
165 
166 /*
167 ls=0;
168 spe->ls[n]=ls;
169 */
170 
171 }
int i
yy_size_t n
static SLJIT_INLINE sljit_ins ms(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static const sljit_gpr r1
static const sljit_gpr r2
struct _Cor_Def::@23 sll
int * rfpt
Definition: thrdatd.h:69
int * sq
Definition: thrdatd.h:192
int nsc
Definition: thrdatd.h:191
int * cr
Definition: thrdatd.h:184
int * no
Definition: thrdatd.h:179
int * co
Definition: thrdatd.h:180
int * r1
Definition: thrdatd.h:260
int * r
Definition: thrdatd.h:266
int * r2
Definition: thrdatd.h:261
int n
Definition: thrdatd.h:263
struct _Cxl_Als::@27 rr
int *** e
Definition: thrdatd.h:262
int ** gss
Definition: thrdatd.h:225
int * gs
Definition: thrdatd.h:226
int * ms
Definition: thrdatd.h:227
int ** ww
Definition: thrdatd.h:318
void spea(Cor_Def *cdf, Cxl_Als **cpa, Cur_Aln *sai, Cur_Loc *sli, int n, int h, Seg_Gsm *spe, Seq_Mtf *psm, Seg_Cmp *spc)
Definition: thrdspea.c:50
Modified on Fri Sep 20 14:56:57 2024 by modify_doxy.py rev. 669887