Showing
3 changed files
with
48 additions
and
21 deletions
... | @@ -193,14 +193,35 @@ void Motif::load_from_csv(string csv_line) | ... | @@ -193,14 +193,35 @@ void Motif::load_from_csv(string csv_line) |
193 | { | 193 | { |
194 | vector<string> tokens; | 194 | vector<string> tokens; |
195 | split(tokens, csv_line, boost::is_any_of(",")); | 195 | split(tokens, csv_line, boost::is_any_of(",")); |
196 | - atlas_id = tokens[0]; | 196 | + if (csv_line.find(string("True")) != std::string::npos or csv_line.find(string("False")) != std::string::npos) { // This has been created by jar3d |
197 | - score_ = stoi(tokens[2]); | 197 | + atlas_id = tokens[0]; |
198 | - comp.push_back(Component(make_pair<int, int>(stoi(tokens[3]), stoi(tokens[4])))); | 198 | + score_ = stoi(tokens[2]); |
199 | - if (tokens[5] != "-") comp.push_back(Component(make_pair<int, int>(stoi(tokens[5]), stoi(tokens[6])))); | 199 | + comp.push_back(Component(make_pair<int, int>(stoi(tokens[3]), stoi(tokens[4])))); |
200 | - reversed_ = (tokens[1] == "True"); | 200 | + if (tokens[5] != "-") comp.push_back(Component(make_pair<int, int>(stoi(tokens[5]), stoi(tokens[6])))); |
201 | - is_model_ = true; | 201 | + reversed_ = (tokens[1] == "True"); |
202 | - PDBID = ""; | 202 | + is_model_ = true; |
203 | - source_ = RNAMOTIFATLAS; | 203 | + PDBID = ""; |
204 | + source_ = RNAMOTIFATLAS; | ||
205 | + } else { // this has been created by BayesPairing | ||
206 | + score_ = stoi(tokens[1]); | ||
207 | + // identify source: | ||
208 | + if (tokens[0].find(string("rna3dmotif")) == std::string::npos) { | ||
209 | + is_model_ = true; | ||
210 | + PDBID = ""; | ||
211 | + source_ = RNAMOTIFATLAS; | ||
212 | + atlas_id = tokens[0]; | ||
213 | + } else { | ||
214 | + is_model_ = false; | ||
215 | + PDBID = tokens[0]; | ||
216 | + source_ = RNA3DMOTIF; | ||
217 | + atlas_id = ""; | ||
218 | + } | ||
219 | + uint i = 2; | ||
220 | + while (i < tokens.size()) { | ||
221 | + comp.push_back(Component(make_pair<int, int>(stoi(tokens[i]), stoi(tokens[i + 1])))); | ||
222 | + i += 2; | ||
223 | + } | ||
224 | + } | ||
204 | } | 225 | } |
205 | 226 | ||
206 | string Motif::pos_string(void) const | 227 | string Motif::pos_string(void) const |
... | @@ -378,7 +399,7 @@ vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbo | ... | @@ -378,7 +399,7 @@ vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbo |
378 | return posInsertionSites; | 399 | return posInsertionSites; |
379 | } | 400 | } |
380 | 401 | ||
381 | -vector<Motif> load_jar3d_output(const string& path) | 402 | +vector<Motif> load_csv(const string& path) |
382 | { | 403 | { |
383 | vector<Motif> posInsertionSites; | 404 | vector<Motif> posInsertionSites; |
384 | std::ifstream motifs; | 405 | std::ifstream motifs; | ... | ... |
... | @@ -41,7 +41,7 @@ class Motif | ... | @@ -41,7 +41,7 @@ class Motif |
41 | public: | 41 | public: |
42 | Motif(); | 42 | Motif(); |
43 | Motif(const vector<Component>& v, string PDB); | 43 | Motif(const vector<Component>& v, string PDB); |
44 | - void load_from_csv(string csv_line); | 44 | + void load_from_csv(string csv_line); |
45 | // static void build_from_desc(path descfile, string rna, vector<Motif>& final_results); | 45 | // static void build_from_desc(path descfile, string rna, vector<Motif>& final_results); |
46 | static void build_from_desc(args_of_parallel_func args); | 46 | static void build_from_desc(args_of_parallel_func args); |
47 | static char is_valid_DESC(const string& descfile); | 47 | static char is_valid_DESC(const string& descfile); |
... | @@ -63,7 +63,7 @@ class Motif | ... | @@ -63,7 +63,7 @@ class Motif |
63 | 63 | ||
64 | bool is_desc_insertible(const string& descfile, const string& rna, bool verbose); | 64 | bool is_desc_insertible(const string& descfile, const string& rna, bool verbose); |
65 | vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbose); | 65 | vector<Motif> load_desc_folder(const string& path, const string& rna, bool verbose); |
66 | -vector<Motif> load_jar3d_output(const string& path); | 66 | +vector<Motif> load_csv(const string& path); |
67 | 67 | ||
68 | // utilities to compare secondary structures: | 68 | // utilities to compare secondary structures: |
69 | bool operator==(const Motif& m1, const Motif& m2); | 69 | bool operator==(const Motif& m1, const Motif& m2); | ... | ... |
... | @@ -72,12 +72,14 @@ int main(int argc, char* argv[]) | ... | @@ -72,12 +72,14 @@ int main(int argc, char* argv[]) |
72 | "descfolder,d", | 72 | "descfolder,d", |
73 | po::value<string>(&motifs_path_name), | 73 | po::value<string>(&motifs_path_name), |
74 | "A folder containing modules in .desc format, as produced by Djelloul & Denise's catalog program")( | 74 | "A folder containing modules in .desc format, as produced by Djelloul & Denise's catalog program")( |
75 | - "jar3dcsv,f", | 75 | + "jar3dcsv", |
76 | po::value<string>(&motifs_path_name), | 76 | po::value<string>(&motifs_path_name), |
77 | - "A file containing the output of JAR3D's search for motifs in the sequence, as produced by searchForMotifSites.py")( | 77 | + "A file containing the output of JAR3D's search for motifs in the sequence, as produced by test_on_RNAstrand.py")( |
78 | - "first-objective,c", | 78 | + "bayespaircsv", |
79 | - po::value<unsigned int>(&MOIP::obj_to_solve_)->default_value(1), | 79 | + po::value<string>(&motifs_path_name), |
80 | - "Objective to solve in the mono-objective portions of the algorithm")("output,o", po::value<string>(&outputName), "A file to summarize the computation results")( | 80 | + "A file containing the output of BayesPairing's search for motifs in the sequence, as produced by " |
81 | + "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")( | ||
82 | + "output,o", po::value<string>(&outputName), "A file to summarize the computation results")( | ||
81 | "theta,t", | 83 | "theta,t", |
82 | po::value<float>(&theta_p_threshold)->default_value(0.001), | 84 | po::value<float>(&theta_p_threshold)->default_value(0.001), |
83 | "Pairing probability threshold to consider or not the possibility of pairing")( | 85 | "Pairing probability threshold to consider or not the possibility of pairing")( |
... | @@ -108,14 +110,16 @@ int main(int argc, char* argv[]) | ... | @@ -108,14 +110,16 @@ int main(int argc, char* argv[]) |
108 | return EXIT_SUCCESS; | 110 | return EXIT_SUCCESS; |
109 | } | 111 | } |
110 | if (vm.count("verbose")) verbose = true; | 112 | if (vm.count("verbose")) verbose = true; |
111 | - if (!vm.count("jar3dcsv") and !vm.count("descfolder")) { | 113 | + if (!vm.count("jar3dcsv") and !vm.count("bayespaircsv") and !vm.count("descfolder")) { |
112 | - cerr << "\033[31mYou must provide at least --jar3dcsv or --descfolder.\033[0m See --help for more " | 114 | + cerr << "\033[31mYou must provide at least --jar3dcsv, --bayespaircsv or --descfolder.\033[0m See --help " |
115 | + "for more " | ||
113 | "information." | 116 | "information." |
114 | << endl; | 117 | << endl; |
115 | return EXIT_FAILURE; | 118 | return EXIT_FAILURE; |
116 | } | 119 | } |
117 | - if (vm.count("-d") and (obj_function_nbr == 1 or obj_function_nbr == 3)) { | 120 | + if (vm.count("-d") and (obj_function_nbr == 2 or obj_function_nbr == 3)) { |
118 | - cerr << "\033[31mYou must provide at -f to use --type 1 or --type 3.\033[0m See --help for more " | 121 | + cerr << "\033[31mYou must provide --jar3dcsv or --bayespaircsv to use --type 2 or --type 3.\033[0m See " |
122 | + "--help for more " | ||
119 | "information." | 123 | "information." |
120 | << endl; | 124 | << endl; |
121 | return EXIT_FAILURE; | 125 | return EXIT_FAILURE; |
... | @@ -150,7 +154,9 @@ int main(int argc, char* argv[]) | ... | @@ -150,7 +154,9 @@ int main(int argc, char* argv[]) |
150 | return EXIT_FAILURE; | 154 | return EXIT_FAILURE; |
151 | } | 155 | } |
152 | if (vm.count("jar3dcsv")) | 156 | if (vm.count("jar3dcsv")) |
153 | - posInsertionSites = load_jar3d_output(motifs_path_name.c_str()); | 157 | + posInsertionSites = load_csv(motifs_path_name.c_str()); |
158 | + else if (vm.count("bayespaircsv")) | ||
159 | + posInsertionSites = load_csv(motifs_path_name.c_str()); | ||
154 | else | 160 | else |
155 | posInsertionSites = load_desc_folder(motifs_path_name.c_str(), fa->seq(), verbose); | 161 | posInsertionSites = load_desc_folder(motifs_path_name.c_str(), fa->seq(), verbose); |
156 | 162 | ... | ... |
-
Please register or login to post a comment