4 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.
9 #include "ProfileStandard.h"
21 ProfileStandard::ProfileStandard(int prfLen, int firstS, int lastS)
22 : ProfileBase(prfLen, firstS, lastS)
30 void ProfileStandard::resetPrf2()
41 void ProfileStandard::calcStandardProfile(SeqArray* seqArray, vector<int>* seqWeight)
43 /** DONT FORGET TO CHECK THE SIZES ARE CORRECT */
48 int _maxAA = userParameters->getMaxAA();
49 profile.resize(prfLength + 2, vector<int>(LENCOL + 2));
50 int _gapPos1 = userParameters->getGapPos1();
51 int _gapPos2 = userParameters->getGapPos2();
53 for (r = 0; r < prfLength; r++)
56 * calculate sum2 = number of residues found in this column
59 for (i = firstSeq; i < lastSeq; i++)
61 sum2 += (*seqWeight)[i];
64 * only include matrix comparison scores for those residue types found in this
69 for (d = 0; d <= _maxAA; d++)
71 profile[r + 1][d] = 0;
74 profile[r + 1][_gapPos1] = 0;
75 profile[r + 1][_gapPos2] = 0;
79 for (d = 0; d <= _maxAA; d++)
82 for (i = firstSeq; i < lastSeq; i++)
84 if (d == (*seqArray)[i][r])
86 sum1 += (*seqWeight)[i];
89 profile[r + 1][d] = (int)(10 *(float)sum1 / (float)sum2);
93 for (i = firstSeq; i < lastSeq; i++)
95 if (_gapPos1 == (*seqArray)[i][r])
97 sum1 += (*seqWeight)[i];
100 profile[r + 1][_gapPos1] = (int)(10 *(float)sum1 / (float)sum2);
103 for (i = firstSeq; i < lastSeq; i++)
105 if (_gapPos2 == (*seqArray)[i][r])
107 sum1 += (*seqWeight)[i];
110 profile[r + 1][_gapPos2] = (int)(10 *(float)sum1 / (float)sum2);