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

Go to the SVN repository for this file.

1 /* $Id: thrddgri.c 52083 2011-11-28 14:23:58Z 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: thrddgri.c
27 *
28 * Author: Stephen Bryant
29 *
30 * Initial Version Creation Date: 08/16/2000
31 *
32 * $Revision: 52083 $
33 *
34 * File Description: threader
35 */
36 
37 
38 
41 
42 /* Compute sum of contact potentials G(r|m) */
43 
44 int g(Seg_Gsm* spe, Seq_Mtf* psm, Thd_Gsm* tdg) {
45 /*--------------------------------------------------------*/
46 /* spe: Partial sums of contact energies by segment pair */
47 /* psm: Sequence motif parameters */
48 /* tdg: Total thread energy */
49 /*--------------------------------------------------------*/
50 
51 int nsc; /* Number of threaded segments in core definition */
52 int i,j; /* Counters */
53 int g; /* Partial energy sum */
54 int *gi; /* Pointer to current row in segment pair table */
55 int ms,cs,ls;
56 /*int nrt;*/ /* Number of residue types */
57 /*int ntot;*/ /* Number of residues in the alignment */
58 /*int s0;*/
59 
60 /*nrt=spc->nrt;*/
61 /*ntot=0;*/
62 
63 
64 /*for(i=0;i<nrt-1;i++)ntot+=spc->rt[i];*/
65 
66 /* Sum energies for segments and segment pairs */
67 
68 nsc=spe->nsc; g=0; ms=0; cs=0; ls=0; /*s0=0;*/
69 for(i=0;i<nsc;i++) {
70 
71  g+=spe->gs[i];
72  ms+=spe->ms[i];
73  cs+=spe->cs[i];
74  ls+=spe->ls[i];
75 
76  gi=spe->gss[i];
77  for(j=0;j<nsc;j++) g+=gi[j]; }
78 
79  tdg->ms=(float)ms-psm->ww0;
80  tdg->cs=(float)cs;
81  tdg->ls=(float)ls;
82  tdg->m0=psm->ww0;
83 
84 return(g);
85 }
86 
87 
88 /* Compute reference state energy G0(r|m) */
89 
90 float g0(Seg_Nsm* spn, Thd_Cxe* cxe) {
91 /*------------------------------------------------------*/
92 /* spn: Partial sums of contact counts by segment pair */
93 /* cxe: Expected energy of a contact in current thread */
94 /*------------------------------------------------------*/
95 
96 int ndi; /* Number of distance intervals in potential */
97 int i; /* Counters */
98 float g0; /* Reference state energy */
99 
100 ndi=spn->ndi;
101 
102 /* Sum expected contact energy per contact times number of contacts */
103 g0=0.; for(i=0; i<ndi; i++) {
104 
105  /* Expected side-chain to side-chain contact energy */
106  g0+=((float)spn->srr[i])*cxe->rre[i];
107 
108  /* Expected side-chain to peptide contact energy */
109  g0+=((float)spn->srp[i])*cxe->rpe[i];
110 
111  /* Expected energy of side-chain to fixed-residue contacts */
112  g0+=((float)spn->srf[i])*cxe->rfe[i]; }
113 
114 return(g0);
115 
116 }
117 
118 
119 /* Compute thread energy */
120 
121 float dgri(Seg_Gsm* spe, Seg_Nsm* spn, Thd_Cxe* cxe, Thd_Gsm* tdg,
122  Seq_Mtf* psm, Seg_Cmp* spc) {
123 /*--------------------------------------------------------*/
124 /* spe: Partial sums of contact energies by segment pair */
125 /* spn: Partial sums of contact counts by segment pair */
126 /* cxe: Expected energy of a contact in current thread */
127 /* tdg: Energy of the current alignment, current core */
128 /* psm: Sequence motif parameters */
129 /* spc: Residue type composition of current threaded seq */
130 /*--------------------------------------------------------*/
131 
132 /* int g(); */
133 /* float g0(); */
134 
135 /* Find overall energy coming from the potential */
136 
137 tdg->g=g(spe,psm,tdg);
138 tdg->g0=g0(spn,cxe);
139 tdg->ps=((float)tdg->g)-tdg->g0;
140 
141 /* Find overall threading energy */
142 
143 tdg->dg=tdg->ps+tdg->ms+tdg->cs+tdg->ls;
144 
145 return(tdg->dg);
146 
147 }
int i
int nsc
Definition: thrdatd.h:231
int * cs
Definition: thrdatd.h:228
int ** gss
Definition: thrdatd.h:225
int * gs
Definition: thrdatd.h:226
int * ls
Definition: thrdatd.h:229
int * ms
Definition: thrdatd.h:227
int * srp
Definition: thrdatd.h:202
int * srr
Definition: thrdatd.h:200
int ndi
Definition: thrdatd.h:208
int * srf
Definition: thrdatd.h:205
float ww0
Definition: thrdatd.h:322
float * rre
Definition: thrdatd.h:239
float * rfe
Definition: thrdatd.h:241
float * rpe
Definition: thrdatd.h:240
float ps
Definition: thrdatd.h:250
float m0
Definition: thrdatd.h:252
float ls
Definition: thrdatd.h:254
float g0
Definition: thrdatd.h:248
float cs
Definition: thrdatd.h:253
float ms
Definition: thrdatd.h:251
float dg
Definition: thrdatd.h:249
int g
Definition: thrdatd.h:247
float g0(Seg_Nsm *spn, Thd_Cxe *cxe)
Definition: thrddgri.c:90
float dgri(Seg_Gsm *spe, Seg_Nsm *spn, Thd_Cxe *cxe, Thd_Gsm *tdg, Seq_Mtf *psm, Seg_Cmp *spc)
Definition: thrddgri.c:121
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
Definition: thrddgri.c:44
Modified on Tue Apr 16 20:11:32 2024 by modify_doxy.py rev. 669887