FIND_PACKAGE(Boost 1.34.1 COMPONENTS filesystem serialization program_options python)
FIND_PACKAGE(PythonLibs)
-SET(USE_PYTHON 1)
+SET(USE_PYTHON 0 CACHE BOOL
+ "Build mussa executable linked to python interpreter")
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}
${QT_INCLUDES}
FIND_PACKAGE(OpenGL )
-FIND_PACKAGE(Boost 1.34.1 COMPONENTS filesystem unit_test_framework serialization program_options python2.3 )
+FIND_PACKAGE(Boost 1.34.1 COMPONENTS filesystem unit_test_framework serialization program_options python )
FIND_PACKAGE(Qt4)
INCLUDE( ${QT_USE_FILE} )
INCLUDE( Platform )
Mussa::set_soft_threshold(int new_threshold)
{
if (new_threshold < threshold) {
- soft_thres = threshold;
+ new_threshold = threshold;
} else if (new_threshold > window) {
- soft_thres = window;
- } else {
+ new_threshold = window;
+ }
+ if (soft_thres != new_threshold) {
soft_thres = new_threshold;
+ nway();
}
}
set_dirty(true);
}
-void Mussa::load_mupa_file(std::string para_file_path) {
- load_mupa_file(boost::filesystem::path(para_file_path));
-}
-
void
Mussa::load_mupa_file(fs::path para_file_path)
{
//! save all of mussa
void save(boost::filesystem::path save_path="");
+ //! save all of mussa
+ void save(const std::string& save_path) {
+ save(boost::filesystem::path(save_path));
+ }
//! save the nway comparison
void save_muway(boost::filesystem::path save_path);
//! load a saved analysis directory
void load(boost::filesystem::path ana_path);
+ //! load a saved analysis
+ void load(const std::string& ana_path) {
+ load(boost::filesystem::path(ana_path));
+ }
// ! return path to the where the analysis is stored
boost::filesystem::path get_analysis_path() const;
//! set analysis path
void clear();
//! set parameters from a file - 'mupa' ~ mussa parameters
- void load_mupa_file(std::string para_file_path);
+ void Mussa::load_mupa_file(const std::string& para_file_path) {
+ load_mupa_file(boost::filesystem::path(para_file_path));
+ }
void load_mupa_file(boost::filesystem::path para_file_path);
//! load mussa parameters from a stream, specifing output location
void load_mupa_stream(
*/
void analyze();
/*! Run the nway filtering algorithm,
- * this might be used when changing the soft threshhold?
+ * automatically called when the soft threshhold has changed?
*/
void nway();
std::string create_reverse_complement_map() const;
- const std::string rc_map;
private:
AlphabetRef alphabet;
+public:
+ const std::string rc_map;
+private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int /*version*/) {
void export_mussa()
{
- void (Mussa::*load_mupa_string)(std::string) = &Mussa::load_mupa_file;
+ void (Mussa::*save_string)(const std::string &) = &Mussa::save;
+ void (Mussa::*load_mupa_string)(const std::string &) = &Mussa::load_mupa_file;
+ void (Mussa::*load_string)(const std::string &) = &Mussa::load;
void (Mussa::*append_sequence_ref)(const Sequence&) = &Mussa::append_sequence;
void (Mussa::*append_sequence_ptr)(const boost::shared_ptr<Sequence>) = &Mussa::append_sequence;
;
py::class_<Mussa>("_Mussa", py::no_init)
- .def("save", &Mussa::save)
- .def("load", &Mussa::load, "Load previous run analysis")
+ .def("save", save_string, "Save analysis in the specified directory")
+ .def("load", load_string, "Load previous run analysis")
.def("load_mupa", load_mupa_string, "Load mussa parameter file")
.def("clear", &Mussa::clear, "Clear the current analysis")
.add_property("name", &Mussa::get_name, &Mussa::set_name, "Set the name of the analysis")
"the number of base pairs in the sliding window")
.add_property("threshold", &Mussa::get_threshold, &Mussa::set_threshold,
"how many base pairs must match between two windows")
- .def("softThreshold", &Mussa::set_soft_threshold)
+ .add_property("softThreshold", &Mussa::get_soft_threshold,
+ &Mussa::set_soft_threshold)
.add_property("analysisMode", &Mussa::get_analysis_mode,
&Mussa::set_analysis_mode)
.add_property("analysisModeName", &Mussa::get_analysis_mode_name)
.def("sequences", &Mussa::sequences, py::return_internal_reference<>(), "return list of sequences")
.def("add_sequence", append_sequence_ref, "attach a sequence to the analysis")
;
- py::def("Mussa", &Mussa::init, "Construct a new Mussa object");
+ py::def("Mussa", &Mussa::init,
+ "Construct a new Mussa object.\n"
+ "You can use this to load a previous analysis or to construct\n"
+ "a new analysis.\n");
py::register_ptr_to_python< boost::shared_ptr<Mussa> >();
py::enum_<Mussa::analysis_modes>("analysis_modes")
class_<Sequence>("Sequence")
.def(init<std::string>())
+ .def("__getitem__", &Sequence::at, "return base pair at specified location",
+ return_value_policy<return_by_value>())
.def("__len__", &Sequence::size, "return the length of the sequence")
.def("__repr__", &Sequence::get_sequence, "display as string")
.def("__str__", &Sequence::get_sequence, "cast to string")
namespace py = boost::python;
#include <vector>
-#include "alg/sequence.hpp"
+#include "alg/Sequence.hpp"
#include "alg/glsequence.cpp"
#include "alg/glseqbrowser.cpp"
#include "qui/seqbrowser/SequenceBrowserWidget.hpp"
FIND_PACKAGE(PythonLibs)
-FIND_PACKAGE(Boost 1.34.1 COMPONENTS program_options filesystem serialization python2.3 unit_test_framework )
+FIND_PACKAGE(Boost 1.34.1 COMPONENTS program_options filesystem serialization python unit_test_framework )
INCLUDE(Platform)
SET(SOURCES test_python.cpp )
self.failUnless(str(s) == seq_text)
self.failUnless(str(s) == seq_text)
+ for i in range(len(seq_text)):
+ self.failUnlessEqual(s[i], seq_text[i])
+
def testNames(self):
seq_text = "AAGGCCTT"
header_text = "hello"