all: targets
include alg/module.mk
+include alg/test/module.mk
include gui/module.mk
-include test/module.mk
include module.mk
# process what the module.mks defined
--- /dev/null
+#include "alg/glsequence.h"
+
+#include <iostream>
+using namespace std;
+
+GlSequence::GlSequence(const Sequence &s)
+ : seq(s),
+ seq_x(0),
+ seq_y(0),
+ seq_z(0),
+ seq_width(s.size()),
+ seq_height(gl_track_height)
+{
+}
+
+GlSequence::GlSequence(const GlSequence &s)
+ : seq(s.seq),
+ seq_x(s.seq_x),
+ seq_y(s.seq_y),
+ seq_z(s.seq_z),
+ seq_width(s.seq_width),
+ seq_height(s.seq_height)
+{
+}
+
+GlSequence &GlSequence::operator=(const GlSequence & s)
+{
+ if (this != &s) {
+ const_cast<Sequence &>(seq) = s.seq;
+ seq_x = s.seq_x;
+ seq_y = s.seq_y;
+ seq_z = s.seq_z;
+ seq_width = s.seq_width;
+ seq_height = s.seq_height;
+ }
+ return *this;
+}
+
+const Sequence &GlSequence::sequence() const
+{
+ return seq;
+}
+
+void GlSequence::setX(GLfloat value)
+{
+ seq_x = value;
+}
+
+GLfloat GlSequence::x() const
+{
+ return seq_x;
+}
+
+void GlSequence::setY(GLfloat value)
+{
+ seq_y = value;
+}
+
+GLfloat GlSequence::y() const
+{
+ return seq_y;
+}
+
+void GlSequence::setWidth(GLfloat value)
+{
+ seq_width = value;
+}
+
+GLfloat GlSequence::width() const
+{
+ return seq_width;
+}
+
+
+void GlSequence::draw() const
+{
+ glLineWidth(seq_height);
+ glColor3f(0.0, 0.0, 0.0);
+ // draw main sequence track
+ glBegin(GL_LINES);
+ glVertex3f(seq_x, seq_y, seq_z);
+ glVertex3f(seq_x+seq_width, seq_y, seq_z);
+ clog << "drawing " << seq_x << " " << seq_y << " " << seq_width
+ << std::endl;
+ glEnd();
+ // draw annotations
+ std::list<annot> annots = seq.annotations();
+ for (std::list<annot>::const_iterator annot_itor = annots.begin();
+ annot_itor != annots.end();
+ ++annot_itor)
+ {
+ glColor3f(0.0, 0.5, 0.0);
+ glBegin(GL_LINES);
+ glVertex3f(annot_itor->start, seq_y, seq_z);
+ glVertex3f(annot_itor->end , seq_y, seq_z);
+ glEnd();
+ }
+}
--- /dev/null
+#ifndef _GL_SEQUENCE_H_
+#define _GL_SEQUENCE_H_
+
+#include "alg/sequence.hh"
+#include <GL/gl.h>
+
+//! Manage rendering a mussa sequence track
+/*! The idea is this will keep track of the location of where the sequence
+ * is being rendered, and handle displaying annotations on that track
+ */
+class GlSequence
+{
+public:
+ GlSequence(const Sequence & s);
+ GlSequence(const GlSequence & s);
+ GlSequence &operator=(const GlSequence &s);
+
+ void draw() const;
+
+ const Sequence &sequence() const;
+ void setX(GLfloat);
+ GLfloat x() const;
+ void setY(GLfloat);
+ GLfloat y() const;
+ void setWidth(GLfloat);
+ GLfloat width() const;
+
+private:
+ const Sequence& seq;
+ GLfloat seq_x;
+ GLfloat seq_y;
+ GLfloat seq_z;
+ GLfloat seq_width;
+ GLfloat seq_height;
+};
+
+const float gl_track_height = 5.0;
+
+#endif
SOURCES.cxx := flp.cxx \
flp_seqcomp.cxx \
+ glsequence.cxx \
mussa_class.cxx \
nway_paths.cxx \
nway_entropy.cxx \
--- /dev/null
+CURDIR := $(BASEDIR)alg/test/
+
+SOURCES.cxx := test_flp.cxx \
+ test_glsequence.cxx \
+ test_main.cxx \
+ test_mussa.cxx \
+ test_nway.cxx \
+ test_sequence.cxx
+
+TESTSRC := $(addprefix $(CURDIR), $(SOURCES.cxx))
+
+SRC += $(TESTSRC)
+CXXFLAGS +=
+
+TEST := $(BASEDIR)/unittests$(BINEXT)
+TARGETBINS += $(TEST)
+
+$(TEST): $(TESTSRC:.cxx=$(OBJEXT)) $(MUSSA_ALG_LIB)
+ g++ $(CXXFLAGS) -lGL -lboost_unit_test_framework -lboost_filesystem -o $@ $^
+
--- /dev/null
+#include <iostream>
+#include <list>
+
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+
+#include "alg/flp.hh"
+#include "alg/sequence.hh"
+#include <iostream>
+#include <list>
+
+BOOST_AUTO_TEST_CASE( flp_simple )
+{
+ FLPs f;
+ f.setup(5, 4);
+ f.seqcomp("AAGGTAAGGT", "AAGGTAAGGT", false);
+
+ for (int i=0; i < f.size(); i++)
+ {
+ std::list<int> window_matches = f.matches(i);
+ for (std::list<int>::iterator matches_i = window_matches.begin();
+ matches_i != window_matches.end();
+ ++matches_i)
+ {
+ // I'm missing pythons easy lists and in operator here.
+ if (i == 0) BOOST_CHECK( *matches_i == 0 || *matches_i == 5);
+ else if (i == 1) BOOST_CHECK( *matches_i == 1 || *matches_i == 6);
+ else if (i == 2) BOOST_CHECK( *matches_i == 2 );
+ else if (i == 3) BOOST_CHECK( *matches_i == 3 );
+ else if (i == 4) BOOST_CHECK( *matches_i == 4 );
+ else if (i == 6) BOOST_CHECK( *matches_i == 5 || *matches_i == 0);
+ }
+ }
+}
+
+BOOST_AUTO_TEST_CASE( flp_save )
+{
+ std::string seq("AAGGCCTTAAGGCCTT");
+ int win_size = 4;
+ FLPs f1;
+ FLPs f2;
+ f1.setup(win_size,3);
+ f1.seqcomp(seq, seq, false);
+ std::string fname("flp_save_this_is_a_horrible_filename_because_"
+ "im_too_lazy_to_write_a_portable_mktmp.flp");
+
+ f1.save(fname);
+ f2.load(fname);
+ boost::filesystem::remove( boost::filesystem::path(fname) );
+
+ BOOST_CHECK_EQUAL( f1.size(), seq.size()-win_size+1);
+ BOOST_CHECK_EQUAL( f2.size(), seq.size()-win_size+1);
+ BOOST_CHECK_EQUAL( f1.size(), f2.size() );
+ for (int win=0; win < f1.size(); ++win)
+ {
+ std::list<int> f1_matches = f1.matches(win);
+ std::list<int> f2_matches = f2.matches(win);
+ std::list<int>::const_iterator f1_match_i = f1_matches.begin();
+ std::list<int>::const_iterator f2_match_i = f2_matches.begin();
+ for( ;
+ f1_match_i != f1_matches.end() && f2_match_i != f2_matches.end();
+ ++f1_match_i, ++f2_match_i)
+ {
+ BOOST_CHECK_EQUAL( *f1_match_i, *f2_match_i);
+ }
+ }
+}
+
+/*! Apparently when we run multiple seqcomps we want to
+ * save all the FLPs generated
+ */
+BOOST_AUTO_TEST_CASE( flp_reverse_compliment )
+{
+ FLPs f1;
+ Sequence s1("AAAATTTT");
+ Sequence s2("AACAGGGG");
+ f1.setup(4,3);
+ f1.seqcomp(s1.get_seq(), s2.get_seq(), false);
+ f1.seqcomp(s1.get_seq(), s2.rev_comp(), true);
+
+ FLPs f2;
+ f2.setup(4,3);
+ f2.seqcomp(s1.get_seq(), s2.rev_comp(), true);
+ f2.seqcomp(s1.get_seq(), s2.get_seq(), false);
+
+ // The order of doing the reverse compliment search shouldn't matter
+ // when we're using exactly the same sequence
+ BOOST_CHECK_EQUAL( f1.size(), f2.size() );
+ for (int i = 0; i < f1.size(); ++i )
+ {
+ BOOST_CHECK_EQUAL( f1.matches(i).size(), f2.matches(i).size() );
+ // FIXME: should we test the individual lists?
+ }
+}
--- /dev/null
+#include <boost/test/auto_unit_test.hpp>
+
+#include <string>
+
+#include "alg/glsequence.h"
+#include "alg/sequence.hh"
+
+using namespace std;
+
+BOOST_AUTO_TEST_CASE ( glsequence_operator_equal )
+{
+ // I don't trust my operator = hack so lets make sure it works.
+ string s0("AAGGCCTT");
+ string s1("TTGGCCAA");
+ Sequence seq0(s0);
+ Sequence seq1(s1);
+
+ GlSequence glseq0(seq0);
+ BOOST_CHECK (glseq0.sequence().get_seq() == s0);
+ // width of a sequence should be number of base pairs (aka chars)
+ BOOST_CHECK (glseq0.width() == s0.size());
+ GlSequence glseq1(seq1);
+ GlSequence glseq_copy0(glseq0);
+
+ BOOST_CHECK(glseq_copy0.sequence().get_seq() == glseq0.sequence().get_seq());
+ BOOST_CHECK( &(glseq_copy0.sequence()) == &(glseq0.sequence()));
+
+ glseq0 = glseq1;
+
+ BOOST_CHECK( glseq0.sequence().get_seq() == s1 );
+}
--- /dev/null
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
--- /dev/null
+#include <boost/test/auto_unit_test.hpp>
+
+#include <string>
+
+#include "alg/mussa_class.hh"
+
+//! can we initialize a mussa object?
+BOOST_AUTO_TEST_CASE( mussa_simple )
+{
+ Mussa m;
+ BOOST_CHECK_EQUAL(m.get_name(), "" );
+ BOOST_CHECK_EQUAL(m.get_window(), 0);
+ BOOST_CHECK_EQUAL(m.get_threshold(), 0);
+ BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::TransitiveNway);
+ m.set_name( "hello" );
+ BOOST_CHECK_EQUAL(m.get_name(), "hello" );
+ m.set_window(30);
+ BOOST_CHECK_EQUAL(m.get_window(), 30);
+ m.set_threshold(21);
+ BOOST_CHECK_EQUAL(m.get_threshold(), 21);
+ m.set_analysis_mode(Mussa::RadialNway);
+ BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::RadialNway);
+
+ m.clear();
+ BOOST_CHECK_EQUAL(m.get_name(), "" );
+ BOOST_CHECK_EQUAL(m.get_window(), 0);
+ BOOST_CHECK_EQUAL(m.get_threshold(), 0);
+ BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::TransitiveNway);
+}
+
+BOOST_AUTO_TEST_CASE( mussa_analysis_name )
+{
+ Mussa m;
+ m.set_analysis_mode( Mussa::TransitiveNway );
+ BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Transitive" );
+ m.set_analysis_mode( Mussa::RadialNway );
+ BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Radial" );
+ m.set_analysis_mode( Mussa::EntropyNway );
+ BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Entropy" );
+ m.set_analysis_mode( Mussa::RecursiveNway);
+ BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "[deprecated] Recursive" );
+}
+
+BOOST_AUTO_TEST_CASE( mussa_sequences )
+{
+ std::string s0("AAAANNNN");
+ std::string s1("GGGGNNNN");
+ std::string s2("TTTTNNNN");
+
+ Mussa analysis;
+ analysis.add_a_seq(s0);
+ analysis.add_a_seq(s1);
+ analysis.add_a_seq(s2);
+
+ BOOST_CHECK_EQUAL( analysis.sequences().size(), 3 );
+ BOOST_CHECK_EQUAL( analysis.sequences()[0].get_seq(), s0);
+ BOOST_CHECK_EQUAL( analysis.sequences()[1].get_seq(), s1);
+ BOOST_CHECK_EQUAL( analysis.sequences()[2].get_seq(), s2);
+}
+
+#include <unistd.h>
+BOOST_AUTO_TEST_CASE( mussa_load_mupa )
+{
+ Mussa m;
+ chdir( "examples" );
+ m.load_mupa_file( "mck3test.mupa" );
+ m.analyze(30, 25);
+ chdir( ".." );
+}
--- /dev/null
+#include <boost/test/auto_unit_test.hpp>
+
+#include <string>
+#include <iostream>
+
+#include "alg/mussa_class.hh"
+#include "alg/nway_paths.hh"
+#include "alg/sequence.hh"
+
+using namespace std;
+
+//! there should be no matches
+BOOST_AUTO_TEST_CASE( nway_null )
+{
+ string s0("AAAANNNN");
+ string s1("GGGGNNNN");
+ string s2("TTTTNNNN");
+
+ Mussa analysis;
+ analysis.add_a_seq(s0);
+ analysis.add_a_seq(s1);
+ analysis.add_a_seq(s2);
+ analysis.analyze(4,3);
+ Nway_Paths npath = analysis.paths();
+ // there should be no paths for these sequences
+ for (std::list<std::vector<int> >::iterator pathz_i = npath.pathz.begin();
+ pathz_i != npath.pathz.end();
+ ++pathz_i)
+ {
+ BOOST_CHECK_EQUAL( pathz_i->size(), 0);
+ }
+}
+
+BOOST_AUTO_TEST_CASE( nway_test )
+{
+ string s0("ATATGCGC");
+ string s1("GGGGGGGC");
+ Sequence seq1(s1);
+ cout << "seq1 rev = " << seq1.rev_comp() << endl;
+
+ Mussa analysis;
+ analysis.add_a_seq(s0);
+ analysis.add_a_seq(s1);
+ analysis.analyze(4,3);
+ Nway_Paths npath = analysis.paths();
+ for (std::list<std::vector<int> >::iterator pathz_i = npath.pathz.begin();
+ pathz_i != npath.pathz.end();
+ ++pathz_i)
+ {
+ for( std::vector<int>::iterator path_i = pathz_i->begin();
+ path_i != pathz_i->end();
+ ++path_i)
+ {
+ BOOST_CHECK( *path_i == 4 || *path_i == -4);
+ }
+ }
+}
--- /dev/null
+#include <boost/test/auto_unit_test.hpp>
+
+#include "alg/sequence.hh"
+#include "mussa_exceptions.hh"
+
+//! when we try to load a missing file, do we get an error?
+BOOST_AUTO_TEST_CASE( sequence_load_exception )
+{
+ Sequence s;
+ // there should be errors when we try to load something that doesn't exist
+ BOOST_CHECK_THROW( s.load_fasta("alkejralk", 1, 0, 0), sequence_load_error);
+ BOOST_CHECK_THROW( s.load_annot("alkejralk", 0, 0), sequence_load_error);
+}
+
+//! Do simple operations work correctly?
+BOOST_AUTO_TEST_CASE( sequence_filter )
+{
+ Sequence s1("AATTGGCC");
+ BOOST_CHECK_EQUAL(s1.get_seq(), "AATTGGCC");
+
+ Sequence s2("aattggcc");
+ BOOST_CHECK_EQUAL(s2.get_seq(), "AATTGGCC");
+ BOOST_CHECK_EQUAL(s2.rev_comp(), "GGCCAATT");
+ BOOST_CHECK_EQUAL(s2.size(), s2.get_seq().size());
+ BOOST_CHECK_EQUAL(s2.c_seq(), s2.get_seq().c_str());
+
+ Sequence s3("asdfg");
+ BOOST_CHECK_EQUAL(s3.get_seq(), "ANNNG");
+ BOOST_CHECK_EQUAL(s3.subseq(0,2), "AN");
+
+ BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 0, 2), "AA");
+ BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 2, 2), "GG");
+ BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 4), "CCTT");
+
+ s3.clear();
+ BOOST_CHECK_EQUAL(s3.get_seq(), "");
+
+ s3.set_seq("AAGGFF");
+ BOOST_CHECK_EQUAL(s3.get_seq(), "AAGGNN");
+}
+
+//! Can we load data from a file
+BOOST_AUTO_TEST_CASE( sequence_load )
+{
+ Sequence s;
+ s.load_fasta("examples/seq/human_mck_pro.fa");
+ BOOST_CHECK_EQUAL(s.subseq(0, 5), "GGATC"); // first few chars of fasta file
+ BOOST_CHECK_EQUAL(s.get_header(), "gi|180579|gb|M21487.1|HUMCKMM1 Human "
+ "muscle creatine kinase gene (CKMM), "
+ "5' flank");
+}
# Input
HEADERS += mussa_exceptions.hh \
- qui/GlSequence.h \
qui/PathWindow.h \
qui/PathScene.h \
qui/ThresholdWidget.h \
alg/flp.hh \
+ alg/glsequence.h \
alg/mussa_class.hh \
alg/nway_paths.hh \
alg/sequence.hh
SOURCES += mussagl.cxx \
- qui/GlSequence.cxx \
qui/PathWindow.cxx \
qui/PathScene.cxx \
qui/ThresholdWidget.cxx \
alg/flp.cxx \
alg/flp_seqcomp.cxx \
+ alg/glsequence.cxx \
alg/mussa_class.cxx \
alg/nway_entropy.cxx \
alg/nway_other.cxx \
+++ /dev/null
-#include "qui/GlSequence.h"
-
-#include <iostream>
-using namespace std;
-
-GlSequence::GlSequence(const Sequence &s)
- : seq(s),
- seq_x(0),
- seq_y(0),
- seq_z(0),
- seq_width(s.size()),
- seq_height(gl_track_height)
-{
-}
-
-GlSequence::GlSequence(const GlSequence &s)
- : seq(s.seq),
- seq_x(s.seq_x),
- seq_y(s.seq_y),
- seq_z(s.seq_z),
- seq_width(s.seq_width),
- seq_height(s.seq_height)
-{
-}
-
-GlSequence &GlSequence::operator=(const GlSequence & s)
-{
- if (this != &s) {
- const_cast<Sequence &>(seq) = s.seq;
- seq_x = s.seq_x;
- seq_y = s.seq_y;
- seq_z = s.seq_z;
- seq_width = s.seq_width;
- seq_height = s.seq_height;
- }
- return *this;
-}
-
-const Sequence &GlSequence::sequence() const
-{
- return seq;
-}
-
-void GlSequence::setX(GLfloat value)
-{
- seq_x = value;
-}
-
-GLfloat GlSequence::x() const
-{
- return seq_x;
-}
-
-void GlSequence::setY(GLfloat value)
-{
- seq_y = value;
-}
-
-GLfloat GlSequence::y() const
-{
- return seq_y;
-}
-
-void GlSequence::setWidth(GLfloat value)
-{
- seq_width = value;
-}
-
-GLfloat GlSequence::width() const
-{
- return seq_width;
-}
-
-
-void GlSequence::draw() const
-{
- glLineWidth(seq_height);
- glColor3f(0.0, 0.0, 0.0);
- // draw main sequence track
- glBegin(GL_LINES);
- glVertex3f(seq_x, seq_y, seq_z);
- glVertex3f(seq_x+seq_width, seq_y, seq_z);
- clog << "drawing " << seq_x << " " << seq_y << " " << seq_width
- << std::endl;
- glEnd();
- // draw annotations
- std::list<annot> annots = seq.annotations();
- for (std::list<annot>::const_iterator annot_itor = annots.begin();
- annot_itor != annots.end();
- ++annot_itor)
- {
- glColor3f(0.0, 0.5, 0.0);
- glBegin(GL_LINES);
- glVertex3f(annot_itor->start, seq_y, seq_z);
- glVertex3f(annot_itor->end , seq_y, seq_z);
- glEnd();
- }
-}
+++ /dev/null
-#ifndef _GL_SEQUENCE_H_
-#define _GL_SEQUENCE_H_
-
-#include "alg/sequence.hh"
-#include <GL/gl.h>
-
-//! Manage rendering a mussa sequence track
-/*! The idea is this will keep track of the location of where the sequence
- * is being rendered, and handle displaying annotations on that track
- */
-class GlSequence
-{
-public:
- GlSequence(const Sequence & s);
- GlSequence(const GlSequence & s);
- GlSequence &operator=(const GlSequence &s);
-
- void draw() const;
-
- const Sequence &sequence() const;
- void setX(GLfloat);
- GLfloat x() const;
- void setY(GLfloat);
- GLfloat y() const;
- void setWidth(GLfloat);
- GLfloat width() const;
-
-private:
- const Sequence& seq;
- GLfloat seq_x;
- GLfloat seq_y;
- GLfloat seq_z;
- GLfloat seq_width;
- GLfloat seq_height;
-};
-
-const float gl_track_height = 5.0;
-
-#endif
#include <GL/gl.h>
#include <math.h>
-#include "qui/GlSequence.h"
+#include "alg/glsequence.h"
using namespace std;
#include <vector>
#include "alg/mussa_class.hh"
-#include "qui/GlSequence.h"
+#include "alg/glsequence.h"
class QMouseEvent;
class QRubberBand;
+++ /dev/null
-CURDIR := $(BASEDIR)test/
-
-SOURCES.cxx := test_flp.cxx \
- test_glsequence.cxx \
- test_main.cxx \
- test_mussa.cxx \
- test_nway.cxx \
- test_sequence.cxx \
- ../qui/GlSequence.cxx
-
-TESTSRC := $(addprefix $(CURDIR), $(SOURCES.cxx))
-
-SRC += $(TESTSRC)
-CXXFLAGS +=
-
-TEST := $(BASEDIR)/unittests$(BINEXT)
-TARGETBINS += $(TEST)
-
-$(TEST): $(TESTSRC:.cxx=$(OBJEXT)) $(MUSSA_ALG_LIB)
- g++ $(CXXFLAGS) -lGL -lboost_unit_test_framework -lboost_filesystem -o $@ $^
-
+++ /dev/null
-#include <iostream>
-#include <list>
-
-#include <boost/test/auto_unit_test.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
-#include "alg/flp.hh"
-#include "alg/sequence.hh"
-#include <iostream>
-#include <list>
-
-BOOST_AUTO_TEST_CASE( flp_simple )
-{
- FLPs f;
- f.setup(5, 4);
- f.seqcomp("AAGGTAAGGT", "AAGGTAAGGT", false);
-
- for (int i=0; i < f.size(); i++)
- {
- std::list<int> window_matches = f.matches(i);
- for (std::list<int>::iterator matches_i = window_matches.begin();
- matches_i != window_matches.end();
- ++matches_i)
- {
- // I'm missing pythons easy lists and in operator here.
- if (i == 0) BOOST_CHECK( *matches_i == 0 || *matches_i == 5);
- else if (i == 1) BOOST_CHECK( *matches_i == 1 || *matches_i == 6);
- else if (i == 2) BOOST_CHECK( *matches_i == 2 );
- else if (i == 3) BOOST_CHECK( *matches_i == 3 );
- else if (i == 4) BOOST_CHECK( *matches_i == 4 );
- else if (i == 6) BOOST_CHECK( *matches_i == 5 || *matches_i == 0);
- }
- }
-}
-
-BOOST_AUTO_TEST_CASE( flp_save )
-{
- std::string seq("AAGGCCTTAAGGCCTT");
- int win_size = 4;
- FLPs f1;
- FLPs f2;
- f1.setup(win_size,3);
- f1.seqcomp(seq, seq, false);
- std::string fname("flp_save_this_is_a_horrible_filename_because_"
- "im_too_lazy_to_write_a_portable_mktmp.flp");
-
- f1.save(fname);
- f2.load(fname);
- boost::filesystem::remove( boost::filesystem::path(fname) );
-
- BOOST_CHECK_EQUAL( f1.size(), seq.size()-win_size+1);
- BOOST_CHECK_EQUAL( f2.size(), seq.size()-win_size+1);
- BOOST_CHECK_EQUAL( f1.size(), f2.size() );
- for (int win=0; win < f1.size(); ++win)
- {
- std::list<int> f1_matches = f1.matches(win);
- std::list<int> f2_matches = f2.matches(win);
- std::list<int>::const_iterator f1_match_i = f1_matches.begin();
- std::list<int>::const_iterator f2_match_i = f2_matches.begin();
- for( ;
- f1_match_i != f1_matches.end() && f2_match_i != f2_matches.end();
- ++f1_match_i, ++f2_match_i)
- {
- BOOST_CHECK_EQUAL( *f1_match_i, *f2_match_i);
- }
- }
-}
-
-/*! Apparently when we run multiple seqcomps we want to
- * save all the FLPs generated
- */
-BOOST_AUTO_TEST_CASE( flp_reverse_compliment )
-{
- FLPs f1;
- Sequence s1("AAAATTTT");
- Sequence s2("AACAGGGG");
- f1.setup(4,3);
- f1.seqcomp(s1.get_seq(), s2.get_seq(), false);
- f1.seqcomp(s1.get_seq(), s2.rev_comp(), true);
-
- FLPs f2;
- f2.setup(4,3);
- f2.seqcomp(s1.get_seq(), s2.rev_comp(), true);
- f2.seqcomp(s1.get_seq(), s2.get_seq(), false);
-
- // The order of doing the reverse compliment search shouldn't matter
- // when we're using exactly the same sequence
- BOOST_CHECK_EQUAL( f1.size(), f2.size() );
- for (int i = 0; i < f1.size(); ++i )
- {
- BOOST_CHECK_EQUAL( f1.matches(i).size(), f2.matches(i).size() );
- // FIXME: should we test the individual lists?
- }
-}
+++ /dev/null
-#include <boost/test/auto_unit_test.hpp>
-
-#include <string>
-
-#include "qui/GlSequence.h"
-#include "alg/sequence.hh"
-
-using namespace std;
-
-BOOST_AUTO_TEST_CASE ( glsequence_operator_equal )
-{
- // I don't trust my operator = hack so lets make sure it works.
- string s0("AAGGCCTT");
- string s1("TTGGCCAA");
- Sequence seq0(s0);
- Sequence seq1(s1);
-
- GlSequence glseq0(seq0);
- BOOST_CHECK (glseq0.sequence().get_seq() == s0);
- // width of a sequence should be number of base pairs (aka chars)
- BOOST_CHECK (glseq0.width() == s0.size());
- GlSequence glseq1(seq1);
- GlSequence glseq_copy0(glseq0);
-
- BOOST_CHECK(glseq_copy0.sequence().get_seq() == glseq0.sequence().get_seq());
- BOOST_CHECK( &(glseq_copy0.sequence()) == &(glseq0.sequence()));
-
- glseq0 = glseq1;
-
- BOOST_CHECK( glseq0.sequence().get_seq() == s1 );
-}
+++ /dev/null
-#define BOOST_AUTO_TEST_MAIN
-#include <boost/test/auto_unit_test.hpp>
-
+++ /dev/null
-#include <boost/test/auto_unit_test.hpp>
-
-#include <string>
-
-#include "alg/mussa_class.hh"
-
-//! can we initialize a mussa object?
-BOOST_AUTO_TEST_CASE( mussa_simple )
-{
- Mussa m;
- BOOST_CHECK_EQUAL(m.get_name(), "" );
- BOOST_CHECK_EQUAL(m.get_window(), 0);
- BOOST_CHECK_EQUAL(m.get_threshold(), 0);
- BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::TransitiveNway);
- m.set_name( "hello" );
- BOOST_CHECK_EQUAL(m.get_name(), "hello" );
- m.set_window(30);
- BOOST_CHECK_EQUAL(m.get_window(), 30);
- m.set_threshold(21);
- BOOST_CHECK_EQUAL(m.get_threshold(), 21);
- m.set_analysis_mode(Mussa::RadialNway);
- BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::RadialNway);
-
- m.clear();
- BOOST_CHECK_EQUAL(m.get_name(), "" );
- BOOST_CHECK_EQUAL(m.get_window(), 0);
- BOOST_CHECK_EQUAL(m.get_threshold(), 0);
- BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::TransitiveNway);
-}
-
-BOOST_AUTO_TEST_CASE( mussa_analysis_name )
-{
- Mussa m;
- m.set_analysis_mode( Mussa::TransitiveNway );
- BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Transitive" );
- m.set_analysis_mode( Mussa::RadialNway );
- BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Radial" );
- m.set_analysis_mode( Mussa::EntropyNway );
- BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "Entropy" );
- m.set_analysis_mode( Mussa::RecursiveNway);
- BOOST_CHECK_EQUAL( m.get_analysis_mode_name(), "[deprecated] Recursive" );
-}
-
-BOOST_AUTO_TEST_CASE( mussa_sequences )
-{
- std::string s0("AAAANNNN");
- std::string s1("GGGGNNNN");
- std::string s2("TTTTNNNN");
-
- Mussa analysis;
- analysis.add_a_seq(s0);
- analysis.add_a_seq(s1);
- analysis.add_a_seq(s2);
-
- BOOST_CHECK_EQUAL( analysis.sequences().size(), 3 );
- BOOST_CHECK_EQUAL( analysis.sequences()[0].get_seq(), s0);
- BOOST_CHECK_EQUAL( analysis.sequences()[1].get_seq(), s1);
- BOOST_CHECK_EQUAL( analysis.sequences()[2].get_seq(), s2);
-}
-
-#include <unistd.h>
-BOOST_AUTO_TEST_CASE( mussa_load_mupa )
-{
- Mussa m;
- chdir( "examples" );
- m.load_mupa_file( "mck3test.mupa" );
- m.analyze(30, 25);
- chdir( ".." );
-}
+++ /dev/null
-#include <boost/test/auto_unit_test.hpp>
-
-#include <string>
-#include <iostream>
-
-#include "alg/mussa_class.hh"
-#include "alg/nway_paths.hh"
-#include "alg/sequence.hh"
-
-using namespace std;
-
-//! there should be no matches
-BOOST_AUTO_TEST_CASE( nway_null )
-{
- string s0("AAAANNNN");
- string s1("GGGGNNNN");
- string s2("TTTTNNNN");
-
- Mussa analysis;
- analysis.add_a_seq(s0);
- analysis.add_a_seq(s1);
- analysis.add_a_seq(s2);
- analysis.analyze(4,3);
- Nway_Paths npath = analysis.paths();
- // there should be no paths for these sequences
- for (std::list<std::vector<int> >::iterator pathz_i = npath.pathz.begin();
- pathz_i != npath.pathz.end();
- ++pathz_i)
- {
- BOOST_CHECK_EQUAL( pathz_i->size(), 0);
- }
-}
-
-BOOST_AUTO_TEST_CASE( nway_test )
-{
- string s0("ATATGCGC");
- string s1("GGGGGGGC");
- Sequence seq1(s1);
- cout << "seq1 rev = " << seq1.rev_comp() << endl;
-
- Mussa analysis;
- analysis.add_a_seq(s0);
- analysis.add_a_seq(s1);
- analysis.analyze(4,3);
- Nway_Paths npath = analysis.paths();
- for (std::list<std::vector<int> >::iterator pathz_i = npath.pathz.begin();
- pathz_i != npath.pathz.end();
- ++pathz_i)
- {
- for( std::vector<int>::iterator path_i = pathz_i->begin();
- path_i != pathz_i->end();
- ++path_i)
- {
- BOOST_CHECK( *path_i == 4 || *path_i == -4);
- }
- }
-}
+++ /dev/null
-#include <boost/test/auto_unit_test.hpp>
-
-#include "alg/sequence.hh"
-#include "mussa_exceptions.hh"
-
-//! when we try to load a missing file, do we get an error?
-BOOST_AUTO_TEST_CASE( sequence_load_exception )
-{
- Sequence s;
- // there should be errors when we try to load something that doesn't exist
- BOOST_CHECK_THROW( s.load_fasta("alkejralk", 1, 0, 0), sequence_load_error);
- BOOST_CHECK_THROW( s.load_annot("alkejralk", 0, 0), sequence_load_error);
-}
-
-//! Do simple operations work correctly?
-BOOST_AUTO_TEST_CASE( sequence_filter )
-{
- Sequence s1("AATTGGCC");
- BOOST_CHECK_EQUAL(s1.get_seq(), "AATTGGCC");
-
- Sequence s2("aattggcc");
- BOOST_CHECK_EQUAL(s2.get_seq(), "AATTGGCC");
- BOOST_CHECK_EQUAL(s2.rev_comp(), "GGCCAATT");
- BOOST_CHECK_EQUAL(s2.size(), s2.get_seq().size());
- BOOST_CHECK_EQUAL(s2.c_seq(), s2.get_seq().c_str());
-
- Sequence s3("asdfg");
- BOOST_CHECK_EQUAL(s3.get_seq(), "ANNNG");
- BOOST_CHECK_EQUAL(s3.subseq(0,2), "AN");
-
- BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 0, 2), "AA");
- BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 2, 2), "GG");
- BOOST_CHECK_EQUAL(s3.filter_sequence("AAGGCCTT", 4), "CCTT");
-
- s3.clear();
- BOOST_CHECK_EQUAL(s3.get_seq(), "");
-
- s3.set_seq("AAGGFF");
- BOOST_CHECK_EQUAL(s3.get_seq(), "AAGGNN");
-}
-
-//! Can we load data from a file
-BOOST_AUTO_TEST_CASE( sequence_load )
-{
- Sequence s;
- s.load_fasta("examples/seq/human_mck_pro.fa");
- BOOST_CHECK_EQUAL(s.subseq(0, 5), "GGATC"); // first few chars of fasta file
- BOOST_CHECK_EQUAL(s.get_header(), "gi|180579|gb|M21487.1|HUMCKMM1 Human "
- "muscle creatine kinase gene (CKMM), "
- "5' flank");
-}