using namespace std;
+void callback(const std::string& desc, int cur, int end)
+{
+ std::cout << "analysis:" << desc << " " << cur << "/" << end << std::endl;
+}
+
Mussa::Mussa()
{
clear();
ana_mode(m.ana_mode),
win_append(m.win_append),
thres_append(m.thres_append),
+ analysis_cb(m.analysis_cb),
motif_sequences(m.motif_sequences),
color_mapper(m.color_mapper)
{
soft_thres = 0;
win_append = false;
thres_append = false;
+ analysis_cb = callback;
motif_sequences.clear();
color_mapper.clear();
}
return 0;
}
+
+void Mussa::set_analysis_callback(analysis_callback cb)
+{
+ analysis_cb = cb;
+}
+
+analysis_callback Mussa::get_analysis_calback() const
+{
+ return analysis_cb;
+}
+
void
Mussa::set_window(int a_window)
{
void
-Mussa::analyze(int w, int t, enum Mussa::analysis_modes the_ana_mode, double new_ent_thres)
+Mussa::analyze()
{
time_t t1, t2, begin, end;
double seqloadtime, seqcomptime, nwaytime, savetime, totaltime;
begin = time(NULL);
- ana_mode = the_ana_mode;
- ent_thres = new_ent_thres;
- if (w > 0)
- window = w;
- if (t > 0)
- {
- threshold = t;
- soft_thres = t;
- }
-
t1 = time(NULL);
if (the_seqs.size() < 2) {
t2 = time(NULL);
seqcomptime = difftime(t2, t1);
-
t1 = time(NULL);
the_paths.setup(window, threshold);
nway();
for(vector<Sequence>::size_type i = 0; i < the_seqs.size(); i++)
seq_lens.push_back(the_seqs[i].size());
+ int seqcomps_done = 0;
+ int seqcomps_todo = (the_seqs.size() * (the_seqs.size()-1)) / 2;
+
for(vector<Sequence>::size_type i = 0; i < the_seqs.size(); i++)
for(vector<Sequence>::size_type i2 = i+1; i2 < the_seqs.size(); i2++)
{
all_comps[i][i2].setup(window, threshold);
all_comps[i][i2].seqcomp(the_seqs[i].get_seq(), the_seqs[i2].get_seq(), false);
all_comps[i][i2].seqcomp(the_seqs[i].get_seq(),the_seqs[i2].rev_comp(),true);
+ ++seqcomps_done;
+ if (analysis_cb) {
+ analysis_cb("seqcomp", seqcomps_done, seqcomps_todo);
+ }
}
}
vector<string> some_Seqs;
the_paths.set_soft_threshold(soft_thres);
+ the_paths.set_progress_callback(analysis_cb);
if (ana_mode == TransitiveNway) {
the_paths.trans_path_search(all_comps);