Use BOOST_PYTHON_LIBRARY as python library guard
[mussa.git] / py / sequence.cpp
1 #include <boost/python.hpp>
2 #include <boost/iterator.hpp>
3 #include <boost/python/return_internal_reference.hpp>
4 #include <boost/python/return_by_value.hpp>
5 #include <boost/python/return_value_policy.hpp>
6 using namespace boost::python;
7
8 #include <string>
9 #include "alg/glsequence.hpp"
10
11 PyObject* seq_to_string(const Sequence& s) {
12   ::PyString_FromStringAndSize(s.data(), s.size());
13 }
14
15 void export_sequence()
16 {
17   class_<Sequence>("Sequence")
18     .def(init<std::string>())
19     .def("__str__", &seq_to_string)
20     .def("size", &Sequence::size)
21     .def("__len__", &Sequence::size)
22     .add_property("header", &Sequence::get_fasta_header, &Sequence::set_fasta_header)
23     .add_property("species", &Sequence::get_species, &Sequence::set_species)
24     .def("rcseq", &Sequence::rev_comp, return_value_policy<return_by_value>())
25   ;
26 }