X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Fmussa.cpp;h=82b1d4a6585e49c1a946e9093413b0be357ab570;hp=f75290c58705c68ea8e7ccb152da253fde976cbb;hb=02adcab9918657891638e68580b8b88e6d935875;hpb=7d16486e23b3d94c49986b082b9de1b508fd6183 diff --git a/alg/mussa.cpp b/alg/mussa.cpp index f75290c..82b1d4a 100644 --- a/alg/mussa.cpp +++ b/alg/mussa.cpp @@ -639,6 +639,10 @@ Mussa::load(fs::path ana_file) vector empty_FLP_vector; FLPs dummy_comp; + + //-------------------------------------------------------- + // Load Muway + //-------------------------------------------------------- analysis_path = ana_file; analysis_name = ana_path.leaf(); fs::path muway(analysis_name+".muway", fs::native); @@ -650,24 +654,63 @@ Mussa::load(fs::path ana_file) threshold = the_paths.get_threshold(); soft_thres = threshold; - int seq_num = the_paths.sequence_count(); + + //-------------------------------------------------------- + // Load Sequence + //-------------------------------------------------------- + //int seq_num = the_paths.sequence_count(); fs::path museq(analysis_name + ".museq", fs::native); a_file_path = analysis_path / museq; // this is a bit of a hack due to C++ not acting like it should with files - for (i = 1; i <= seq_num; i++) + /*for (i = 1; i <= seq_num; i++) { boost::shared_ptr tmp_seq(new Sequence); tmp_seq->load_museq(a_file_path, i); the_seqs.push_back(tmp_seq); + }*/ + + i = 1; + //int seq_num = 0; + boost::filesystem::fstream load_museq_fs; + load_museq_fs.open(a_file_path, std::ios::in); + boost::shared_ptr tmp_seq; + while (1) + { + tmp_seq = Sequence::load_museq(load_museq_fs); + + if (tmp_seq) + { + the_seqs.push_back(tmp_seq); + } + else + { + break; + } + + + //safe guard in case of an infinate loop. + //FIXME: If mussa can handle a comparison of 10000 sequences + // in the future, then this code should be fixed. + if (i == 10000) + { + throw mussa_load_error(" Run away sequence load!"); + } + i++; } + load_museq_fs.close(); + //-------------------------------------------------------- + // Load Motifs + //-------------------------------------------------------- fs::path mtl(analysis_name + ".mtl", fs::native); fs::path motif_file = analysis_path / mtl; if (fs::exists(motif_file)) { load_motifs(motif_file); } + + vector::size_type seq_num = the_seqs.size(); empty_FLP_vector.clear(); for(i = 0; i < seq_num; i++) { @@ -676,6 +719,7 @@ Mussa::load(fs::path ana_file) all_comps[i].push_back(dummy_comp); } + for(i = 0; i < seq_num; i++) { for(i2 = i+1; i2 < seq_num; i2++)