Louis BECQUEY

supports BayesPairing

......@@ -193,14 +193,35 @@ void Motif::load_from_csv(string csv_line)
{
vector<string> tokens;
split(tokens, csv_line, boost::is_any_of(","));
atlas_id = tokens[0];
score_ = stoi(tokens[2]);
comp.push_back(Component(make_pair<int, int>(stoi(tokens[3]), stoi(tokens[4]))));
if (tokens[5] != "-") comp.push_back(Component(make_pair<int, int>(stoi(tokens[5]), stoi(tokens[6]))));
reversed_ = (tokens[1] == "True");
is_model_ = true;
PDBID = "";
source_ = RNAMOTIFATLAS;
if (csv_line.find(string("True")) != std::string::npos or csv_line.find(string("False")) != std::string::npos) { // This has been created by jar3d
atlas_id = tokens[0];
score_ = stoi(tokens[2]);
comp.push_back(Component(make_pair<int, int>(stoi(tokens[3]), stoi(tokens[4]))));
if (tokens[5] != "-") comp.push_back(Component(make_pair<int, int>(stoi(tokens[5]), stoi(tokens[6]))));
reversed_ = (tokens[1] == "True");
is_model_ = true;
PDBID = "";
source_ = RNAMOTIFATLAS;
} else { // this has been created by BayesPairing
score_ = stoi(tokens[1]);
// identify source:
if (tokens[0].find(string("rna3dmotif")) == std::string::npos) {
is_model_ = true;
PDBID = "";
source_ = RNAMOTIFATLAS;
atlas_id = tokens[0];
} else {
is_model_ = false;
PDBID = tokens[0];
source_ = RNA3DMOTIF;
atlas_id = "";
}
uint i = 2;
while (i < tokens.size()) {
comp.push_back(Component(make_pair<int, int>(stoi(tokens[i]), stoi(tokens[i + 1]))));
i += 2;
}
}
}
string Motif::pos_string(void) const
......@@ -378,7 +399,7 @@ vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbo
return posInsertionSites;
}
vector<Motif> load_jar3d_output(const string& path)
vector<Motif> load_csv(const string& path)
{
vector<Motif> posInsertionSites;
std::ifstream motifs;
......
......@@ -41,7 +41,7 @@ class Motif
public:
Motif();
Motif(const vector<Component>& v, string PDB);
void load_from_csv(string csv_line);
void load_from_csv(string csv_line);
// static void build_from_desc(path descfile, string rna, vector<Motif>& final_results);
static void build_from_desc(args_of_parallel_func args);
static char is_valid_DESC(const string& descfile);
......@@ -63,7 +63,7 @@ class Motif
bool is_desc_insertible(const string& descfile, const string& rna, bool verbose);
vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbose);
vector<Motif> load_jar3d_output(const string& path);
vector<Motif> load_csv(const string& path);
// utilities to compare secondary structures:
bool operator==(const Motif& m1, const Motif& m2);
......
......@@ -72,12 +72,14 @@ int main(int argc, char* argv[])
"descfolder,d",
po::value<string>(&motifs_path_name),
"A folder containing modules in .desc format, as produced by Djelloul & Denise's catalog program")(
"jar3dcsv,f",
"jar3dcsv",
po::value<string>(&motifs_path_name),
"A file containing the output of JAR3D's search for motifs in the sequence, as produced by searchForMotifSites.py")(
"first-objective,c",
po::value<unsigned int>(&MOIP::obj_to_solve_)->default_value(1),
"Objective to solve in the mono-objective portions of the algorithm")("output,o", po::value<string>(&outputName), "A file to summarize the computation results")(
"A file containing the output of JAR3D's search for motifs in the sequence, as produced by test_on_RNAstrand.py")(
"bayespaircsv",
po::value<string>(&motifs_path_name),
"A file containing the output of BayesPairing's search for motifs in the sequence, as produced by "
"test_on_RNAstrand.py")("first-objective,c", po::value<unsigned int>(&MOIP::obj_to_solve_)->default_value(1), "Objective to solve in the mono-objective portions of the algorithm")(
"output,o", po::value<string>(&outputName), "A file to summarize the computation results")(
"theta,t",
po::value<float>(&theta_p_threshold)->default_value(0.001),
"Pairing probability threshold to consider or not the possibility of pairing")(
......@@ -108,14 +110,16 @@ int main(int argc, char* argv[])
return EXIT_SUCCESS;
}
if (vm.count("verbose")) verbose = true;
if (!vm.count("jar3dcsv") and !vm.count("descfolder")) {
cerr << "\033[31mYou must provide at least --jar3dcsv or --descfolder.\033[0m See --help for more "
if (!vm.count("jar3dcsv") and !vm.count("bayespaircsv") and !vm.count("descfolder")) {
cerr << "\033[31mYou must provide at least --jar3dcsv, --bayespaircsv or --descfolder.\033[0m See --help "
"for more "
"information."
<< endl;
return EXIT_FAILURE;
}
if (vm.count("-d") and (obj_function_nbr == 1 or obj_function_nbr == 3)) {
cerr << "\033[31mYou must provide at -f to use --type 1 or --type 3.\033[0m See --help for more "
if (vm.count("-d") and (obj_function_nbr == 2 or obj_function_nbr == 3)) {
cerr << "\033[31mYou must provide --jar3dcsv or --bayespaircsv to use --type 2 or --type 3.\033[0m See "
"--help for more "
"information."
<< endl;
return EXIT_FAILURE;
......@@ -150,7 +154,9 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
if (vm.count("jar3dcsv"))
posInsertionSites = load_jar3d_output(motifs_path_name.c_str());
posInsertionSites = load_csv(motifs_path_name.c_str());
else if (vm.count("bayespaircsv"))
posInsertionSites = load_csv(motifs_path_name.c_str());
else
posInsertionSites = load_desc_folder(motifs_path_name.c_str(), fa->seq(), verbose);
......