// ----------------------------------------
// ---------- mussa_nway.hh -----------
// ----------------------------------------
+#include <QObject>
+#include <QString>
+
+#include <boost/filesystem/path.hpp>
#include <list>
#include <string>
#include <vector>
-#include "alg/flp.hpp"
#include "alg/conserved_path.hpp"
+#include "alg/flp.hpp"
+#include "alg/sequence.hpp"
-class NwayPaths
+class NwayPaths : public QObject
{
- friend class ConnView;
- friend class SeqView;
- protected:
- int threshold;
- int win_size;
- int soft_thres;
+ Q_OBJECT
- double ent_thres;
- std::vector<char *> c_sequences; //used by entropy_path_search
+signals:
+ //! emit to indicate how much progress we've made
+ void progress(const QString& description, int cur, int max);
- public:
+public:
+ typedef size_t size_type;
+ typedef std::list<ConservedPath> ConservedPaths;
+
NwayPaths();
+ NwayPaths(const NwayPaths&);
+
//! setup an nway comparison, initialize # of species, window size,
//! threshold
void setup(int w, int t);
- void setup_ent(double new_entropy_thres, std::vector<std::string> some_Seqs);
- void set_soft_thres(int soft_thres);
+ void setup_ent(double new_entropy_thres, std::vector<Sequence> some_Seqs);
+ //! clear out our path
+ void clear();
+ //! get the "soft" threshold (between the hard threshold and window size)
+ int get_soft_threshold() const;
+ //! set the score that a match must exceed inorder to be recorded as a path
+ void set_soft_threshold(int soft_thres);
+ //! return minimum threshold for this analysis
+ int get_threshold() const;
+ //! return window size used for this analysis
+ int get_window() const;
void radiate_path_search(std::vector<std::vector<FLPs> > all_comparisons);
void trans_path_search(std::vector<std::vector<FLPs> > all_comparisons);
// old recursive transitive nway ... has issues checking all links?
void find_paths_r(std::vector<std::vector<FLPs> > all_comparisons);
- void path_search(std::vector<std::vector<FLPs> > all_comparisons, ConservedPath path, int depth);
+ void path_search(std::vector<std::vector<FLPs> > all_comparisons, ConservedPath path, size_type depth);
void simple_refine();
- void save(std::string save_file_path);
+ void save(boost::filesystem::path save_file_path);
//! load a muway file, \throws mussa_load_error
- void load(std::string load_file_path);
+ void load(boost::filesystem::path load_file_path);
void add_path(int threshold, std::vector<int>& loaded_path);
void add_path(ConservedPath loaded_path);
//! how many sequences are in our comparison
- size_t sequence_count();
+ size_type sequence_count() const;
void find_paths(std::vector<std::vector<FLPs> > all_comparisons);
void refine();
- void save_old(std::string save_file_path);
+ void save_old(boost::filesystem::path save_file_path);
void print(std::list<std::vector<int> >&);
- std::list<ConservedPath>::iterator pbegin() { return pathz.begin() ; }
- std::list<ConservedPath>::iterator pend() { return pathz.end() ; }
- std::list<ConservedPath>::const_iterator pbegin() const { return pathz.begin() ; }
- std::list<ConservedPath>::const_iterator pend() const { return pathz.end() ; }
- std::list<ExtendedConservedPath>::iterator rpbegin() { return refined_pathz.begin() ; }
- std::list<ExtendedConservedPath>::const_iterator rpend() const { return refined_pathz.end() ; }
- std::list<ExtendedConservedPath>::const_iterator rpbegin() const { return refined_pathz.begin() ; }
- std::list<ExtendedConservedPath>::iterator rpend() { return refined_pathz.end() ; }
+ // The following iterator functions are mostly for the python interface
+ // they'll have problems when being called from within a const object
+ ConservedPaths::iterator pbegin() { return pathz.begin() ; }
+ ConservedPaths::iterator pend() { return pathz.end() ; }
+ size_type path_size() const { return pathz.size(); }
+ ConservedPaths::iterator rpbegin() { return refined_pathz.begin() ; }
+ ConservedPaths::iterator rpend() { return refined_pathz.end() ; }
+ size_type refined_path_size() const { return refined_pathz.size(); }
+
+ size_type size() const;
// these probably shouldn't be public, but lets start
// simple
- std::list<ConservedPath> pathz;
- std::list<ExtendedConservedPath > refined_pathz;
+ ConservedPaths pathz;
+ ConservedPaths refined_pathz;
+
+protected:
+ int threshold;
+ size_type win_size;
+ int soft_thres;
+
+ double ent_thres;
+ std::vector<char *> c_sequences; //used by entropy_path_search
};
#endif