// ---------- mussa_nway.cc -----------
// ----------------------------------------
+#include <boost/filesystem/fstream.hpp>
+namespace fs = boost::filesystem;
+
#include "alg/nway_paths.hpp"
#include "alg/conserved_path.hpp"
#include "mussa_exceptions.hpp"
-#include <fstream>
#include <iostream>
#include <stdexcept>
void
-NwayPaths::save(string save_file_path)
+NwayPaths::save(fs::path save_file_path)
{
- fstream save_file;
+ fs::fstream save_file;
list<ExtendedConservedPath >::iterator path_i, paths_end;
- save_file.open(save_file_path.c_str(), ios::out);
+ save_file.open(save_file_path, ios::out);
save_file << "<Mussa type=flp seq_count=" << sequence_count();
save_file << " win=" << win_size;
void
-NwayPaths::load(string load_file_path)
+NwayPaths::load(fs::path load_file_path)
{
- fstream load_file;
+ fs::fstream load_file;
string file_data_line, header_data, data, path_node, path_width;
int space_split_i, equal_split_i, comma_split_i, colon_split_i;
vector<int> loaded_path;
- load_file.open(load_file_path.c_str(), ios::in);
+ load_file.open(load_file_path, ios::in);
if (!load_file)
{
- throw mussa_load_error("Sequence File: " + load_file_path + " not found");
+ throw mussa_load_error("Sequence File: " + load_file_path.string() + " not found");
}
else
{
void
-NwayPaths::save_old(string save_file_path)
+NwayPaths::save_old(fs::path save_file_path)
{
- fstream save_file;
+ fs::fstream save_file;
list<ConservedPath >::iterator path_i, paths_end;
size_t i;
- save_file.open(save_file_path.c_str(), ios::app);
+ save_file.open(save_file_path, ios::app);
path_i = pathz.begin();
paths_end = pathz.end();