1 #include <boost/test/auto_unit_test.hpp>
2 #include <boost/filesystem/path.hpp>
3 namespace fs = boost::filesystem;
8 #include "alg/mussa.hpp"
9 #include "alg/nway_paths.hpp"
10 #include "alg/sequence.hpp"
14 //! there should be no matches
15 BOOST_AUTO_TEST_CASE( nway_null )
17 string s0("AAAANNNN");
18 string s1("GGGGNNNN");
19 string s2("TTTTNNNN");
22 analysis.add_a_seq(s0);
23 analysis.add_a_seq(s1);
24 analysis.add_a_seq(s2);
25 analysis.analyze(4,3);
26 NwayPaths npath = analysis.paths();
27 // there should be no paths for these sequences
28 for (std::list<ConservedPath >::iterator pathz_i = npath.pathz.begin();
29 pathz_i != npath.pathz.end();
32 BOOST_CHECK_EQUAL( pathz_i->size(), 0);
36 BOOST_AUTO_TEST_CASE( nway_test )
38 string s0("ATATGCGC");
39 string s1("GGGGGGGC");
43 analysis.add_a_seq(s0);
44 analysis.add_a_seq(s1);
45 analysis.analyze(4,3);
46 NwayPaths npath = analysis.paths();
47 for (std::list<ConservedPath >::iterator pathz_i = npath.pathz.begin();
48 pathz_i != npath.pathz.end();
51 for( ConservedPath::iterator path_i = pathz_i->begin();
52 path_i != pathz_i->end();
55 BOOST_CHECK( *path_i == 4 || *path_i == -4);
60 BOOST_AUTO_TEST_CASE( nway_refine )
62 fs::path mupa_path( EXAMPLE_DIR );
63 mupa_path /= "mck3test.mupa";
65 m1.load_mupa_file( mupa_path );
67 const NwayPaths& npath = m1.paths();
68 BOOST_CHECK_EQUAL (npath.path_size(), npath.refined_path_size());
69 size_t first_refined_size = npath.refined_path_size();
70 BOOST_CHECK( first_refined_size > 0 );
72 // we're using a window size 30 (threshold 20) example
73 m1.set_soft_thres(22);
75 BOOST_CHECK( npath.refined_path_size() > 0);
76 BOOST_CHECK( npath.refined_path_size() < first_refined_size);
78 m1.set_soft_thres(20);
80 BOOST_CHECK_EQUAL(npath.refined_path_size(), first_refined_size);