35
35
"HIS" , "ILE" , "LEU" , "LYS" , "MET" , "PHE" , "PRO" , "SER" , "THR" ,
36
36
"TRP" , "TYR" , "VAL" ]
37
37
38
- def generate_conect_records (residue_type , shift = 0 ):
38
+ def generate_conect_records (residue_type , shift = 0 , no_junction = True ):
39
39
"""
40
40
Generate CONECT records for an RNA residue (U, A, C, or G).
41
41
@@ -70,8 +70,10 @@ def generate_conect_records(residue_type, shift=0):
70
70
(19 , 20 ), # C5 -> C6
71
71
(20 , 13 ), # C6 -> N1
72
72
(7 , 12 ), # O4' -> C1'
73
- (9 , 21 ) # junction
74
73
]
74
+ if not no_junction :
75
+ connections .append ((9 , 21 ))
76
+ print (connections )
75
77
elif residue_type == "A" :
76
78
connections = [
77
79
(1 , 2 ), # P -> OP1
@@ -98,8 +100,9 @@ def generate_conect_records(residue_type, shift=0):
98
100
(22 , 16 ), # C4 -> C5
99
101
(22 , 13 ), # C4 -> N9
100
102
(7 , 12 ), # O4' -> C1'
101
- (9 , 23 ) # junction
102
103
]
104
+ if not no_junction :
105
+ connections .append ((9 , 23 ))
103
106
elif residue_type == "C" :
104
107
connections = [
105
108
(1 , 2 ), # P -> OP1
@@ -123,8 +126,9 @@ def generate_conect_records(residue_type, shift=0):
123
126
(19 , 20 ), # C5 -> C6
124
127
(20 , 13 ), # C6 -> N1
125
128
(7 , 12 ), # O4' -> C1' (additional connection)
126
- (9 , 21 ) # junction
127
129
]
130
+ if not no_junction :
131
+ connections .append ((9 , 21 ))
128
132
elif residue_type == "G" :
129
133
connections = [
130
134
(1 , 2 ), # P -> OP1
@@ -152,8 +156,9 @@ def generate_conect_records(residue_type, shift=0):
152
156
(23 , 16 ), # C4 -> C5
153
157
(23 , 13 ), # C4 -> N9
154
158
(7 , 12 ), # O4' -> C1' (additional connection)
155
- (9 , 24 ) # junction
156
159
]
160
+ if not no_junction :
161
+ connections .append ((9 , 24 ))
157
162
else :
158
163
raise ValueError ("Invalid residue type. Choose 'U', 'A', 'C', or 'G'." )
159
164
@@ -164,8 +169,7 @@ def generate_conect_records(residue_type, shift=0):
164
169
# Shift the serial numbers
165
170
atom1_serial += shift
166
171
atom2_serial += shift
167
- conect_records .append (f"CONECT{ atom1_serial :>4} { atom2_serial :>4} " )
168
-
172
+ conect_records .append (f"CONECT{ atom1_serial :>5} { atom2_serial :>5} " )
169
173
return conect_records
170
174
171
175
@@ -1391,6 +1395,7 @@ def get_rnapuzzle_ready(self, renumber_residues=True, fix_missing_atoms=True,
1391
1395
p_only = False ,
1392
1396
check_geometry = False ,
1393
1397
conect = False ,
1398
+ conect_no_linkage = False ,
1394
1399
verbose = False ): # :, ready_for="RNAPuzzle"):
1395
1400
"""Get rnapuzzle (SimRNA) ready structure.
1396
1401
@@ -1965,7 +1970,7 @@ def get_rnapuzzle_ready(self, renumber_residues=True, fix_missing_atoms=True,
1965
1970
# add CONET
1966
1971
if conect :
1967
1972
ic (atom_index , r2 )
1968
- conects .extend (generate_conect_records (r2 .get_resname ().strip (), atom_index )) # + '\n'
1973
+ conects .extend (generate_conect_records (r2 .get_resname ().strip (), atom_index , conect_no_linkage ))
1969
1974
atom_index += len (r2 )
1970
1975
print (conect )
1971
1976
0 commit comments