void seqcomp(const Sequence& seq1, const Sequence& seq2, bool is_RC);
//bool FLPs::match_less(match *match1, match *match2);
//void FLPs::sort();
- //! Return all the matches for a particular window?
+ //! Return all the matches for a particular window? (index and score pairs)
std::list<match> matches(int index) const;
//! Return all the match indexes for a particular window?
std::list<int> match_locations(int index) const;
annot.cpp
annotation_colors.cpp
conserved_path.cpp
+ flp.cpp
glsequence.cpp
module.cpp
mussa.cpp
)
IF(PYTHON_EXECUTABLE)
- SET(PYTHON_TEST_DIR ${CMAKE_SOURCE_DIR}/py/test/)
- ADD_TEST(sequence_py
- ${PYTHON_EXECUTABLE} ${PYTHON_TEST_DIR}/TestSequence.py)
+ SET(PYTEST_DIR ${CMAKE_SOURCE_DIR}/py/test/)
+ ADD_TEST(TestSequence ${PYTHON_EXECUTABLE} ${PYTEST_DIR}/TestSequence.py)
+ ADD_TEST(TestFlp ${PYTHON_EXECUTABLE} ${PYTEST_DIR}/TestFlp.py)
ENDIF(PYTHON_EXECUTABLE)
ELSE(BOOST_PYTHON_LIBRARY)
ENDIF(BOOST_PYTHON_LIBRARY)
--- /dev/null
+#include <boost/python.hpp>
+#include <boost/python/list.hpp>
+#include <boost/python/return_internal_reference.hpp>
+#include <boost/python/return_by_value.hpp>
+#include <boost/python/return_value_policy.hpp>
+#include <boost/python/register_ptr_to_python.hpp>
+using namespace boost::python;
+
+#include "alg/flp.hpp"
+#include "alg/sequence.hpp"
+
+struct listint_to_python {
+ static PyObject *convert(const std::list<int> l) {
+ PyObject *pylist = PyList_New(0);
+ for(std::list<int>::const_iterator li = l.begin();
+ li != l.end();
+ ++li)
+ {
+ PyList_Append(pylist, PyInt_FromLong(*li));
+ }
+ return pylist;
+ }
+};
+
+void export_flps()
+{
+
+ class_<FLPs>("FLP")
+ .def("setup", &FLPs::setup, "set window size and lowest threshold")
+ .def("seqcomp", &FLPs::seqcomp, "compare two sequences\n"
+ "takes: sequence, seqeuence, bool is_reveresed flag")
+ .def("size", &FLPs::size, "return the length of the sequence")
+ .def("match_locations", &FLPs::match_locations, "return list of matches at a window location")
+ .def("thres_matches", &FLPs::thres_matches, "return list of matches at a window location above a threshold")
+ ;
+ //std::list<match> matches(int index) const;
+ //void save(boost::filesystem::path save_file_path);
+ //void load(boost::filesystem::path file_path);
+ to_python_converter< std::list<int>, listint_to_python>();
+}
\ No newline at end of file
void export_annot();
void export_annotation_colors();
void export_conserved_path();
+void export_flps();
void export_glsequence();
void export_mussa();
void export_nway_paths();
export_annot();
export_annotation_colors();
export_conserved_path();
+ export_flps();
export_glsequence();
export_mussa();
export_nway_paths();
--- /dev/null
+import os
+import sys
+import unittest
+
+# kinda hackish but it makes it possible to runi under ctest
+sys.path.append(os.getcwd())
+
+import mussa
+
+class TestFLP(unittest.TestCase):
+ def testSimple(self):
+ s1 = mussa.Sequence("A"*10)
+ s2 = mussa.Sequence("A"*10)
+ cmp = mussa.FLP()
+ cmp.setup(10,8)
+ cmp.seqcomp(s1,s2,False)
+ self.failUnlessEqual(cmp.size(), 1)
+ self.failUnlessEqual(cmp.match_locations(0), [0])
+
+def suite():
+ return unittest.makeSuite(TestFLP, 'test')
+
+if __name__ == "__main__":
+ sys.exit(unittest.main(defaultTest='suite'))
\ No newline at end of file