Aglaé TABOT

Merge changes of Louis on statistics.py


Former-commit-id: 011c6062
...@@ -1268,6 +1268,9 @@ def get_euclidian_distance(L1, L2): ...@@ -1268,6 +1268,9 @@ def get_euclidian_distance(L1, L2):
1268 e += float(L1[i] - L2[i])**2 1268 e += float(L1[i] - L2[i])**2
1269 except TypeError: 1269 except TypeError:
1270 print("Terms: ", L1, L2) 1270 print("Terms: ", L1, L2)
1271 + except IndexError:
1272 + print("Terms: ", L1, L2)
1273 +
1271 return np.sqrt(e) 1274 return np.sqrt(e)
1272 1275
1273 def get_flat_angle(L1, L2, L3): 1276 def get_flat_angle(L1, L2, L3):
...@@ -1282,7 +1285,7 @@ def get_torsion_angle(L1, L2, L3, L4): ...@@ -1282,7 +1285,7 @@ def get_torsion_angle(L1, L2, L3, L4):
1282 1285
1283 return calc_dihedral(Vector(L1[0]), Vector(L2[0]), Vector(L3[0]), Vector(L4[0]))*(180/np.pi) 1286 return calc_dihedral(Vector(L1[0]), Vector(L2[0]), Vector(L3[0]), Vector(L4[0]))*(180/np.pi)
1284 1287
1285 -def pos_b1(res) : 1288 +def pos_b1(res):
1286 """ 1289 """
1287 Returns the coordinates of virtual atom B1 (center of the first aromatic cycle) 1290 Returns the coordinates of virtual atom B1 (center of the first aromatic cycle)
1288 """ 1291 """
...@@ -1334,7 +1337,11 @@ def pos_b1(res) : ...@@ -1334,7 +1337,11 @@ def pos_b1(res) :
1334 coordb1.append(moy_x_b1) 1337 coordb1.append(moy_x_b1)
1335 coordb1.append(moy_y_b1) 1338 coordb1.append(moy_y_b1)
1336 coordb1.append(moy_z_b1) 1339 coordb1.append(moy_z_b1)
1337 - return(coordb1) 1340 +
1341 + if len(coordb1):
1342 + return [coordb1]
1343 + else:
1344 + return []
1338 1345
1339 def pos_b2(res): 1346 def pos_b2(res):
1340 """ 1347 """
...@@ -1365,7 +1372,10 @@ def pos_b2(res): ...@@ -1365,7 +1372,10 @@ def pos_b2(res):
1365 coordb2.append(moy_x_b2) 1372 coordb2.append(moy_x_b2)
1366 coordb2.append(moy_y_b2) 1373 coordb2.append(moy_y_b2)
1367 coordb2.append(moy_z_b2) 1374 coordb2.append(moy_z_b2)
1368 - return coordb2 1375 + if len(coordb2):
1376 + return [coordb2]
1377 + else:
1378 + return []
1369 1379
1370 def basepair_apex_distance(res, pair): 1380 def basepair_apex_distance(res, pair):
1371 """ 1381 """
...@@ -1393,31 +1403,48 @@ def basepair_apex_distance(res, pair): ...@@ -1393,31 +1403,48 @@ def basepair_apex_distance(res, pair):
1393 1403
1394 def basepair_flat_angle(res, pair): 1404 def basepair_flat_angle(res, pair):
1395 """ 1405 """
1396 - measurement of the plane angles formed by the vectors C1-> B1 of the paired nucleotides 1406 + measurement of the plane angles formed by the vectors C1->B1 of the paired nucleotides
1397 """ 1407 """
1398 if res.get_resname()=='A' or res.get_resname()=='G' or res.get_resname()=='C' or res.get_resname()=='U' : 1408 if res.get_resname()=='A' or res.get_resname()=='G' or res.get_resname()=='C' or res.get_resname()=='U' :
1399 atom_c4_res = [ atom.get_coord() for atom in res if "C4'" in atom.get_fullname() ] 1409 atom_c4_res = [ atom.get_coord() for atom in res if "C4'" in atom.get_fullname() ]
1400 atom_c1p_res = [ atom.get_coord() for atom in res if "C1'" in atom.get_fullname() ] 1410 atom_c1p_res = [ atom.get_coord() for atom in res if "C1'" in atom.get_fullname() ]
1401 - atom_b1_res=pos_b1(res) 1411 + atom_b1_res = pos_b1(res)
1402 - c4_res=Vector(atom_c4_res[0]) 1412 + a1_res = Vector(atom_c4_res[0])
1403 - c1_res=Vector(atom_c1p_res[0]) 1413 + a2_res = Vector(atom_c1p_res[0])
1404 - b1_res=Vector(atom_b1_res) 1414 + a3_res = Vector(atom_b1_res[0])
1405 - if pair.get_resname()=='A' or pair.get_resname()=='G' or pair.get_resname()=='C' or pair.get_resname()=='U' : 1415 + if res.get_resname()=='C' or res.get_resname()=='U' :
1406 - atom_c4_pair = [ atom.get_coord() for atom in pair if "C4'" in atom.get_fullname() ] 1416 + atom_c1p_res = [ atom.get_coord() for atom in res if "C1'" in atom.get_fullname() ]
1407 - atom_c1p_pair = [ atom.get_coord() for atom in pair if "C1'" in atom.get_fullname() ] 1417 + atom_b1_res = pos_b1(res)
1408 - atom_b1_pair=pos_b1(pair) 1418 + atom_b2_res = pos_b2(res)
1409 - c4_pair=Vector(atom_c4_pair[0]) 1419 + a1_res = Vector(atom_c1p_res[0])
1410 - c1_pair=Vector(atom_c1p_pair[0]) 1420 + a2_res = Vector(atom_b1_res[0])
1411 - b1_pair=Vector(atom_b1_pair) 1421 + a3_res = Vector(atom_b2_res[0])
1412 - #we calculate the 4 plane angles including these vectors 1422 +
1413 - 1423 + if pair.get_resname()=='A' or pair.get_resname()=='G' or pair.get_resname()=='C' or pair.get_resname()=='U' :
1414 - a=calc_angle(c4_res, c1_res, b1_res)*(180/np.pi) 1424 + atom_c4_pair = [ atom.get_coord() for atom in pair if "C4'" in atom.get_fullname() ]
1415 - b=calc_angle(c1_res, b1_res, b1_pair)*(180/np.pi) 1425 + atom_c1p_pair = [ atom.get_coord() for atom in pair if "C1'" in atom.get_fullname() ]
1416 - c=calc_angle(b1_res, b1_pair, c1_pair)*(180/np.pi) 1426 + atom_b1_pair = pos_b1(pair)
1417 - d=calc_angle(b1_pair, c1_pair, c4_pair)*(180/np.pi) 1427 + a1_pair = Vector(atom_c4_pair[0])
1418 - angles=[a, b, c, d] 1428 + a2_pair = Vector(atom_c1p_pair[0])
1429 + a3_pair = Vector(atom_b1_pair)
1430 + if pair.get_resname()=='C' or pair.get_resname()=='U' :
1431 + atom_c1p_pair = [ atom.get_coord() for atom in pair if "C1'" in atom.get_fullname() ]
1432 + atom_b1_pair = pos_b1(pair)
1433 + atom_b2_pair = pos_b2(pair)
1434 + a1_pair = Vector(atom_c1p_pair[0])
1435 + a2_pair = Vector(atom_b1_pair[0])
1436 + a3_pair = Vector(atom_b2_pair[0])
1437 +
1438 + # we calculate the 4 plane angles including these vectors
1439 +
1440 + a = calc_angle(a1_res, a2_res, a3_res)*(180/np.pi)
1441 + b = calc_angle(a2_res, a3_res, a3_pair)*(180/np.pi)
1442 + c = calc_angle(a3_res, a3_pair, a2_pair)*(180/np.pi)
1443 + d = calc_angle(a3_pair, a2_pair, a1_pair)*(180/np.pi)
1444 + angles = [a, b, c, d]
1419 return angles 1445 return angles
1420 1446
1447 +@trace_unhandled_exceptions
1421 def measure_from_structure(f): 1448 def measure_from_structure(f):
1422 """ 1449 """
1423 Do geometric measures required on a given filename 1450 Do geometric measures required on a given filename
...@@ -1446,6 +1473,7 @@ def measure_from_structure(f): ...@@ -1446,6 +1473,7 @@ def measure_from_structure(f):
1446 idxQueue.put(thr_idx) # replace the thread index in the queue 1473 idxQueue.put(thr_idx) # replace the thread index in the queue
1447 setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished") 1474 setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished")
1448 1475
1476 +@trace_unhandled_exceptions
1449 def measures_wadley(name, s, thr_idx): 1477 def measures_wadley(name, s, thr_idx):
1450 """ 1478 """
1451 Measures the distances and plane angles involving C1' and P atoms 1479 Measures the distances and plane angles involving C1' and P atoms
...@@ -1453,7 +1481,7 @@ def measures_wadley(name, s, thr_idx): ...@@ -1453,7 +1481,7 @@ def measures_wadley(name, s, thr_idx):
1453 """ 1481 """
1454 1482
1455 # do not recompute something already computed 1483 # do not recompute something already computed
1456 - if (path.isfile(runDir + '/results/geometry/Pyle/angles/angles_plans_wadley '+name+'.csv') and 1484 + if (path.isfile(runDir + '/results/geometry/Pyle/angles/angles_plans_wadley ' + name + '.csv') and
1457 path.isfile(runDir + "/results/geometry/Pyle/distances/distances_wadley " + name + ".csv")): 1485 path.isfile(runDir + "/results/geometry/Pyle/distances/distances_wadley " + name + ".csv")):
1458 return 1486 return
1459 1487
...@@ -1472,6 +1500,7 @@ def measures_wadley(name, s, thr_idx): ...@@ -1472,6 +1500,7 @@ def measures_wadley(name, s, thr_idx):
1472 if res.get_resname() not in ['ATP', 'CCC', 'A3P', 'A23', 'GDP', 'RIA', "2BA"] : 1500 if res.get_resname() not in ['ATP', 'CCC', 'A3P', 'A23', 'GDP', 'RIA', "2BA"] :
1473 atom_p = [ atom.get_coord() for atom in res if atom.get_name() == "P"] 1501 atom_p = [ atom.get_coord() for atom in res if atom.get_name() == "P"]
1474 atom_c1p = [ atom.get_coord() for atom in res if "C1'" in atom.get_fullname() ] 1502 atom_c1p = [ atom.get_coord() for atom in res if "C1'" in atom.get_fullname() ]
1503 + atom_c4p = [ atom.get_coord() for atom in res if "C4'" in atom.get_fullname() ]
1475 if len(atom_c1p) > 1: 1504 if len(atom_c1p) > 1:
1476 for atom in res: 1505 for atom in res:
1477 if "C1'" in atom.get_fullname(): 1506 if "C1'" in atom.get_fullname():
...@@ -1496,6 +1525,7 @@ def measures_wadley(name, s, thr_idx): ...@@ -1496,6 +1525,7 @@ def measures_wadley(name, s, thr_idx):
1496 df = pd.DataFrame(liste_angl, columns=["Residu", "P-C1'-P°", "C1'-P°-C1'°"]) 1525 df = pd.DataFrame(liste_angl, columns=["Residu", "P-C1'-P°", "C1'-P°-C1'°"])
1497 df.to_csv(runDir + "/results/geometry/Pyle/angles/angles_plans_wadley "+name+".csv") 1526 df.to_csv(runDir + "/results/geometry/Pyle/angles/angles_plans_wadley "+name+".csv")
1498 1527
1528 +@trace_unhandled_exceptions
1499 def measures_aa(name, s, thr_idx): 1529 def measures_aa(name, s, thr_idx):
1500 """ 1530 """
1501 Measures the distance between atoms linked by covalent bonds 1531 Measures the distance between atoms linked by covalent bonds
...@@ -1657,6 +1687,7 @@ def measures_aa(name, s, thr_idx): ...@@ -1657,6 +1687,7 @@ def measures_aa(name, s, thr_idx):
1657 1687
1658 df.to_csv(runDir+"/results/geometry/all-atoms/distances/dist_atoms "+name+".csv") 1688 df.to_csv(runDir+"/results/geometry/all-atoms/distances/dist_atoms "+name+".csv")
1659 1689
1690 +@trace_unhandled_exceptions
1660 def measures_hrna(name, s, thr_idx): 1691 def measures_hrna(name, s, thr_idx):
1661 """ 1692 """
1662 Measures the distance/angles between the atoms of the HiRE-RNA model linked by covalent bonds 1693 Measures the distance/angles between the atoms of the HiRE-RNA model linked by covalent bonds
...@@ -1680,7 +1711,7 @@ def measures_hrna(name, s, thr_idx): ...@@ -1680,7 +1711,7 @@ def measures_hrna(name, s, thr_idx):
1680 1711
1681 chain = next(s[0].get_chains()) 1712 chain = next(s[0].get_chains())
1682 residues=list(chain.get_residues()) 1713 residues=list(chain.get_residues())
1683 - for res in tqdm(chain0, position=thr_idx+1, desc=f"Worker {thr_idx+1}: {name} measures_hrna", unit="res", leave=False): 1714 + for res in tqdm(chain, position=thr_idx+1, desc=f"Worker {thr_idx+1}: {name} measures_hrna", unit="res", leave=False):
1684 # distances 1715 # distances
1685 p_o5p = None 1716 p_o5p = None
1686 o5p_c5p = None 1717 o5p_c5p = None
...@@ -1720,12 +1751,12 @@ def measures_hrna(name, s, thr_idx): ...@@ -1720,12 +1751,12 @@ def measures_hrna(name, s, thr_idx):
1720 atom_b2 = pos_b2(res) # position b2 to be calculated only for those with 2 cycles 1751 atom_b2 = pos_b2(res) # position b2 to be calculated only for those with 2 cycles
1721 1752
1722 # Distances. If one of the atoms is empty, the euclidian distance returns NaN. 1753 # Distances. If one of the atoms is empty, the euclidian distance returns NaN.
1723 - last_c4p_p = get_euclidian_distance(last_c4p[0], atom_p[0]) 1754 + last_c4p_p = get_euclidian_distance(last_c4p, atom_p)
1724 - p_o5p = get_euclidian_distance(atom_p[0], atom_o5p[0]) 1755 + p_o5p = get_euclidian_distance(atom_p, atom_o5p)
1725 - o5p_c5p = get_euclidian_distance(atom_o5p[0], atom_c5p[0]) 1756 + o5p_c5p = get_euclidian_distance(atom_o5p, atom_c5p)
1726 - c5p_c4p = get_euclidian_distance(atom_c5p[0], atom_c4p[0]) 1757 + c5p_c4p = get_euclidian_distance(atom_c5p, atom_c4p)
1727 - c4p_c1p = get_euclidian_distance(atom_c4p[0], atom_c1p[0]) 1758 + c4p_c1p = get_euclidian_distance(atom_c4p, atom_c1p)
1728 - c1p_b1 = get_euclidian_distance(atom_c1p[0], atom_b1) 1759 + c1p_b1 = get_euclidian_distance(atom_c1p, atom_b1)
1729 b1_b2 = get_euclidian_distance(atom_b1, atom_b2) 1760 b1_b2 = get_euclidian_distance(atom_b1, atom_b2)
1730 1761
1731 # flat angles. Same. 1762 # flat angles. Same.
...@@ -1758,10 +1789,11 @@ def measures_hrna(name, s, thr_idx): ...@@ -1758,10 +1789,11 @@ def measures_hrna(name, s, thr_idx):
1758 df = pd.DataFrame(liste_dist, columns=["Residu", "C4'-P", "P-O5'", "O5'-C5'", "C5'-C4'", "C4'-C1'", "C1'-B1", "B1-B2"]) 1789 df = pd.DataFrame(liste_dist, columns=["Residu", "C4'-P", "P-O5'", "O5'-C5'", "C5'-C4'", "C4'-C1'", "C1'-B1", "B1-B2"])
1759 df.to_csv(runDir + '/results/geometry/HiRE-RNA/distances/dist_atoms_hire_RNA '+name+'.csv') 1790 df.to_csv(runDir + '/results/geometry/HiRE-RNA/distances/dist_atoms_hire_RNA '+name+'.csv')
1760 df = pd.DataFrame(liste_angl, columns=["Residu", "C4'-P-O5'", "C1'-C4'-P", "C5'-C4'-P", "P-O5'-C5'", "O5'-C5'-C4'", "C5'-C4'-C1'", "C4'-C1'-B1", "C1'-B1-B2"]) 1791 df = pd.DataFrame(liste_angl, columns=["Residu", "C4'-P-O5'", "C1'-C4'-P", "C5'-C4'-P", "P-O5'-C5'", "O5'-C5'-C4'", "C5'-C4'-C1'", "C4'-C1'-B1", "C1'-B1-B2"])
1761 - df.to_csv(runDur + '/results/geometry/HiRE-RNA/angles/angles_hire_RNA ' + name + ".csv") 1792 + df.to_csv(runDir + '/results/geometry/HiRE-RNA/angles/angles_hire_RNA ' + name + ".csv")
1762 - df=pd.DataFrame(liste_angles_torsion, columns=["Residu", "P-O5'-C5'-C4'", "O5'-C5'-C4'-C1'", "C5'-C4'-C1'-B1", "C4'-C1'-B1-B2", "O5'-C5'-C4'-P°", "C5'-C4'-P°-O5'°", "C4'-P°-O5'°-C5'°", "C1'-C4'-P°-O5'°"]) 1793 + df=pd.DataFrame(liste_tors, columns=["Residu", "P-O5'-C5'-C4'", "O5'-C5'-C4'-C1'", "C5'-C4'-C1'-B1", "C4'-C1'-B1-B2", "O5'-C5'-C4'-P°", "C5'-C4'-P°-O5'°", "C4'-P°-O5'°-C5'°", "C1'-C4'-P°-O5'°"])
1763 df.to_csv(runDir + '/results/geometry/HiRE-RNA/torsions/angles_torsion_hire_RNA '+name+'.csv') 1794 df.to_csv(runDir + '/results/geometry/HiRE-RNA/torsions/angles_torsion_hire_RNA '+name+'.csv')
1764 1795
1796 +@trace_unhandled_exceptions
1765 def measure_hrna_basepairs(cle): 1797 def measure_hrna_basepairs(cle):
1766 """ 1798 """
1767 Open a complete RNAcifs/ file, and run measure_hrna_basepairs_chain() on every chain 1799 Open a complete RNAcifs/ file, and run measure_hrna_basepairs_chain() on every chain
...@@ -1812,6 +1844,7 @@ def measure_hrna_basepairs(cle): ...@@ -1812,6 +1844,7 @@ def measure_hrna_basepairs(cle):
1812 idxQueue.put(thr_idx) # replace the thread index in the queue 1844 idxQueue.put(thr_idx) # replace the thread index in the queue
1813 setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished") 1845 setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished")
1814 1846
1847 +@trace_unhandled_exceptions
1815 def measure_hrna_basepairs_chain(chain, df, thr_idx): 1848 def measure_hrna_basepairs_chain(chain, df, thr_idx):
1816 """ 1849 """
1817 Cleanup of the dataset 1850 Cleanup of the dataset
...@@ -2438,8 +2471,8 @@ def gmm_hrna(): ...@@ -2438,8 +2471,8 @@ def gmm_hrna():
2438 c1p_b1 = list(df["C1'-B1"][~ np.isnan(df["C1'-B1"])]) 2471 c1p_b1 = list(df["C1'-B1"][~ np.isnan(df["C1'-B1"])])
2439 b1_b2 = list(df["B1-B2"][~ np.isnan(df["B1-B2"])]) 2472 b1_b2 = list(df["B1-B2"][~ np.isnan(df["B1-B2"])])
2440 2473
2441 - os.makedirs(runDir + "/results/figures/HiRE-RNA/distances/", exist_ok=True) 2474 + os.makedirs(runDir + "/results/figures/GMM/HiRE-RNA/distances/", exist_ok=True)
2442 - os.chdir(runDir + "/results/figures/HiRE-RNA/distances/") 2475 + os.chdir(runDir + "/results/figures/GMM/HiRE-RNA/distances/")
2443 2476
2444 GMM_histo(o5p_c5p, "O5'-C5'") 2477 GMM_histo(o5p_c5p, "O5'-C5'")
2445 GMM_histo(b1_b2, "B1-B2") 2478 GMM_histo(b1_b2, "B1-B2")
...@@ -2460,7 +2493,7 @@ def gmm_hrna(): ...@@ -2460,7 +2493,7 @@ def gmm_hrna():
2460 axes.set_ylim(0, 100) 2493 axes.set_ylim(0, 100)
2461 plt.xlabel("Distance (Angström)") 2494 plt.xlabel("Distance (Angström)")
2462 plt.title("GMM des distances entre atomes HiRE-RNA") 2495 plt.title("GMM des distances entre atomes HiRE-RNA")
2463 - plt.savefig(runDir + "/results/figures/HiRE-RNA/distances/GMM des distances entre atomes HiRE-RNA.png") 2496 + plt.savefig(runDir + "/results/figures/GMM/HiRE-RNA/distances/GMM des distances entre atomes HiRE-RNA.png")
2464 plt.close() 2497 plt.close()
2465 2498
2466 # Angles 2499 # Angles
...@@ -2475,17 +2508,17 @@ def gmm_hrna(): ...@@ -2475,17 +2508,17 @@ def gmm_hrna():
2475 c4p_c1p_b1 = list(df["C4'-C1'-B1"][~ np.isnan(df["C4'-C1'-B1"])]) 2508 c4p_c1p_b1 = list(df["C4'-C1'-B1"][~ np.isnan(df["C4'-C1'-B1"])])
2476 c1p_b1_b2 = list(df["C1'-B1-B2"][~ np.isnan(df["C1'-B1-B2"])]) 2509 c1p_b1_b2 = list(df["C1'-B1-B2"][~ np.isnan(df["C1'-B1-B2"])])
2477 2510
2478 - os.makedirs(runDir + "/results/figures/HiRE-RNA/distances/", exist_ok=True) 2511 + os.makedirs(runDir + "/results/figures/GMM/HiRE-RNA/distances/", exist_ok=True)
2479 - os.chdir(runDir + "/results/figures/HiRE-RNA/distances/") 2512 + os.chdir(runDir + "/results/figures/GMM/HiRE-RNA/distances/")
2480 - 2513 +
2481 - GMM_histo_toric(lastc4p_p_o5p, "C4'-P-O5'", toric=True) 2514 + GMM_histo(lastc4p_p_o5p, "C4'-P-O5'", toric=True)
2482 - GMM_histo_toric(lastc1p_lastc4p_p, "C1'-C4'-P", toric=True) 2515 + GMM_histo(lastc1p_lastc4p_p, "C1'-C4'-P", toric=True)
2483 - GMM_histo_toric(lastc5p_lastc4p_p, "C5'-C4'-P", toric=True) 2516 + GMM_histo(lastc5p_lastc4p_p, "C5'-C4'-P", toric=True)
2484 - GMM_histo_toric(p_o5p_c5p, "P-O5'-C5'", toric=True) 2517 + GMM_histo(p_o5p_c5p, "P-O5'-C5'", toric=True)
2485 - GMM_histo_toric(o5p_c5p_c4p, "O5'-C5'-C4'", toric=True) 2518 + GMM_histo(o5p_c5p_c4p, "O5'-C5'-C4'", toric=True)
2486 - GMM_histo_toric(c5p_c4p_c1p, "C5'-C4'-C1'", toric=True) 2519 + GMM_histo(c5p_c4p_c1p, "C5'-C4'-C1'", toric=True)
2487 - GMM_histo_toric(c4p_c1p_b1, "C4'-C1'-B1", toric=True) 2520 + GMM_histo(c4p_c1p_b1, "C4'-C1'-B1", toric=True)
2488 - GMM_histo_toric(c1p_b1_b2, "C1'-B1-B2", toric=True) 2521 + GMM_histo(c1p_b1_b2, "C1'-B1-B2", toric=True)
2489 2522
2490 GMM_histo(lastc4p_p_o5p, "C4'-P-O5'", toric=True, hist=False, couleur='lightcoral') 2523 GMM_histo(lastc4p_p_o5p, "C4'-P-O5'", toric=True, hist=False, couleur='lightcoral')
2491 GMM_histo(lastc1p_lastc4p_p, "C1'-C4'-P", toric=True, hist=False, couleur='limegreen') 2524 GMM_histo(lastc1p_lastc4p_p, "C1'-C4'-P", toric=True, hist=False, couleur='limegreen')
...@@ -2499,7 +2532,7 @@ def gmm_hrna(): ...@@ -2499,7 +2532,7 @@ def gmm_hrna():
2499 axes.set_ylim(0, 100) 2532 axes.set_ylim(0, 100)
2500 plt.xlabel("Angle (Degré)") 2533 plt.xlabel("Angle (Degré)")
2501 plt.title("GMM des angles entre atomes HiRE-RNA") 2534 plt.title("GMM des angles entre atomes HiRE-RNA")
2502 - plt.savefig(runDir + "/results/figures/HiRE-RNA/angles/GMM des angles entre atomes HiRE-RNA.png") 2535 + plt.savefig(runDir + "/results/figures/GMM/HiRE-RNA/angles/GMM des angles entre atomes HiRE-RNA.png")
2503 plt.close() 2536 plt.close()
2504 2537
2505 # Torsions 2538 # Torsions
...@@ -2514,17 +2547,17 @@ def gmm_hrna(): ...@@ -2514,17 +2547,17 @@ def gmm_hrna():
2514 c4_psuiv_o5suiv_c5suiv = list(df["C4'-P°-O5'°-C5'°"][~ np.isnan(df["C4'-P°-O5'°-C5'°"])]) 2547 c4_psuiv_o5suiv_c5suiv = list(df["C4'-P°-O5'°-C5'°"][~ np.isnan(df["C4'-P°-O5'°-C5'°"])])
2515 c1_c4_psuiv_o5suiv = list(df["C1'-C4'-P°-O5'°"][~ np.isnan(df["C1'-C4'-P°-O5'°"])]) 2548 c1_c4_psuiv_o5suiv = list(df["C1'-C4'-P°-O5'°"][~ np.isnan(df["C1'-C4'-P°-O5'°"])])
2516 2549
2517 - os.makedirs(runDir + "/results/figures/HiRE-RNA/torsions/", exist_ok=True) 2550 + os.makedirs(runDir + "/results/figures/GMM/HiRE-RNA/torsions/", exist_ok=True)
2518 - os.chdir(runDir + "/results/figures/HiRE-RNA/torsions/") 2551 + os.chdir(runDir + "/results/figures/GMM/HiRE-RNA/torsions/")
2519 2552
2520 - GMM_histo_toric(p_o5_c5_c4, "P-O5'-C5'-C4'", toric=True) 2553 + GMM_histo(p_o5_c5_c4, "P-O5'-C5'-C4'", toric=True)
2521 - GMM_histo_toric(o5_c5_c4_c1, "O5'-C5'-C4'-C1'", toric=True) 2554 + GMM_histo(o5_c5_c4_c1, "O5'-C5'-C4'-C1'", toric=True)
2522 - GMM_histo_toric(c5_c4_c1_b1, "C5'-C4'-C1'-B1", toric=True) 2555 + GMM_histo(c5_c4_c1_b1, "C5'-C4'-C1'-B1", toric=True)
2523 - GMM_histo_toric(c4_c1_b1_b2, "C4'-C1'-B1-B2", toric=True) 2556 + GMM_histo(c4_c1_b1_b2, "C4'-C1'-B1-B2", toric=True)
2524 - GMM_histo_toric(o5_c5_c4_psuiv, "O5'-C5'-C4'-P°", toric=True) 2557 + GMM_histo(o5_c5_c4_psuiv, "O5'-C5'-C4'-P°", toric=True)
2525 - GMM_histo_toric(c5_c4_psuiv_o5suiv, "C5'-C4'-P°-O5'°", toric=True) 2558 + GMM_histo(c5_c4_psuiv_o5suiv, "C5'-C4'-P°-O5'°", toric=True)
2526 - GMM_histo_toric(c4_psuiv_o5suiv_c5suiv, "C4'-P°-O5'°-C5'°", toric=True) 2559 + GMM_histo(c4_psuiv_o5suiv_c5suiv, "C4'-P°-O5'°-C5'°", toric=True)
2527 - GMM_histo_toric(c1_c4_psuiv_o5suiv, "C1'-C4'-P°-O5'°", toric=True) 2560 + GMM_histo(c1_c4_psuiv_o5suiv, "C1'-C4'-P°-O5'°", toric=True)
2528 2561
2529 GMM_histo(p_o5_c5_c4, "P-O5'-C5'-C4'", toric=True, hist=False, couleur='darkred') 2562 GMM_histo(p_o5_c5_c4, "P-O5'-C5'-C4'", toric=True, hist=False, couleur='darkred')
2530 GMM_histo(o5_c5_c4_c1, "O5'-C5'-C4'-C1'", toric=True, hist=False, couleur='chocolate') 2563 GMM_histo(o5_c5_c4_c1, "O5'-C5'-C4'-C1'", toric=True, hist=False, couleur='chocolate')
...@@ -2772,6 +2805,7 @@ def list_chains_in_dir(ld): ...@@ -2772,6 +2805,7 @@ def list_chains_in_dir(ld):
2772 dictionnaire[pdb_id] = liste_chaines 2805 dictionnaire[pdb_id] = liste_chaines
2773 return dictionnaire 2806 return dictionnaire
2774 2807
2808 +@trace_unhandled_exceptions
2775 def concat_dataframes(fpath, outfilename): 2809 def concat_dataframes(fpath, outfilename):
2776 """ 2810 """
2777 Concatenates the dataframes containing measures 2811 Concatenates the dataframes containing measures
...@@ -2958,7 +2992,6 @@ if __name__ == "__main__": ...@@ -2958,7 +2992,6 @@ if __name__ == "__main__":
2958 # Do geometric measures on all chains 2992 # Do geometric measures on all chains
2959 if n_unmapped_chains: 2993 if n_unmapped_chains:
2960 os.makedirs(runDir+"/results/geometry/all-atoms/distances/", exist_ok=True) 2994 os.makedirs(runDir+"/results/geometry/all-atoms/distances/", exist_ok=True)
2961 - os.makedirs(runDir+"/results/geometry/all-atoms/angles/", exist_ok=True)
2962 f_prec = os.listdir(path_to_3D_data + "rna_only")[0] 2995 f_prec = os.listdir(path_to_3D_data + "rna_only")[0]
2963 for f in os.listdir(path_to_3D_data + "rna_only"): 2996 for f in os.listdir(path_to_3D_data + "rna_only"):
2964 joblist.append(Job(function=measure_from_structure, args=(f,), how_many_in_parallel=nworkers)) # All-atom distances 2997 joblist.append(Job(function=measure_from_structure, args=(f,), how_many_in_parallel=nworkers)) # All-atom distances
...@@ -3020,8 +3053,3 @@ if __name__ == "__main__": ...@@ -3020,8 +3053,3 @@ if __name__ == "__main__":
3020 joblist.append(Job(function=gmm_wadley, args=())) 3053 joblist.append(Job(function=gmm_wadley, args=()))
3021 if len(joblist): 3054 if len(joblist):
3022 process_jobs(joblist) 3055 process_jobs(joblist)
3023 -
3024 -
3025 -
3026 -
3027 -
...\ No newline at end of file ...\ No newline at end of file
......