Code Duplication    Length = 27-27 lines in 2 locations

rna_tools/rna_tools_lib.py 2 locations

@@ 1600-1626 (lines=27) @@
1597
                #
1598
                # fix missing U (the whole base at the moment)
1599
                #
1600
                if str(r.get_resname()).strip() == "U" and fix_missing_atoms:
1601
                    for a in r:
1602
                        if a.id == "N1":
1603
                            break
1604
                    else:
1605
                        U_struc = PDB.PDBParser().get_structure('', path + '/data/U.pdb')
1606
                        U = [U_atom for U_atom in U_struc[0].get_residues()][0]
1607
1608
                        r_atoms = [r["O4'"], r["C2'"], r["C1'"]]
1609
                        U_atoms = [U["O4'"], U["C2'"], U["C1'"]]
1610
1611
                        sup = PDB.Superimposer()
1612
                        sup.set_atoms(r_atoms, U_atoms)
1613
                        rms = round(sup.rms, 3)
1614
1615
                        sup.apply(U_struc.get_atoms())  # to all atoms of U
1616
1617
                        r.add(U["N1"])
1618
                        r.add(U["C2"])
1619
                        r.add(U["O2"])
1620
                        r.add(U["N3"])
1621
                        r.add(U["C4"])
1622
                        r.add(U["O4"])
1623
                        r.add(U["C5"])
1624
                        r.add(U["C6"])
1625
1626
                        fixed.append(['add the whole base U', chain.id, r, r.id[1]])
1627
                #
1628
                # fix missing G (the whole base at the moment)
1629
                #
@@ 1569-1595 (lines=27) @@
1566
                #
1567
                # fix missing C (the whole base at the moment)
1568
                #
1569
                if str(r.get_resname()).strip() == "C" and fix_missing_atoms:
1570
                    for a in r:
1571
                        if a.id == "N1":
1572
                            break
1573
                    else:
1574
                        C_struc = PDB.PDBParser().get_structure('', path + '/data/C.pdb')
1575
                        C = [C_atom for C_atom in C_struc[0].get_residues()][0]
1576
1577
                        r_atoms = [r["O4'"], r["C2'"], r["C1'"]]
1578
                        C_atoms = [C["O4'"], C["C2'"], C["C1'"]]
1579
1580
                        sup = PDB.Superimposer()
1581
                        sup.set_atoms(r_atoms, C_atoms)
1582
                        rms = round(sup.rms, 3)
1583
1584
                        sup.apply(C_struc.get_atoms())  # to all atoms of C
1585
1586
                        r.add(C["N1"])
1587
                        r.add(C["C2"])
1588
                        r.add(C["O2"])
1589
                        r.add(C["N3"])
1590
                        r.add(C["C4"])
1591
                        r.add(C["N4"])
1592
                        r.add(C["C5"])
1593
                        r.add(C["C6"])
1594
1595
                        fixed.append(['add the whole base C', chain.id, r, r.id[1]])
1596
1597
                #
1598
                # fix missing U (the whole base at the moment)