Store Sequence sequence location in a shared_ptr class
[mussa.git] / py / nway_paths.cpp
index 73a13a9ec3034043041f672df0ee494edd843995..ba605d9d76c2ad3aef76122368b2b95a378949c9 100644 (file)
@@ -1,15 +1,37 @@
 #include <boost/python.hpp>
-using namespace boost::python;
+namespace py = boost::python;
 
 #include "alg/nway_paths.hpp"
 
 void export_nway_paths()
 {
-  class_<NwayPaths>("NwayPaths")
-    .add_property("pathz", range(&NwayPaths::pbegin, 
-                                 &NwayPaths::pend))
-    .add_property("refinedPathz", range(&NwayPaths::rpbegin,
-                                        &NwayPaths::rpend))
-  ;
+  /*py::class_<NwayPaths::ConservedPaths>("ConservedPaths")
+    .def("__len__", &NwayPaths::ConservedPaths::size, "return length of paths")
+    .def("__contains__", &std_item<NwayPaths::ConservedPaths>::in)
+    .def("__iter__", py::iterator<NwayPaths::ConservedPaths>())
+    .def("clear", &NwayPaths::ConservedPaths::clear, "remove all the paths")
+    .def("append", &std_item<NwayPaths::ConservedPaths>::add,
+        py::with_custodian_and_ward<1,2>()) // to let container keep value
+    .def("__getitem__", &std_item<NwayPaths::ConservedPaths>::get,
+        py::return_value_policy<py::copy_non_const_reference>())
+    .def("__setitem__", &std_item<NwayPaths::ConservedPaths>::set,
+        py::with_custodian_and_ward<1,2>()) // to let container keep value
+    .def("__delitem__", &std_item<NwayPaths::ConservedPaths>::del)
+  ;*/
+   py::class_<NwayPaths>("NwayPaths")
+    .def("__len__", &NwayPaths::size, "number of paths")
+    .def("sequence_count", &NwayPaths::sequence_count,
+         "number of sequences in this analysis")
+    .def("clear", &NwayPaths::clear, "remove all paths")
+    .add_property("threshold", &NwayPaths::get_threshold, "Get hard threshold")
+    .add_property("soft_threshold", &NwayPaths::get_soft_threshold, &NwayPaths::set_soft_threshold)
+    .add_property("window_size", &NwayPaths::get_window)
+    .add_property("pathz", py::range(&NwayPaths::pbegin, &NwayPaths::pend))
+    .def("path_size", &NwayPaths::path_size, "number of nway paths")
+    .add_property("refinedPathz", py::range(&NwayPaths::rpbegin, &NwayPaths::rpend))
+    .def("refined_path_size", &NwayPaths::refined_path_size, 
+         "number of paths that match the soft threshold")
+   ;
 }