Code Duplication    Length = 27-27 lines in 2 locations

rna_tools/rna_tools_lib.py 2 locations

@@ 1798-1824 (lines=27) @@
1795
                #
1796
                # fix missing U (the whole base at the moment)
1797
                #
1798
                if str(r.get_resname()).strip() == "U" and fix_missing_atoms:
1799
                    for a in r:
1800
                        if a.id == "N1":
1801
                            break
1802
                    else:
1803
                        U_struc = PDB.PDBParser().get_structure('', path + '/data/U.pdb')
1804
                        U = [U_atom for U_atom in U_struc[0].get_residues()][0]
1805
1806
                        r_atoms = [r["O4'"], r["C2'"], r["C1'"]]
1807
                        U_atoms = [U["O4'"], U["C2'"], U["C1'"]]
1808
1809
                        sup = PDB.Superimposer()
1810
                        sup.set_atoms(r_atoms, U_atoms)
1811
                        rms = round(sup.rms, 3)
1812
1813
                        sup.apply(U_struc.get_atoms())  # to all atoms of U
1814
1815
                        r.add(U["N1"])
1816
                        r.add(U["C2"])
1817
                        r.add(U["O2"])
1818
                        r.add(U["N3"])
1819
                        r.add(U["C4"])
1820
                        r.add(U["O4"])
1821
                        r.add(U["C5"])
1822
                        r.add(U["C6"])
1823
1824
                        fixed.append(['add the whole base U', chain.id, r, r.id[1]])
1825
                #
1826
                # fix missing G (the whole base at the moment)
1827
                #
@@ 1767-1793 (lines=27) @@
1764
                #
1765
                # fix missing C (the whole base at the moment)
1766
                #
1767
                if str(r.get_resname()).strip() == "C" and fix_missing_atoms:
1768
                    for a in r:
1769
                        if a.id == "N1":
1770
                            break
1771
                    else:
1772
                        C_struc = PDB.PDBParser().get_structure('', path + '/data/C.pdb')
1773
                        C = [C_atom for C_atom in C_struc[0].get_residues()][0]
1774
1775
                        r_atoms = [r["O4'"], r["C2'"], r["C1'"]]
1776
                        C_atoms = [C["O4'"], C["C2'"], C["C1'"]]
1777
1778
                        sup = PDB.Superimposer()
1779
                        sup.set_atoms(r_atoms, C_atoms)
1780
                        rms = round(sup.rms, 3)
1781
1782
                        sup.apply(C_struc.get_atoms())  # to all atoms of C
1783
1784
                        r.add(C["N1"])
1785
                        r.add(C["C2"])
1786
                        r.add(C["O2"])
1787
                        r.add(C["N3"])
1788
                        r.add(C["C4"])
1789
                        r.add(C["N4"])
1790
                        r.add(C["C5"])
1791
                        r.add(C["C6"])
1792
1793
                        fixed.append(['add the whole base C', chain.id, r, r.id[1]])
1794
1795
                #
1796
                # fix missing U (the whole base at the moment)