go back to sequence being its own class
[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 #include <boost/python/register_ptr_to_python.hpp>
7 using namespace boost::python;
8
9 #include <boost/shared_ptr.hpp>
10
11 #include <string>
12 #include "alg/glsequence.hpp"
13
14 void export_sequence()
15 {
16   class_<Sequence>("Sequence")
17     .def(init<std::string>())
18     .def("__str__", &Sequence::get_sequence, "cast to string")
19     .def("__repr__", &Sequence::get_sequence, "display as string")
20     .def("size", &Sequence::size, "return the length of the sequence")
21     .def("__len__", &Sequence::size, "return the length of the sequence")
22     .def("clear", &Sequence::clear, "clear the sequence and its annotations")
23     .add_property("header", &Sequence::get_fasta_header, &Sequence::set_fasta_header, "the fasta header")
24     .add_property("species", &Sequence::get_species, &Sequence::set_species)
25     .def("add_annotation", &Sequence::add_annotation, "append an annotation")
26     //.def("annotations", &Sequence::annotations, "return list of annotations")
27     .def("rcseq", &Sequence::rev_comp, return_value_policy<return_by_value>())
28   ;
29
30   register_ptr_to_python< boost::shared_ptr<Sequence> >();
31 }