Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Feb 16, 2024
1 parent 0368283 commit abab073
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
37 changes: 23 additions & 14 deletions src/test/TestDiagonalScoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ int main (int, const char**) {
// std::cout << compositionBias[i] << " ";
// }
// std::cout << std::endl;
// matcher.createProfile(&s5, compositionBias);
// for(size_t i = 0; i < s6.L; i++){
// hits[0].id = s6.getId();
// hits[0].diagonal = 0;
// hits[0].count = 0;
// matcher.processQuery(&s5, compositionBias, hits, 1, 0);
// matcher.align(hits, 1, 0);
// std::cout << hits[0].diagonal << " " << (int)hits[0].count << std::endl;
// }

Expand All @@ -121,75 +122,83 @@ int main (int, const char**) {

hits[0].id = s1.getId();
hits[0].diagonal = 0;
matcher.processQuery(&s1, compositionBias, hits, 1);
matcher.createProfile(&s1, compositionBias);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

for(int i = 0; i < 16; i++){
hits[i].id = s1.getId();
hits[i].diagonal = 0;
}
matcher.processQuery(&s1, compositionBias, hits, 16);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;


matcher.createProfile(&s2, compositionBias);
hits[0].id = s1.getId();
hits[0].diagonal = 9;
matcher.processQuery(&s2, compositionBias, hits, 1);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

for(int i = 0; i < 16; i++){
hits[i].id = s1.getId();
hits[i].diagonal = 9;
}
matcher.processQuery(&s2, compositionBias, hits, 16);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

for(int i = 0; i < 16; i++){
hits[i].id = s2.getId();
hits[i].diagonal = -9;
}
matcher.processQuery(&s1, compositionBias, hits, 16);
matcher.createProfile(&s1, compositionBias);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

matcher.processQuery(&s1, compositionBias, hits, 1);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

for(int i = 0; i < 16; i++){
hits[i].id = s2.getId();
hits[i].diagonal = -9;
}
matcher.processQuery(&s3, compositionBias, hits, 16);
matcher.createProfile(&s3, compositionBias);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

matcher.processQuery(&s3, compositionBias, hits, 1);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;


hits[0].id = s4.getId();
hits[0].diagonal = -256;
matcher.processQuery(&s1, compositionBias, hits, 1);
matcher.createProfile(&s1, compositionBias);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;


hits[0].id = s1.getId();
hits[0].diagonal = 256;
matcher.processQuery(&s4,compositionBias, hits, 1);
matcher.createProfile(&s4, compositionBias);
matcher.align(hits, 1);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

hits[0].id = s7.getId();
hits[0].diagonal = -512;
matcher.processQuery(&s1,compositionBias, hits, 16);
matcher.createProfile(&s1, compositionBias);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

hits[0].id = s1.getId();
hits[0].diagonal = 512;
matcher.processQuery(&s7,compositionBias, hits, 16);
matcher.createProfile(&s7, compositionBias);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;


hits[0].id = s7.getId();
hits[0].diagonal = 0;
matcher.processQuery(&s7, compositionBias, hits, 16);
matcher.align(hits, 16);
std::cout << ExtendedSubstitutionMatrix::calcScore(s1.numSequence, s1.numSequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].count << std::endl;

delete [] compositionBias;
Expand Down
14 changes: 7 additions & 7 deletions src/test/TestDiagonalScoringPerformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ int main (int, const char**) {
SubstitutionMatrix::calcLocalAaBiasCorrection(&subMat, s1.numSequence, s1.L, compositionBias, 1.0);



matcher.processQuery(&s1,compositionBias, hits, 16);
matcher.createProfile(&s1, compositionBias);
matcher.align(hits, 16);
std::cout << (int)hits[0].count << " ";
std::cout << (int)hits[1].count << " ";
std::cout << (int)hits[2].count << " ";
std::cout << (int)hits[3].count << std::endl;

matcher.processQuery(&s1, compositionBias, hits, 1);
matcher.processQuery(&s1, compositionBias, hits + 1, 1);
matcher.processQuery(&s1, compositionBias, hits + 2, 1);
matcher.processQuery(&s1, compositionBias, hits + 3, 1);
matcher.align(hits, 1);
matcher.align(hits + 1, 1);
matcher.align(hits + 2, 1);
matcher.align(hits + 3, 1);

std::cout << (int)hits[0].count<< " ";
std::cout << (int)hits[1].count<< " ";
Expand All @@ -114,7 +114,7 @@ int main (int, const char**) {
hits[j].diagonal = rand()%s1.L;
}
// std::reverse(hits, hits+1000);
matcher.processQuery(&s1, compositionBias, hits, 16000);
matcher.align(hits, 16000);
}
// std::cout << ExtendedSubstitutionMatrix::calcScore(s1.sequence, s1.sequence,s1.L, subMat.subMatrix) << " " << (int)hits[0].diagonalScore << std::endl;
// std::cout << (int)hits[0].diagonalScore << std::endl;
Expand Down

0 comments on commit abab073

Please sign in to comment.