From f9e7b753cc0cb40edc4a965ad2649a457d3dcc8a Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Fri, 13 Oct 2006 05:48:13 +0000 Subject: [PATCH] save motifs with the analysis ticket:133 This is the last part to implement ticket:133 this hooks up the Mussa::save and Mussa::load code to automatically try saving the motif lists into the analysis subdirectory. --- alg/mussa.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/alg/mussa.cpp b/alg/mussa.cpp index 18539b8..ae21f5b 100644 --- a/alg/mussa.cpp +++ b/alg/mussa.cpp @@ -12,6 +12,7 @@ // ---------- mussa_class.cc ----------- // ---------------------------------------- +#include #include #include namespace fs = boost::filesystem; @@ -584,6 +585,11 @@ Mussa::save(fs::path save_path) save_file << "" << endl; save_file.close(); + // if we have any motifs, save them. + if (motif_sequences.size()) { + save_motifs(save_path/(save_path.leaf()+".mtl")); + } + // save nway paths to its mussa save file the_paths.save(save_path / (save_path.leaf()+ ".muway")); @@ -595,6 +601,7 @@ Mussa::save(fs::path save_path) all_comps[i][i2].save(save_path/(save_path.leaf()+append_info.str()+".flp")); } } + dirty = false; analysis_path = save_path; } @@ -619,12 +626,9 @@ Mussa::load(fs::path ana_file) FLPs dummy_comp; analysis_path = ana_file; - //clog << "ana_file name " << ana_file.string() << endl; analysis_name = ana_path.leaf(); - //clog << " ana_name " << analysis_name << endl; file_path_base = ana_path.branch_path() / analysis_name; a_file_path = file_path_base / (analysis_name + ".muway"); - //clog << " loading museq: " << a_file_path.string() << endl; the_paths.load(a_file_path); // perhaps this could be more elegent, but at least this'll let // us know what our threshold and window sizes were when we load a muway @@ -640,11 +644,14 @@ Mussa::load(fs::path ana_file) for (i = 1; i <= seq_num; i++) { boost::shared_ptr tmp_seq(new Sequence); - //clog << "mussa_class: loading museq frag... " << a_file_path.string() << endl; tmp_seq->load_museq(a_file_path, i); the_seqs.push_back(tmp_seq); } + fs::path motif_file = file_path_base / (analysis_name + ".mtl"); + if (fs::exists(motif_file)) { + load_motifs(motif_file); + } empty_FLP_vector.clear(); for(i = 0; i < seq_num; i++) { -- 2.30.2