more python interface to Sequence
authorDiane Trout <diane@caltech.edu>
Tue, 17 Oct 2006 06:50:49 +0000 (06:50 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 17 Oct 2006 06:50:49 +0000 (06:50 +0000)
py/sequence.cpp

index e340fe630fc96e356a5845cc5d455b22e1b24e81..fbee90d08f34cba11ccd6c1062989cd262bcd481 100644 (file)
@@ -6,6 +6,9 @@
 #include <boost/python/register_ptr_to_python.hpp>
 using namespace boost::python;
 
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
 #include <boost/shared_ptr.hpp>
 
 #include <string>
@@ -13,18 +16,24 @@ using namespace boost::python;
 
 void export_sequence()
 {
+  void (Sequence::*load_fasta_piii)(const fs::path, int, int, int) = &Sequence::load_fasta;
+  
   class_<Sequence>("Sequence")
     .def(init<std::string>())
-    .def("__str__", &Sequence::get_sequence, "cast to string")
-    .def("__repr__", &Sequence::get_sequence, "display as string")
-    .def("size", &Sequence::size, "return the length of the sequence")
     .def("__len__", &Sequence::size, "return the length of the sequence")
-    .def("clear", &Sequence::clear, "clear the sequence and its annotations")
-    .add_property("header", &Sequence::get_fasta_header, &Sequence::set_fasta_header, "the fasta header")
-    .add_property("species", &Sequence::get_species, &Sequence::set_species)
+    .def("__repr__", &Sequence::get_sequence, "display as string")
+    .def("__str__", &Sequence::get_sequence, "cast to string")
     .def("add_annotation", &Sequence::add_annotation, "append an annotation")
     //.def("annotations", &Sequence::annotations, "return list of annotations")
+    .def("add_motif", &Sequence::add_motif, "add a motif sequenence")
+    .def("clear", &Sequence::clear, "clear the sequence and its annotations")
+    .def("empty", &Sequence::empty, "Is the sequence empty")
+    .def("load_fasta", load_fasta_piii, "Load fasta")
+    .add_property("header", &Sequence::get_fasta_header, &Sequence::set_fasta_header, "the fasta header")
     .def("rcseq", &Sequence::rev_comp, return_value_policy<return_by_value>())
+    .def("size", &Sequence::size, "return the length of the sequence")
+    .add_property("species", &Sequence::get_species, &Sequence::set_species)
+    .def("subseq", &Sequence::subseq, "return a subsequence")
   ;
 
   register_ptr_to_python< boost::shared_ptr<Sequence> >();