[project @ 13]
[mussa.git] / mussa_class.cc
index 7b2976339806535ea2f6bed2b1f395087474b6d4..91e279ebaa0b6be4c43bc69a71a2ef96bef00a49 100644 (file)
@@ -1,3 +1,13 @@
+//  This file is part of the Mussa source distribution.
+//  http://mussa.caltech.edu/
+//  Contact author: Tristan  De Buysscher, tristan@caltech.edu
+
+// This program and all associated source code files are Copyright (C) 2005
+// the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
+// under the GNU Public License; please see the included LICENSE.txt
+// file for more information, or contact Tristan directly.
+
+
 //                        ----------------------------------------
 //                          ---------- mussa_class.cc -----------
 //                        ----------------------------------------
@@ -93,7 +103,7 @@ string
 Mussa::load_mupa_file(string para_file_path)
 {
   ifstream para_file;
-  string file_data_line, file_path_base;
+  string file_data_line;
   string param, value, annot_file;
   int split_index, fasta_index;
   int sub_seq_start, sub_seq_end;
@@ -435,7 +445,7 @@ Mussa::nway()
 void
 Mussa::save()
 {
-  string save_path_base, save_path, create_dir_cmd, flp_filepath;
+  string save_name, save_path, create_dir_cmd, flp_filepath;
   fstream save_file;
   ostringstream append_info;
   int i, i2, dir_create_status;
@@ -450,23 +460,32 @@ Mussa::save()
   {
     append_info.str("");
     append_info <<  "_w" << window;
-    save_path_base += append_info.str();
+    save_name += append_info.str();
   }
 
   if (thres_append)
   {
     append_info.str("");
     append_info <<  "_t" << threshold;
-    save_path_base += append_info.str();
+    save_name += append_info.str();
   }
 
 //#include <stdlib.h>
-  create_dir_cmd = "mkdir " + save_path_base;
+  // ******* use appropriate for os ------- 1 of 4
+  // the additions for osX make it more sane where it saves the analysis
+  // will come up with a cleaner sol'n later...
+  create_dir_cmd = "mkdir " + save_name;       //linux
+  //create_dir_cmd = "mkdir " + file_path_base + save_name;  //osX
+
   dir_create_status = system( (const char*) create_dir_cmd.c_str());
   cout << "action: " << dir_create_status << endl;
 
   // save sequence and annots to a special mussa file
-  save_path = save_path_base + "/" + save_path_base + ".museq";
+
+  // ******** use appropriate for OS ---------- 2 of 4
+  save_path = save_name + "/" + save_name + ".museq";   //linux
+  //save_path = file_path_base + save_name + "/" + save_name + ".museq"; //osX
+
   save_file.open(save_path.c_str(), ios::out);
   save_file << "<Mussa_Sequence>" << endl;
   //save_file.close();
@@ -479,7 +498,10 @@ Mussa::save()
   save_file.close();
 
   // save nway paths to its mussa save file
-  save_path = save_path_base + "/" + save_path_base + ".muway";
+
+  // ******** use appropriate for OS -------- 3 of 4
+  save_path = save_name + "/" + save_name + ".muway";  //linux
+  //save_path = file_path_base + save_name + "/" + save_name + ".muway"; //os X
   the_paths.save(save_path);
 
   for(i = 0; i < seq_num; i++)
@@ -487,7 +509,11 @@ Mussa::save()
     {
       append_info.str("");
       append_info <<  "_sp_" << i << "v" << i2;
-      save_path = save_path_base + "/" + save_path_base + append_info.str() + ".flp";
+      // ******** use appropriate for OS --------- 4 of 4
+      //linux
+      save_path = save_name + "/" + save_name + append_info.str() + ".flp";
+      //osX
+      //save_path = file_path_base + save_name + "/" + save_name + append_info.str() + ".flp";
       all_comps[i][i2].file_save(save_path);
     }
 }