5 #include <boost/test/unit_test.hpp> 8 BOOST_AUTO_TEST_SUITE(ComparisonsTest)
10 BOOST_AUTO_TEST_CASE( notagap )
15 BOOST_AUTO_TEST_CASE( gapped1 )
17 std::string seq1(
"ATGATG---ACA");
21 std::remove(seq1.begin(),seq1.end(),
'-');
26 BOOST_AUTO_TEST_CASE( gapped2 )
28 std::string seq1(
"ATGATG---ACA");
30 auto x = seq1.find(
'-');
32 BOOST_CHECK_PREDICATE(std::not_equal_to<decltype(x)>(),(x)(std::string::npos));
38 std::remove(seq1.begin(),seq1.end(),
'-');
43 BOOST_AUTO_TEST_CASE( numdiffs1 )
45 std::string seq1(
"ATGATG---ACA"),
52 seq2.replace( seq1.find(
'-'),
53 std::count(seq1.begin(),seq1.end(),
'-'),
54 std::string(std::count(seq1.begin(),seq1.end(),
'-'),
'N' ).c_str());
61 BOOST_AUTO_TEST_CASE( numdiffs2 )
63 std::string seq1(
"ATGATG---ACA"),
66 seq2.erase(std::remove(seq2.begin(),seq2.end(),
'-'),seq2.end());
78 BOOST_AUTO_TEST_CASE( tstv1 )
81 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'A')),
int(Sequence::Mutations::Ts) );
82 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'a')),
int(Sequence::Mutations::Ts) );
83 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'a',
'a')),
int(Sequence::Mutations::Ts) );
84 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'G')),
int(Sequence::Mutations::Ts) );
85 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'G')),
int(Sequence::Mutations::Ts) );
86 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'g',
'a')),
int(Sequence::Mutations::Ts) );
88 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
'T')),
int(Sequence::Mutations::Ts) );
89 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
't')),
int(Sequence::Mutations::Ts) );
90 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'c',
't')),
int(Sequence::Mutations::Ts) );
91 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
'T')),
int(Sequence::Mutations::Ts) );
92 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
'T')),
int(Sequence::Mutations::Ts) );
93 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'T',
'c')),
int(Sequence::Mutations::Ts) );
95 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'T')),
int(Sequence::Mutations::Tv) );
96 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'A',
'C')),
int(Sequence::Mutations::Tv) );
97 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
'A')),
int(Sequence::Mutations::Tv) );
98 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'T',
'A')),
int(Sequence::Mutations::Tv) );
99 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'C',
'a')),
int(Sequence::Mutations::Tv) );
100 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'T',
'a')),
int(Sequence::Mutations::Tv) );
101 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'c',
'A')),
int(Sequence::Mutations::Tv) );
102 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
't',
'A')),
int(Sequence::Mutations::Tv) );
104 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'G',
'T')),
int(Sequence::Mutations::Tv) );
105 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'G',
't')),
int(Sequence::Mutations::Tv) );
106 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'g',
't')),
int(Sequence::Mutations::Tv) );
107 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'G',
'C')),
int(Sequence::Mutations::Tv) );
108 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'G',
'c')),
int(Sequence::Mutations::Tv) );
109 BOOST_REQUIRE_EQUAL(
int(
Sequence::TsTv(
'T',
'g')),
int(Sequence::Mutations::Tv) );
111 BOOST_REQUIRE_THROW(
Sequence::TsTv(
'G',
'R'), std::runtime_error );
112 BOOST_REQUIRE_THROW(
Sequence::TsTv(
'G',
'z'), std::runtime_error );
114 BOOST_AUTO_TEST_SUITE_END()
Mutations TsTv(const char &i, const char &j)
int NumDiffs(const std::string &seq1, const std::string &seq2, const bool &skip_missing=true, const bool &nucleic_acid=true)
bool NotAGap(const char &c)
delcaration of routines for comparing DNA sequences This file declares a set of functions useful for ...
bool Gapped(const std::string &s)