Skip to content

Commit ee4916c

Browse files
committed
fix errors
1 parent b8cecb6 commit ee4916c

File tree

8 files changed

+33
-155
lines changed

8 files changed

+33
-155
lines changed

src/commons/Newick.cpp

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/commons/Newick.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/commons/StructureSmithWaterman.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ StructureSmithWaterman::s_align StructureSmithWaterman::alignStartPosBacktrace<S
645645
template
646646
StructureSmithWaterman::s_align StructureSmithWaterman::alignStartPosBacktrace<StructureSmithWaterman::PROFILE_HMM>(const unsigned char*, const unsigned char*, int32_t, const uint8_t, const uint8_t, const uint8_t, std::string& , StructureSmithWaterman::s_align, const int, const float, const int32_t);
647647

648-
void trimCIGAR(std::string &cigar, int &qStart, int &qEnd, int &tStart, int &tEnd) {
648+
void trimCIGAR(std::string &cigar, int &qEnd, int &tEnd) {
649649
int i = 0;
650650
while (cigar[i] != 'M') {
651651
if (cigar[i] == 'D') {
@@ -714,12 +714,13 @@ Matcher::result_t StructureSmithWaterman::simpleGotoh(
714714
short **target_profile_word_3di,
715715
int32_t query_start, int32_t query_end,
716716
int32_t target_start, int32_t target_end,
717-
const short gap_open, const short gap_extend, bool targetIsProfile,
718-
size_t queryId,
719-
size_t targetId
717+
const short gap_open, const short gap_extend
718+
// bool targetIsProfile,
719+
// size_t queryId,
720+
// size_t targetId
720721
) {
721722
// defining constants for backtracing
722-
const uint8_t B = 0b00000001;
723+
// const uint8_t B = 0b00000001;
723724
const uint8_t H = 0b00000010;
724725
const uint8_t F = 0b00000100;
725726
const uint8_t E = 0b00001000;
@@ -876,7 +877,7 @@ Matcher::result_t StructureSmithWaterman::simpleGotoh(
876877
// Adjust CIGAR string to start/end on M
877878
// q/dbStart and q/dbEnd are already correct, no need to adjust here
878879
// q/dbStart set to last M j/i, q/dbEnd last M .ref/.read
879-
trimCIGAR(cigar, qStart, qEnd, dbStart, dbEnd);
880+
trimCIGAR(cigar, qEnd, dbEnd);
880881

881882
delete[] workspace;
882883
delete[] btMatrix;

src/commons/StructureSmithWaterman.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,10 @@ class StructureSmithWaterman{
160160
short **target_profile_word_3di,
161161
int32_t query_start, int32_t query_end,
162162
int32_t target_start, int32_t target_end,
163-
const short gap_open, const short gap_extend, bool targetIsProfile,
164-
size_t queryId,
165-
size_t targetId
163+
const short gap_open, const short gap_extend
164+
// bool targetIsProfile,
165+
// size_t queryId,
166+
// size_t targetId
166167
);
167168

168169
/*! @function Create the query profile using the query sequence.

src/strucclustutils/refinemsa.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ void refineOne(
8686
MsaFilter &filter_3di,
8787
SubstitutionMatrix &subMat_3di,
8888
StructureSmithWaterman &structureSmithWaterman,
89-
float matchRatio,
9089
std::vector<int> &seqLens,
9190
bool filterMsa,
9291
bool compBiasCorrection,
@@ -99,7 +98,6 @@ void refineOne(
9998
bool wg,
10099
int gapExtend,
101100
int gapOpen,
102-
size_t maxSeqLength,
103101
std::vector<Sequence*> &sequences_aa,
104102
std::vector<Sequence*> &sequences_ss
105103
) {
@@ -125,31 +123,31 @@ void refineOne(
125123
deleteGapCols(group2, cigars_aa, cigars_ss);
126124

127125
// generate masks for each sub MSA
128-
std::string mask1 = computeProfileMask(group1, cigars_aa, seqLens, subMat_aa, 1);
129-
std::string mask2 = computeProfileMask(group2, cigars_aa, seqLens, subMat_aa, 1);
126+
std::string mask1 = computeProfileMask(group1, cigars_aa, seqLens, subMat_aa, 1.0);
127+
std::string mask2 = computeProfileMask(group2, cigars_aa, seqLens, subMat_aa, 1.0);
130128
std::vector<int> map1 = maskToMapping(mask1);
131129
std::vector<int> map2 = maskToMapping(mask2);
132130

133131
// msa2profile
134132
std::string profile1_aa = msa2profile(
135133
group1, cigars_aa, mask1, calculator_aa, filter_aa,
136134
subMat_aa, filterMsa, compBiasCorrection, qid, filterMaxSeqId,
137-
Ndiff, covMSAThr, qsc, filterMinEnable, wg, maxSeqLength
135+
Ndiff, covMSAThr, qsc, filterMinEnable, wg
138136
);
139137
std::string profile1_ss = msa2profile(
140138
group1, cigars_ss, mask1, calculator_3di, filter_3di,
141139
subMat_3di, filterMsa, compBiasCorrection, qid, filterMaxSeqId,
142-
Ndiff, covMSAThr, qsc, filterMinEnable, wg, maxSeqLength
140+
Ndiff, covMSAThr, qsc, filterMinEnable, wg
143141
);
144142
std::string profile2_aa = msa2profile(
145143
group2, cigars_aa, mask2, calculator_aa, filter_aa,
146144
subMat_aa, filterMsa, compBiasCorrection, qid, filterMaxSeqId,
147-
Ndiff, covMSAThr, qsc, filterMinEnable, wg, maxSeqLength
145+
Ndiff, covMSAThr, qsc, filterMinEnable, wg
148146
);
149147
std::string profile2_ss = msa2profile(
150148
group2, cigars_ss, mask2, calculator_3di, filter_3di,
151149
subMat_3di, filterMsa, compBiasCorrection, qid, filterMaxSeqId,
152-
Ndiff, covMSAThr, qsc, filterMinEnable, wg, maxSeqLength
150+
Ndiff, covMSAThr, qsc, filterMinEnable, wg
153151
);
154152
assert(profile1_aa.length() == profile1_ss.length());
155153
assert(profile2_aa.length() == profile2_ss.length());
@@ -213,7 +211,6 @@ void refineMany(
213211
bool compBiasCorrection,
214212
bool wg,
215213
float filterMaxSeqId,
216-
float matchRatio,
217214
float qsc,
218215
int Ndiff,
219216
float covMSAThr,
@@ -256,9 +253,9 @@ void refineMany(
256253
cigars_new_aa, cigars_new_ss,
257254
calculator_aa, filter_aa, subMat_aa,
258255
calculator_3di, filter_3di, subMat_3di,
259-
structureSmithWaterman, matchRatio, lengths, filterMsa, compBiasCorrection,
256+
structureSmithWaterman, lengths, filterMsa, compBiasCorrection,
260257
qid, filterMaxSeqId, Ndiff, covMSAThr, qsc, filterMinEnable,
261-
wg, gapExtend, gapOpen, maxSeqLen,
258+
wg, gapExtend, gapOpen,
262259
sequences_aa, sequences_ss
263260
);
264261
float lddtScore = std::get<2>(calculate_lddt(cigars_new_aa, subset, indices, lengths, seqDbrCA, pairThreshold));
@@ -277,7 +274,7 @@ void refineMany(
277274
if (delta > 0.0) {
278275
std::cout << std::fixed << std::setprecision(4) << "Final LDDT: " << prevLDDT << " (+" << delta << ")\n";
279276
} else {
280-
std::cout << "Could not improve MSA\n";
277+
std::cout << "Did not improve MSA\n";
281278
}
282279
for (size_t i = 0; i < sequences_aa.size(); i++) {
283280
delete sequences_aa[i];
@@ -361,7 +358,7 @@ int refinemsa(int argc, const char **argv, const Command& command) {
361358
tinySubMatAA, tinySubMat3Di, &seqDbrCA, cigars_aa, cigars_ss,
362359
calculator_aa, filter_aa, subMat_aa, calculator_3di, filter_3di, subMat_3di,
363360
structureSmithWaterman, par.refineIters, par.compBiasCorrection, par.wg, par.filterMaxSeqId,
364-
par.matchRatio, par.qsc, par.Ndiff, par.covMSAThr,
361+
par.qsc, par.Ndiff, par.covMSAThr,
365362
par.filterMinEnable, par.filterMsa, par.gapExtend.values.aminoacid(), par.gapOpen.values.aminoacid(),
366363
par.maxSeqLen, par.qid, par.pairThreshold, indices, lengths
367364
);

src/strucclustutils/refinemsa.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void refineMany(
1818
bool compBiasCorrection,
1919
bool wg,
2020
float filterMaxSeqId,
21-
float matchRatio,
21+
// float matchRatio,
2222
float qsc,
2323
int Ndiff,
2424
float covMSAThr,

src/strucclustutils/structuremsa.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "MathUtil.h"
1010
#include "MsaFilter.h"
1111
#include "MultipleAlignment.h"
12-
#include "Newick.h"
1312
#include "PSSMCalculator.h"
1413
#include "Parameters.h"
1514
#include "Sequence.h"
@@ -303,10 +302,7 @@ Matcher::result_t pairwiseAlignment(
303302
0,
304303
target_aa->L,
305304
gapOpen,
306-
gapExtend,
307-
targetIsProfile,
308-
query_aa->getId(),
309-
target_aa->getId()
305+
gapExtend
310306
);
311307

312308
for (int32_t i = 0; i < aligner.get_profile()->alphabetSize; i++) {
@@ -671,7 +667,7 @@ std::string computeProfileMask(
671667
for (int i = 0; i < lengthWithGaps; i++) {
672668
float matches = colValues[i];
673669
float gaps = colValues[lengthWithGaps + i];
674-
bool state = (gaps / (gaps + matches)) > matchRatio;
670+
bool state = (gaps / (gaps + matches)) >= matchRatio;
675671
mask.push_back(state ? '1' : '0');
676672
}
677673

@@ -705,8 +701,7 @@ std::string msa2profile(
705701
float covMSAThr,
706702
float qsc,
707703
int filterMinEnable,
708-
bool wg,
709-
size_t maxSeqLength
704+
bool wg
710705
) {
711706
// length of sequences after masking
712707
int lengthWithMask = 0;
@@ -1240,11 +1235,10 @@ void updateCIGARS(
12401235
updateTargetCIGAR(cigars_aa[index], cigars_ss[index], tBt, tPreGaps, tPreSequence, tEndGaps, tEndSequence);
12411236
}
12421237

1243-
void testSeqLens(std::vector<size_t> &indices, std::vector<std::vector<Instruction2> > &cigars, std::vector<int> &lengths) {
1244-
for (int index : indices) {
1245-
int length = cigarLength(cigars[index], false);
1238+
void testSeqLens(std::vector<size_t> &MAYBE_UNUSED(indices), std::vector<std::vector<Instruction2> > &MAYBE_UNUSED(cigars), std::vector<int> &MAYBE_UNUSED(lengths)) {
1239+
for (int MAYBE_UNUSED(index) : indices) {
1240+
assert(lengths[index] == cigarLength(cigars[index], false));
12461241
// std::cout << headers[index] << '\t' << lengths[index] << '\t' << length << '\n';
1247-
assert(lengths[index] == length);
12481242
}
12491243
}
12501244

@@ -1706,7 +1700,7 @@ int structuremsa(int argc, const char **argv, const Command& command, bool preCl
17061700
if (true) {
17071701
// calculate LDDT of merged alignment
17081702
float lddtScore = std::get<2>(calculate_lddt(cigars_aa, groups[mergedId], dbKeys, seqLens, &seqDbrCA, par.pairThreshold));
1709-
std::cout << std::fixed << std::setprecision(3)
1703+
std::cout << std::fixed << std::setprecision(4)
17101704
<< queryIsProfile << "\t" << targetIsProfile << '\t' << headers[mergedId] << "\t" << headers[targetId]
17111705
<< "\tLDDT: " << lddtScore << '\t' << res.score;
17121706
if (tmaligned){
@@ -1737,8 +1731,7 @@ if (true) {
17371731
par.covMSAThr,
17381732
par.qsc,
17391733
par.filterMinEnable,
1740-
par.wg,
1741-
1
1734+
par.wg
17421735
);
17431736
std::string profile_3di = msa2profile(
17441737
groups[mergedId],
@@ -1755,8 +1748,7 @@ if (true) {
17551748
par.covMSAThr,
17561749
par.qsc,
17571750
par.filterMinEnable,
1758-
par.wg,
1759-
par.maxSeqLen
1751+
par.wg
17601752
);
17611753
assert(profile_aa.length() == profile_3di.length());
17621754

@@ -1790,7 +1782,7 @@ if (true) {
17901782
refineMany(
17911783
tinySubMatAA, tinySubMat3Di, &seqDbrCA, cigars_aa, cigars_ss, calculator_aa,
17921784
filter_aa, subMat_aa, calculator_3di, filter_3di, subMat_3di, structureSmithWaterman,
1793-
par.refineIters, par.compBiasCorrection, par.wg, par.filterMaxSeqId, par.matchRatio, par.qsc,
1785+
par.refineIters, par.compBiasCorrection, par.wg, par.filterMaxSeqId, par.qsc,
17941786
par.Ndiff, par.covMSAThr, par.filterMinEnable, par.filterMsa, par.gapExtend.values.aminoacid(),
17951787
par.gapOpen.values.aminoacid(), par.maxSeqLen, par.qid, par.pairThreshold, dbKeys, seqLens
17961788
);

src/strucclustutils/structuremsa.h

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,6 @@ union Instruction2 {
6363
}
6464
};
6565

66-
std::string fastamsa2profile(
67-
std::string & msa,
68-
PSSMCalculator &pssmCalculator,
69-
MsaFilter &filter,
70-
SubstitutionMatrix &subMat,
71-
size_t maxSeqLength,
72-
size_t maxSetSize,
73-
float matchRatio,
74-
bool filterMsa,
75-
bool compBiasCorrection,
76-
std::string & qid,
77-
float filterMaxSeqId,
78-
float Ndiff,
79-
float covMSAThr,
80-
float qsc,
81-
int filterMinEnable,
82-
bool wg,
83-
bool *externalMaskedColumns,
84-
float scoreBias
85-
);
86-
8766
void getMergeInstructions(
8867
Matcher::result_t &res,
8968
std::vector<int> &map1,
@@ -131,8 +110,7 @@ std::string msa2profile(
131110
float covMSAThr,
132111
float qsc,
133112
int filterMinEnable,
134-
bool wg,
135-
size_t maxSeqLength
113+
bool wg
136114
);
137115

138116
void updateCIGARS(

0 commit comments

Comments
 (0)