Showing
1 changed file
with
26 additions
and
4 deletions
... | @@ -1298,7 +1298,7 @@ def dist_atoms(f): | ... | @@ -1298,7 +1298,7 @@ def dist_atoms(f): |
1298 | 1298 | ||
1299 | chain = next(s[0].get_chains())#1 chain per file | 1299 | chain = next(s[0].get_chains())#1 chain per file |
1300 | residues=list(chain.get_residues()) | 1300 | residues=list(chain.get_residues()) |
1301 | - pbar = tqdm(total=len(residues), position=thr_idx+1, desc=f"Worker {thr_idx+1}: {f} dist_atoms", unit="chain", leave=False) | 1301 | + pbar = tqdm(total=len(residues), position=thr_idx+1, desc=f"Worker {thr_idx+1}: {f} dist_atoms", unit="residu", leave=False) |
1302 | pbar.update(0) | 1302 | pbar.update(0) |
1303 | for res in chain : | 1303 | for res in chain : |
1304 | 1304 | ||
... | @@ -1624,9 +1624,17 @@ def dist_atoms_hire_RNA (f) : | ... | @@ -1624,9 +1624,17 @@ def dist_atoms_hire_RNA (f) : |
1624 | name=str.split(f,'.')[0] | 1624 | name=str.split(f,'.')[0] |
1625 | liste_dist=[] | 1625 | liste_dist=[] |
1626 | last_c4p=[] | 1626 | last_c4p=[] |
1627 | + global idxQueue | ||
1628 | + thr_idx = idxQueue.get() | ||
1629 | + | ||
1630 | + setproctitle(f"RNANet statistics.py Worker {thr_idx+1} dist_atoms_hire_RNA({f})") | ||
1631 | + | ||
1627 | parser=MMCIFParser() | 1632 | parser=MMCIFParser() |
1628 | s = parser.get_structure(name, os.path.abspath("/home/data/RNA/3D/rna_only/" + f)) | 1633 | s = parser.get_structure(name, os.path.abspath("/home/data/RNA/3D/rna_only/" + f)) |
1629 | chain = next(s[0].get_chains()) | 1634 | chain = next(s[0].get_chains()) |
1635 | + residues=list(chain.get_residues()) | ||
1636 | + pbar = tqdm(total=len(residues), position=thr_idx+1, desc=f"Worker {thr_idx+1}: {f} dist_atoms_hire_RNA", unit="residu", leave=False) | ||
1637 | + pbar.update(0) | ||
1630 | os.makedirs(runDir+"/results/distances_hRNA/", exist_ok=True) | 1638 | os.makedirs(runDir+"/results/distances_hRNA/", exist_ok=True) |
1631 | for res in chain : | 1639 | for res in chain : |
1632 | p_o5p=None | 1640 | p_o5p=None |
... | @@ -1692,9 +1700,13 @@ def dist_atoms_hire_RNA (f) : | ... | @@ -1692,9 +1700,13 @@ def dist_atoms_hire_RNA (f) : |
1692 | 1700 | ||
1693 | 1701 | ||
1694 | liste_dist.append([res.get_resname(), last_c4p_p, p_o5p, o5p_c5p, c5p_c4p, c4p_c1p, c1p_b1, b1_b2]) | 1702 | liste_dist.append([res.get_resname(), last_c4p_p, p_o5p, o5p_c5p, c5p_c4p, c4p_c1p, c1p_b1, b1_b2]) |
1703 | + pbar.update(1) | ||
1695 | df=pd.DataFrame(liste_dist, columns=["Residu", "C4'-P", "P-O5'", "O5'-C5'", "C5'-C4'", "C4'-C1'", "C1'-B1", "B1-B2"]) | 1704 | df=pd.DataFrame(liste_dist, columns=["Residu", "C4'-P", "P-O5'", "O5'-C5'", "C5'-C4'", "C4'-C1'", "C1'-B1", "B1-B2"]) |
1705 | + pbar.close() | ||
1696 | 1706 | ||
1697 | df.to_csv(runDir + '/results/distances_hRNA/' + 'dist_atoms_hire_RNA '+name+'.csv') | 1707 | df.to_csv(runDir + '/results/distances_hRNA/' + 'dist_atoms_hire_RNA '+name+'.csv') |
1708 | + idxQueue.put(thr_idx) # replace the thread index in the queue | ||
1709 | + setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished") | ||
1698 | 1710 | ||
1699 | def conversion_angles(bdd): | 1711 | def conversion_angles(bdd): |
1700 | ''' | 1712 | ''' |
... | @@ -1771,13 +1783,19 @@ def angles_torsion_hire_RNA(f): | ... | @@ -1771,13 +1783,19 @@ def angles_torsion_hire_RNA(f): |
1771 | last_c4p=[] | 1783 | last_c4p=[] |
1772 | last_c5p=[] | 1784 | last_c5p=[] |
1773 | last_c1p=[] | 1785 | last_c1p=[] |
1786 | + global idxQueue | ||
1787 | + thr_idx = idxQueue.get() | ||
1788 | + | ||
1789 | + setproctitle(f"RNANet statistics.py Worker {thr_idx+1} angles_torsion_hire_RNA({f})") | ||
1774 | 1790 | ||
1775 | os.makedirs(runDir+"/results/torsion_angles_hRNA/", exist_ok=True) | 1791 | os.makedirs(runDir+"/results/torsion_angles_hRNA/", exist_ok=True) |
1776 | 1792 | ||
1777 | parser=MMCIFParser() | 1793 | parser=MMCIFParser() |
1778 | s = parser.get_structure(name, os.path.abspath("/home/data/RNA/3D/rna_only/" + f)) | 1794 | s = parser.get_structure(name, os.path.abspath("/home/data/RNA/3D/rna_only/" + f)) |
1779 | chain = next(s[0].get_chains()) | 1795 | chain = next(s[0].get_chains()) |
1780 | - | 1796 | + residues=list(chain.get_residues()) |
1797 | + pbar = tqdm(total=len(residues), position=thr_idx+1, desc=f"Worker {thr_idx+1}: {f} angles_torsion_hire_RNA", unit="residu", leave=False) | ||
1798 | + pbar.update(0) | ||
1781 | 1799 | ||
1782 | for res in chain : | 1800 | for res in chain : |
1783 | p_o5_c5_c4=np.nan | 1801 | p_o5_c5_c4=np.nan |
... | @@ -1873,9 +1891,13 @@ def angles_torsion_hire_RNA(f): | ... | @@ -1873,9 +1891,13 @@ def angles_torsion_hire_RNA(f): |
1873 | last_c5p=atom_c5p | 1891 | last_c5p=atom_c5p |
1874 | last_c1p=atom_c1p | 1892 | last_c1p=atom_c1p |
1875 | liste_angles_torsion.append([res.get_resname(), p_o5_c5_c4, o5_c5_c4_c1, c5_c4_c1_b1, c4_c1_b1_b2, o5_c5_c4_psuiv, c5_c4_psuiv_o5suiv, c4_psuiv_o5suiv_c5suiv, c1_c4_psuiv_o5suiv]) | 1893 | liste_angles_torsion.append([res.get_resname(), p_o5_c5_c4, o5_c5_c4_c1, c5_c4_c1_b1, c4_c1_b1_b2, o5_c5_c4_psuiv, c5_c4_psuiv_o5suiv, c4_psuiv_o5suiv_c5suiv, c1_c4_psuiv_o5suiv]) |
1894 | + pbar.update(1) | ||
1876 | 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'°"]) | 1895 | 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'°"]) |
1877 | - | 1896 | + pbar.close() |
1897 | + | ||
1878 | df.to_csv(runDir + '/results/torsion_angles_hRNA/' + 'angles_torsion_hire_RNA '+name+'.csv') | 1898 | df.to_csv(runDir + '/results/torsion_angles_hRNA/' + 'angles_torsion_hire_RNA '+name+'.csv') |
1899 | + idxQueue.put(thr_idx) # replace the thread index in the queue | ||
1900 | + setproctitle(f"RNANet statistics.py Worker {thr_idx+1} finished") | ||
1879 | 1901 | ||
1880 | 1902 | ||
1881 | if __name__ == "__main__": | 1903 | if __name__ == "__main__": |
... | @@ -2014,7 +2036,7 @@ if __name__ == "__main__": | ... | @@ -2014,7 +2036,7 @@ if __name__ == "__main__": |
2014 | #conversion_eta_theta('/home/atabot/RNANet.db') | 2036 | #conversion_eta_theta('/home/atabot/RNANet.db') |
2015 | #exit() | 2037 | #exit() |
2016 | f_prec=os.listdir(path_to_3D_data + "rna_only")[0] | 2038 | f_prec=os.listdir(path_to_3D_data + "rna_only")[0] |
2017 | - for f in os.listdir(path_to_3D_data + "rna_only")[:100]: | 2039 | + for f in os.listdir(path_to_3D_data + "rna_only")[:100]: |
2018 | joblist.append(Job(function=dist_atoms, args=(f,))) | 2040 | joblist.append(Job(function=dist_atoms, args=(f,))) |
2019 | joblist.append(Job(function=dist_atoms_hire_RNA, args=(f,))) | 2041 | joblist.append(Job(function=dist_atoms_hire_RNA, args=(f,))) |
2020 | joblist.append(Job(function=angles_torsion_hire_RNA, args=(f,))) | 2042 | joblist.append(Job(function=angles_torsion_hire_RNA, args=(f,))) | ... | ... |
-
Please register or login to post a comment