Commit 53936896 authored by Carsten Kemena's avatar Carsten Kemena

adding AlignmentMatrix

- easier handling for the user
- possible to set parameters once and reuse it
git commit -m "adding AlignmentMatrix" -a -m
parent f75f5326
This diff is collapsed.
/*
* Nw_Gotoh_Test.hpp
*
* Created on: 20 Nov 2013
* Author: Carsten Kemena
* Email: c.kemena[@]uni-muenster.de
* Copyright: 2013
*
* This file is part of BioSeqDataLib.
*
* BioSeqDataLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BioSeqDataLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BioSeqDataLib. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALIGNMENTMATRIX_TEST_HPP_
#define ALIGNMENTMATRIX_TEST_HPP_
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <utility>
#include "../../src/sequence/Sequence.hpp"
#include "../../src/sequence/SequenceSet.hpp"
#include "../../src/utility/Matrix.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"
BOOST_AUTO_TEST_SUITE(AlignementMatrix_Test)
BOOST_AUTO_TEST_CASE( nw_sequence_test)
{
}
BOOST_AUTO_TEST_CASE( nw_domain_test)
{
BioSeqDataLib::DomainExt dom;
BioSeqDataLib::DomainArrangement<BioSeqDataLib::DomainExt> seq1, seq2;
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);
boost::filesystem::path path = BioSeqDataLib::getEnv("DOMAINWORLD_DATA");
BioSeqDataLib::DSM simMat(path / "dsm" / "pfam-31.dsm");
simMat.useNegative(true);
BioSeqDataLib::AlignmentMatrix<int, BioSeqDataLib::DSM> mat;
mat.gep(-100);
mat.scoring(simMat);
mat.nw(seq1, seq2);
std::vector<long> eS1, eS2;
mat.traceback(eS1, eS2);
std::vector<long int> expected1 { 0, -1, 1};
std::vector<long int> 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());
BioSeqDataLib::AlignmentMatrix<int, BioSeqDataLib::DSM> mat2(-100, simMat);
mat2.nw(seq1, seq2);
std::vector<long> eS12, eS22;
mat2.traceback(eS12, eS22);
BOOST_CHECK_EQUAL_COLLECTIONS(eS12.begin(), eS12.end(), expected1.begin(), expected1.end());
BOOST_CHECK_EQUAL_COLLECTIONS(eS22.begin(), eS22.end(), expected2.begin(), expected2.end());
}
BOOST_AUTO_TEST_CASE( gotoh_align_Test )
{
BioSeqDataLib::Sequence<> seq1("seq1", "LMLDSGSEPKLIAEPLXPQGPYELSDETLQAPVLNDEGTEAVFELLSNAVEV", "", "test sequence");
BioSeqDataLib::Sequence<> seq2("seq2", "LLDSKLIAEPLPPQGPYELSDETLQAPVLNDEGTEAVFELLSNAVEVTGKEPLP", "", "test sequence");
BioSeqDataLib::SimilarityMatrix<float> simMat("../tests/align/data/BLOSUM62.txt");
BioSeqDataLib::AlignmentMatrix<float, BioSeqDataLib::SimilarityMatrix<float>> mat(-11, -1, simMat);
mat.gotoh(seq1, seq2);
std::vector<long> eS1, eS2;
mat.traceback(eS1,eS2);
std::vector<long int> expected1 {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,-1,-1};
std::vector<long int> expected2 {-1, 0,1,2,3,-1,-1,-1,-1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53};
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_AUTO_TEST_SUITE_END()
#endif /* ALIGNMENTMATRIX_TEST_HPP_ */
......@@ -29,3 +29,4 @@
#include "NwGotohTest.hpp"
#include "SwTest.hpp"
#include "msaTest.hpp"
#include "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