Commit 75296622 authored by Carsten Kemena's avatar Carsten Kemena

added more test to AlignmentMatrix

parent 53936896
......@@ -124,8 +124,8 @@ public:
simMat_ = mat;
}
void
get_score()
DataType
score()
{
return score_;
}
......@@ -197,6 +197,7 @@ AlignmentMatrix<DataType, SimMat>::nw(const SeqType &seq1, const SeqType &seq2)
}
}
}
score_ = matrix_[dim1_][dim2_].first;
}
......@@ -364,6 +365,7 @@ AlignmentMatrix<DataType, SimMat>::gotoh(const SeqType &seq1, const SeqType &seq
++itV;
}
}
score_ = matrices_[0][dim1_][dim2_].first;
}
......@@ -443,7 +445,10 @@ template<typename DataType, typename SimMat>
template<typename SeqType>
void
AlignmentMatrix<DataType, SimMat>::raspodom(const SeqType &seq1, const SeqType &seq2)
{}
{
}
template<typename DataType, typename SimMat>
void
......
......@@ -33,13 +33,12 @@
#include "../../src/sequence/Sequence.hpp"
#include "../../src/sequence/SequenceSet.hpp"
#include "../../src/utility/Matrix.hpp"
#include "../../src/utility/Settings.hpp"
#include "../../src/utility/SimilarityMatrix.hpp"
#include "../../src/utility/utility.hpp"
#include "../../src/align/AlignmentMatrix.hpp"
#include "../../src/align/nw_gotoh.hpp"
#include "../../src/align/sw.hpp"
#include "../../src/align/msa.hpp"
#include "../../src/DomainModule.hpp"
BOOST_AUTO_TEST_SUITE(AlignementMatrix_Test)
......@@ -110,6 +109,97 @@ BOOST_AUTO_TEST_CASE( gotoh_align_Test )
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected2.begin(), expected2.end());
}
BOOST_AUTO_TEST_CASE( Gotoh_alignDomain_Test2 )
{
BioSeqDataLib::Settings settings;
settings.readSettings();
fs::path matrixName = settings["dsm"] / "pfam-31.dsm";
BioSeqDataLib::DSM simMat(matrixName);
simMat.useNegative(true);
BioSeqDataLib::DomainExt dom;
BioSeqDataLib::DomainArrangement<BioSeqDataLib::Domain> seq1, seq2;
dom.accession("PF00244");
seq1.push_back(dom);
seq2.push_back(dom);
dom.accession("PF00244");
seq1.push_back(dom);
seq1.push_back(dom);
seq2.push_back(dom);
BioSeqDataLib::AlignmentMatrix<int, BioSeqDataLib::DSM> mat(-50, -10, simMat);
mat.gotoh(seq1, seq2);
std::vector<long int> eS1, eS2;
mat.traceback(eS1, eS2);
std::vector<long int> expected1 { 0, 1, 2};
std::vector<long int> expected2 { -1, 0, 1};
BOOST_CHECK_EQUAL_COLLECTIONS(eS1.begin(), eS1.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected2.begin(), expected2.end());
BOOST_CHECK_EQUAL(mat.score(), 190.0);
seq1.clear();
seq2.clear();
dom.accession("PF00244");
seq1.push_back(dom);
dom.accession("PF12881");
seq1.push_back(dom);
seq2.push_back(dom);
mat.gotoh(seq1, seq2);
mat.traceback(eS1, eS2);
expected1 = {0, 1};
expected2 = {-1, 0};
BOOST_CHECK_EQUAL_COLLECTIONS(eS1.begin(), eS1.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected2.begin(), expected2.end());
BOOST_CHECK_EQUAL(mat.score(), 90.0);
seq1.clear();
seq2.clear();
dom.accession("PF00244");
seq1.push_back(dom);
seq2.push_back(dom);
dom.accession("PF12881");
seq1.push_back(dom);
mat.gotoh(seq1, seq2);
mat.traceback(eS1, eS2);
expected1 = { 0, 1};
expected2 = { 0, -1};
BOOST_CHECK_EQUAL_COLLECTIONS(eS1.begin(), eS1.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected2.begin(), expected2.end());
BOOST_CHECK_EQUAL(mat.score(), 90.0);
mat.gep(-5);
seq1.clear();
seq2.clear();
dom.accession("PF02458");
seq1.push_back(dom);
seq2.push_back(dom);
dom.accession("PF00001");
seq2.push_back(dom);
dom.accession("PF00545");
seq1.push_back(dom);
seq2.push_back(dom);
mat.gotoh(seq1, seq2);
mat.traceback(eS1, eS2);
expected1 = { 0, -1, 1};
expected2 = { 0, 1, 2};
BOOST_CHECK_EQUAL_COLLECTIONS(eS1.begin(), eS1.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected2.begin(), expected2.end());
BOOST_CHECK_EQUAL(mat.score(), 145.0);
mat.gotoh(seq2, seq1);
mat.traceback(eS1, eS2);
BOOST_CHECK_EQUAL_COLLECTIONS(eS2.begin(), eS2.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS1.begin(), eS1.end(), expected2.begin(), expected2.end());
BOOST_CHECK_EQUAL(mat.score(), 145.0);
}
BOOST_AUTO_TEST_SUITE_END()
#endif /* ALIGNMENTMATRIX_TEST_HPP_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment