expose more of the sequence class to python
authorDiane Trout <diane@caltech.edu>
Thu, 18 May 2006 00:55:40 +0000 (00:55 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 18 May 2006 00:55:40 +0000 (00:55 +0000)
alg/sequence.cpp
alg/sequence.hpp
py/sequence.cpp

index d7b4acd9c9f78c9f4c90e96fc3f145d3a2f2c396..903d6c7dcb516b5d41bb8ed64051c01b84bbc6f1 100644 (file)
@@ -551,12 +551,12 @@ Sequence::rev_comp() const
   return rev_comp;
 }
 
-void Sequence::set_header(std::string &header_)
+void Sequence::set_header(std::string header_)
 {
   header = header_;
 }
 
-const std::string&
+std::string
 Sequence::get_header() const
 {
   return header;
index 3b09312da7aba088d233cf6ca911d221dd113ca1..be1f70f5ed3c10dce4a86b0f05fa7ecd12caad26 100644 (file)
@@ -118,8 +118,8 @@ class Sequence
     std::string::size_type size() const;
     void clear();
 
-    void set_header(std::string& header);
-    const std::string& get_header() const;
+    void set_header(std::string header);
+    std::string get_header() const;
     //! add a motif to our list of motifs
     //! \throws motif_normalize_error if there's something wrong with a_motif
     void add_motif(std::string a_motif);
index 3167d56b1ec9edfe6a9eb6e05e856c8e606af6c5..72284f9019e53dadf89c251c977fae63a9be7454 100644 (file)
@@ -1,4 +1,7 @@
 #include <boost/python.hpp>
+#include <boost/python/return_internal_reference.hpp>
+#include <boost/python/return_by_value.hpp>
+#include <boost/python/return_value_policy.hpp>
 using namespace boost::python;
 
 #include <string>
@@ -11,6 +14,8 @@ void export_sequence()
     .def("__str__", &Sequence::get_seq, return_value_policy<return_by_value>())
     .def("size", &Sequence::size)
     .def("__len__", &Sequence::size)
-    //.add_property("header", &Sequence::get_header)
+    .add_property("header", &Sequence::get_header, &Sequence::set_header)
+    //.add_property("seq", &Sequence::get_seq, &Sequence::set_seq)
+    .def("rcseq", &Sequence::rev_comp, return_value_policy<return_by_value>())
   ;
 }