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

Go to the SVN repository for this file.

1 /* $Id: thrdcpal.c 32839 2007-03-05 20:41:55Z kazimird $
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: thrdcpal.c
27 *
28 * Author: Stephen Bryant
29 *
30 * Initial Version Creation Date: 08/16/2000
31 *
32 * $Revision: 32839 $
33 *
34 * File Description: threader
35 */
36 
37 
38 
41 
42 /* List pairwise side-chain contacts by segment for the current core, with */
43 /* a pointer to the corresponding level of the pairwise component of the */
44 /* contact potential. Accumulate the hydrophobic component of side-chain to */
45 /* side-chain contacts, side-chain to peptide and side-chain to fixed-residue */
46 /* energies for each residue of a segment, for each possible residue type. */
47 /* This segment "profile" is used to compute the linear component of */
48 /* alternative-alignment energies, given the current core definition. */
49 
50 /* Note that the profile terms include the hydrophobic component energy for */
51 /* contacts involving a fixed group, either peptide or fixed-type side chain. */
52 /* These terms are constant across alternative sequence assigments, and will */
53 /* cancel when subracting the reference state energy sums, but are included */
54 /* that the same reference state sum may be used for core segment aligment */
55 /* location sampling. */
56 
57 /*int*/ void cpal(Rcx_Ptl* pmf, Cxl_Los** cpr, Cur_Loc* sli, Cxl_Als** cpa) {
58 /*-------------------------------------------------------*/
59 /* pmf: Potential of mean force as a 3-d lookup table */
60 /* cpr: Contacts by segment, largest possible set */
61 /* sli: Current locations of core segments in the motif */
62 /* cpa: Contacts and profile terms at current location */
63 /*-------------------------------------------------------*/
64 
65 int ppi; /* Index of peptide group in contact potential */
66 int nmt; /* Number of motif residue positions */
67 int nsc; /* Number of threaded core segments */
68 int nrt; /* Number of residue types in potential */
69 int i,j,k,l,n; /* Counters */
70 int r1,r2,d,t2; /* Motif residue positions */
71 int s1,s2; /* Core segment indices */
72 int *prt; /* Pointer to columns in the contact potential */
73 int *ert; /* Pointer to columns in contact list energy profiles */
74 Cxl_Los *cr; /* Pointer to and segment contact lists */
75 Cxl_Als *ca; /* Pointer to and segment contact lists */
76 
77 
78 /* Parameters */
79 
80 nsc=sli->nsc;
81 nmt=sli->nmt;
82 ppi=pmf->ppi;
83 nrt=pmf->nrt;
84 
85 /* printf("nmt %d\n",nmt);
86 printf("ppi %d\n",ppi);
87 printf("nrt %d\n",nrt);
88 printf("nsc %d\n",nsc); */
89 
90 
91 /* Zero pair counts */
92 
93 for(i=0; i<nsc; i++) { ca=cpa[i]; ca->r.n=0; ca->rr.n=0; }
94 
95 
96 /* Identify core segment residue indices and zero profile energies */
97 
98 for(i=0; i<nmt; i++) if(sli->cr[i]>=0) {
99  ca=cpa[sli->cr[i]];
100  n=ca->r.n;
101  ca->r.r[n]=i;
102  ert=ca->r.e[n]; for(j=0; j<nrt; j++) ert[j]=0;
103  ca->r.n++;
104  /* printf("position i:%d segment:%d count:%d\n",i, sli->cr[i],n);
105  for(j=0; j<nrt; j++) printf("%d ",ert[j]); printf("ca->r.e[%d]\n",n); */
106  }
107 
108 
109 /* Loop over core segments */
110 for(i=0; i<nsc; i++) {
111  ca=cpa[i];
112  cr=cpr[i];
113  /* printf("segment list:%d\n",i); */
114 
115  /* Loop over residue-residue contacts in the reference list */
116  for(j=0; j<cr->rr.n; j++) {
117 
118  /* Test that contact is present in the current core */
119  r1=cr->rr.r1[j];
120  s1=sli->cr[r1];
121  if(s1<0) continue;
122  r2=cr->rr.r2[j];
123  s2=sli->cr[r2];
124  if(s2<0) continue;
125  d=cr->rr.d[j];
126 
127  /* Copy pairwise contact energy pointer to the pair list */
128  k=ca->rr.n;
129  ca->rr.r1[k]=r1;
130  ca->rr.r2[k]=r2;
131  ca->rr.e[k]=pmf->rre[d];
132  ca->rr.n++;
133  /* printf("rr pair:%d r1:%d s1:%d r2:%d s2:%d d:%d\n",
134  j,r1,s1,r2,s2,d); */
135 
136  /* Add hydrophobic contact energy to the segment profile */
137  prt=pmf->re[d];
138  for(k=0;k<ca->r.n;k++) {
139  if(ca->r.r[k]==r1) {
140  ert=ca->r.e[k];
141  for(l=0;l<nrt;l++) ert[l]+=prt[l];
142  /* for(l=0; l<nrt; l++) printf("%d ",ert[l]);
143  printf("ca->r.e[%d]\n",k); */
144  }
145  if(ca->r.r[k]==r2) {
146  ert=ca->r.e[k];
147  for(l=0;l<nrt;l++) ert[l]+=prt[l];
148  /* for(l=0; l<nrt; l++) printf("%d ",ert[l]);
149  printf("ca->r.e[%d]\n",k); */
150  }
151  }
152  }
153 
154 
155 
156  /* Loop over residue-peptide contacts in the reference list */
157  for(j=0; j<cr->rp.n; j++) {
158 
159  /* Test that the contact is present in the current core */
160  r1=cr->rp.r1[j];
161  s1=sli->cr[r1];
162  if(s1<0) continue;
163  r2=cr->rp.p2[j];
164  s2=sli->cr[r2];
165  if(s2<0) continue;
166  d=cr->rp.d[j];
167  /* printf("rp pair:%d r1:%d s1:%d r2:%d s2:%d d:%d\n",
168  j,r1,s1,r2,s2,d); */
169 
170  /* Add total peptide contact energy to the segment profile */
171  for(k=0;k<ca->r.n;k++) if(ca->r.r[k]==r1) {
172  ert=ca->r.e[k];
173  prt=pmf->rrt[d][ppi];
174  for(l=0;l<nrt;l++) ert[l]+=prt[l];
175  /* for(l=0; l<nrt; l++) printf("%d ",ert[l]);
176  printf("ca->r.e[%d]\n",k); */
177  } }
178 
179 
180  /* Loop over residue-fixed contacts in the reference list */
181  for(j=0; j<cr->rf.n; j++) {
182 
183  /* Test that the contact is present in the current core */
184  r1=cr->rf.r1[j];
185  s1=sli->cr[r1];
186  if(s1<0) continue;
187  t2=cr->rf.t2[j];
188  d=cr->rf.d[j];
189  /* printf("rp pair:%d r1:%d s1:%d t2:%d d:%d\n",
190  j,r1,s1,t2,d); */
191 
192  /* Add fixed contact energy to the segment profile */
193  for(k=0;k<ca->r.n;k++) if(ca->r.r[k]==r1) {
194  ert=ca->r.e[k];
195  prt=pmf->rrt[d][t2];
196  for(l=0;l<nrt;l++) ert[l]+=prt[l];
197  /* for(l=0; l<nrt; l++) printf("%d ",ert[l]);
198  printf("ca->r.e[%d]\n",k); */
199  } }
200 
201  }
202 }
int i
yy_size_t n
static const sljit_gpr r1
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static const sljit_gpr r2
int * cr
Definition: thrdatd.h:184
int nmt
Definition: thrdatd.h:185
int nsc
Definition: thrdatd.h:181
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 * r2
Definition: thrdatd.h:276
int n
Definition: thrdatd.h:279
struct _Cxl_Los::@29 rr
struct _Cxl_Los::@30 rp
int * p2
Definition: thrdatd.h:283
int * r1
Definition: thrdatd.h:275
int * t2
Definition: thrdatd.h:290
struct _Cxl_Los::@31 rf
int * d
Definition: thrdatd.h:277
int *** rrt
Definition: thrdatd.h:105
int ** re
Definition: thrdatd.h:104
int nrt
Definition: thrdatd.h:106
int *** rre
Definition: thrdatd.h:103
int ppi
Definition: thrdatd.h:108
void cpal(Rcx_Ptl *pmf, Cxl_Los **cpr, Cur_Loc *sli, Cxl_Als **cpa)
Definition: thrdcpal.c:57
Modified on Fri Sep 20 14:57:45 2024 by modify_doxy.py rev. 669887