Showing
2 changed files
with
14 additions
and
11 deletions
... | @@ -235,7 +235,7 @@ class BiorseoInstance: | ... | @@ -235,7 +235,7 @@ class BiorseoInstance: |
235 | print("--rna3dmotifs A. B. A. B. C. D.") | 235 | print("--rna3dmotifs A. B. A. B. C. D.") |
236 | print("--3dmotifatlas A. B. C. D. A. B. C. D.") | 236 | print("--3dmotifatlas A. B. C. D. A. B. C. D.") |
237 | print("--carnaval A. B.") | 237 | print("--carnaval A. B.") |
238 | - print("--contacts A. B. E. D.\n") | 238 | + print("--contacts A. B. E. F.\n") |
239 | sys.exit() | 239 | sys.exit() |
240 | elif opt == "-i" or opt == "--seq": | 240 | elif opt == "-i" or opt == "--seq": |
241 | self.inputfile = arg | 241 | self.inputfile = arg | ... | ... |
... | @@ -166,7 +166,7 @@ MOIP::MOIP(const RNA& rna, string source, string source_path, float theta, bool | ... | @@ -166,7 +166,7 @@ MOIP::MOIP(const RNA& rna, string source, string source_path, float theta, bool |
166 | { | 166 | { |
167 | if (verbose) | 167 | if (verbose) |
168 | { | 168 | { |
169 | - cerr << "\t>Ignoring motif " << it.path().stem(); | 169 | + cerr << "\t> Ignoring motif " << it.path().stem(); |
170 | switch (error) | 170 | switch (error) |
171 | { | 171 | { |
172 | case '-': cerr << ", some nucleotides have a negative number..."; break; | 172 | case '-': cerr << ", some nucleotides have a negative number..."; break; |
... | @@ -1312,13 +1312,13 @@ vector<uint> find_contacts(vector<string>& struc2d, vector<Component>& v) { | ... | @@ -1312,13 +1312,13 @@ vector<uint> find_contacts(vector<string>& struc2d, vector<Component>& v) { |
1312 | void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pair<uint, char>> errors_id) | 1312 | void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pair<uint, char>> errors_id) |
1313 | { | 1313 | { |
1314 | /* | 1314 | /* |
1315 | - Searches where to place some JSONs in the RNA | 1315 | + Searches where to place some JSON motifs in the RNA |
1316 | */ | 1316 | */ |
1317 | path jsonfile = arg_struct.motif_file; | 1317 | path jsonfile = arg_struct.motif_file; |
1318 | mutex& posInsertionSites_access = arg_struct.posInsertionSites_mutex; | 1318 | mutex& posInsertionSites_access = arg_struct.posInsertionSites_mutex; |
1319 | 1319 | ||
1320 | std::ifstream motif; | 1320 | std::ifstream motif; |
1321 | - string filepath = jsonfile.string(); | 1321 | + string filepath = jsonfile.string(); |
1322 | vector<vector<Component>> vresults, r_vresults; | 1322 | vector<vector<Component>> vresults, r_vresults; |
1323 | vector<string> component_sequences; | 1323 | vector<string> component_sequences; |
1324 | vector<string> component_contacts; | 1324 | vector<string> component_contacts; |
... | @@ -1331,7 +1331,6 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1331,7 +1331,6 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1331 | size_t nb_contacts = 0; | 1331 | size_t nb_contacts = 0; |
1332 | double tx_occurrences = 0; | 1332 | double tx_occurrences = 0; |
1333 | 1333 | ||
1334 | - // cout << filepath << endl; | ||
1335 | std::reverse(reversed_rna.begin(), reversed_rna.end()); | 1334 | std::reverse(reversed_rna.begin(), reversed_rna.end()); |
1336 | 1335 | ||
1337 | motif = std::ifstream(filepath); | 1336 | motif = std::ifstream(filepath); |
... | @@ -1346,7 +1345,6 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1346,7 +1345,6 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1346 | contacts_id = it.key(); | 1345 | contacts_id = it.key(); |
1347 | comp = stoi(contacts_id); | 1346 | comp = stoi(contacts_id); |
1348 | 1347 | ||
1349 | - //cout << "id: " << contacts_id << endl; | ||
1350 | // Check for known errors to ignore corresponding motifs | 1348 | // Check for known errors to ignore corresponding motifs |
1351 | if (comp == errors_id[it_errors].first) { | 1349 | if (comp == errors_id[it_errors].first) { |
1352 | while (comp == errors_id[it_errors].first) { | 1350 | while (comp == errors_id[it_errors].first) { |
... | @@ -1366,7 +1364,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1366,7 +1364,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1366 | else if (!field.compare(keys[1])) // This is the occurences field | 1364 | else if (!field.compare(keys[1])) // This is the occurences field |
1367 | { | 1365 | { |
1368 | occ = it2.value(); | 1366 | occ = it2.value(); |
1369 | - tx_occurrences = (double)occ; // / (double)max_occ; | 1367 | + tx_occurrences = (double)occ; // (double)max_occ; |
1370 | 1368 | ||
1371 | } | 1369 | } |
1372 | else if (!field.compare(keys[2])) // This is the pdb field | 1370 | else if (!field.compare(keys[2])) // This is the pdb field |
... | @@ -1379,7 +1377,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1379,7 +1377,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1379 | seq = check_motif_sequence(it2.value()); | 1377 | seq = check_motif_sequence(it2.value()); |
1380 | component_sequences = find_components(seq, "&"); | 1378 | component_sequences = find_components(seq, "&"); |
1381 | } | 1379 | } |
1382 | - else if (!field.compare(keys[4])) // This is the struct2D field | 1380 | + else if (!field.compare(keys[4])) // This is the struct2D field |
1383 | { | 1381 | { |
1384 | struct2d = it2.value(); | 1382 | struct2d = it2.value(); |
1385 | } | 1383 | } |
... | @@ -1388,7 +1386,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1388,7 +1386,7 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1388 | 1386 | ||
1389 | for (vector<Component>& v : vresults) | 1387 | for (vector<Component>& v : vresults) |
1390 | { | 1388 | { |
1391 | - if (verbose_) cout << "\t> Considering motif JSON " << contacts_id << "\t" << seq << ", " << struct2d << ", " << endl; | 1389 | + if (verbose_) cout << "\t> Considering motif JSON " << contacts_id << "\t" << seq << ", " << struct2d << " "; |
1392 | 1390 | ||
1393 | Motif temp_motif = Motif(v, contacts_id, nb_contacts, tx_occurrences); | 1391 | Motif temp_motif = Motif(v, contacts_id, nb_contacts, tx_occurrences); |
1394 | temp_motif.links_ = search_pairing(struct2d, v); | 1392 | temp_motif.links_ = search_pairing(struct2d, v); |
... | @@ -1396,16 +1394,21 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai | ... | @@ -1396,16 +1394,21 @@ void MOIP::allowed_motifs_from_json(args_of_parallel_func arg_struct, vector<pai |
1396 | 1394 | ||
1397 | // Check if the motif can be inserted, checking the basepairs probabilities and theta | 1395 | // Check if the motif can be inserted, checking the basepairs probabilities and theta |
1398 | bool unprobable = false; | 1396 | bool unprobable = false; |
1397 | + if (!temp_motif.links_.size()) { | ||
1398 | + if (verbose_) cout << "discarded, no constraints on the secondary structure, it is a useless motif." << endl; | ||
1399 | + continue; | ||
1400 | + } | ||
1401 | + if (verbose_) cout << "at position "; | ||
1399 | for (const Link& l : temp_motif.links_) | 1402 | for (const Link& l : temp_motif.links_) |
1400 | { | 1403 | { |
1401 | if (verbose_) cout << l.nts.first << ',' << l.nts.second << ' '; | 1404 | if (verbose_) cout << l.nts.first << ',' << l.nts.second << ' '; |
1402 | - if (!allowed_basepair(l.nts.first,l.nts.second)) { | 1405 | + if (!allowed_basepair(l.nts.first, l.nts.second)) { |
1403 | if (verbose_) cout << "(unlikely) "; | 1406 | if (verbose_) cout << "(unlikely) "; |
1404 | unprobable = true; | 1407 | unprobable = true; |
1405 | } | 1408 | } |
1406 | } | 1409 | } |
1407 | if (unprobable) { | 1410 | if (unprobable) { |
1408 | - if (verbose_) cout << "discarded because of unlikely or impossible basepairs" << endl; | 1411 | + if (verbose_) cout << ", discarded because of unlikely or impossible basepairs" << endl; |
1409 | continue; | 1412 | continue; |
1410 | } | 1413 | } |
1411 | if (verbose_) cout << endl; | 1414 | if (verbose_) cout << endl; | ... | ... |
-
Please register or login to post a comment