Louis BECQUEY

Merge branch 'stage_aglae'

...@@ -159,14 +159,14 @@ class SelectivePortionSelector(object): ...@@ -159,14 +159,14 @@ class SelectivePortionSelector(object):
159 _select=Select() 159 _select=Select()
160 160
161 def save_mmcif(ioobj, out_file, select=_select, preserve_atom_numbering=False): 161 def save_mmcif(ioobj, out_file, select=_select, preserve_atom_numbering=False):
162 + # reuse and modification of the source code of Biopython
163 + # to have the 2 columns of numbering of residues numbered with the index_chain of DSSR
162 if isinstance(out_file, str): 164 if isinstance(out_file, str):
163 fp = open(out_file, "w") 165 fp = open(out_file, "w")
164 close_file = True 166 close_file = True
165 else: 167 else:
166 fp = out_file 168 fp = out_file
167 close_file = False 169 close_file = False
168 - #fp = open(out_file, "w")
169 - #close_file=True
170 atom_dict = defaultdict(list) 170 atom_dict = defaultdict(list)
171 171
172 for model in ioobj.structure.get_list(): 172 for model in ioobj.structure.get_list():
...@@ -188,7 +188,7 @@ def save_mmcif(ioobj, out_file, select=_select, preserve_atom_numbering=False): ...@@ -188,7 +188,7 @@ def save_mmcif(ioobj, out_file, select=_select, preserve_atom_numbering=False):
188 chain_id = chain.get_id() 188 chain_id = chain.get_id()
189 if chain_id == " ": 189 if chain_id == " ":
190 chain_id = "." 190 chain_id = "."
191 - # This is used to write label_seq_id and increments from 1, 191 + # This is used to write label_seq_id,
192 # remaining blank for hetero residues 192 # remaining blank for hetero residues
193 193
194 prev_residue_type = "" 194 prev_residue_type = ""
...@@ -403,7 +403,8 @@ class Chain: ...@@ -403,7 +403,8 @@ class Chain:
403 index_chain=nums.at[i, "index_chain"] 403 index_chain=nums.at[i, "index_chain"]
404 nt=nums.at[i, "nt_name"] 404 nt=nums.at[i, "nt_name"]
405 405
406 - if nt == 'A' or nt == 'G' or nt == 'C' or nt == 'U' or nt in ['DG', 'DU', 'DC', 'DA', 'DI', 'DT' ] or nt == 'N' or nt == 'I' : 406 + # particular case 6n5s_1_A, residue 201 in the original cif file (resname = G and HETATM = H_G)
407 + if nt == 'A' or (nt == 'G' and (self.chain_label != '6n5s_1_A' or resseq != 201)) or nt == 'C' or nt == 'U' or nt in ['DG', 'DU', 'DC', 'DA', 'DI', 'DT' ] or nt == 'N' or nt == 'I' :
407 res=chain[(' ', resseq, icode_res)] 408 res=chain[(' ', resseq, icode_res)]
408 else : #modified nucleotides (e.g. chain 5l4o_1_A) 409 else : #modified nucleotides (e.g. chain 5l4o_1_A)
409 het='H_' + nt 410 het='H_' + nt
...@@ -421,7 +422,15 @@ class Chain: ...@@ -421,7 +422,15 @@ class Chain:
421 res_atoms=res.get_atoms() 422 res_atoms=res.get_atoms()
422 new_residu_t=pdb.Residue.Residue(res_id, res_name, res.get_segid()) 423 new_residu_t=pdb.Residue.Residue(res_id, res_name, res.get_segid())
423 for atom in list(res.get_atoms()): 424 for atom in list(res.get_atoms()):
424 - if atom.get_name() in ['PA', 'O1A', 'O2A', 'O3A']: 425 + # rename the remaining phosphate group to P, OP1, OP2, OP3
426 + if atom.get_name() in ['PA', 'O1A', 'O2A', 'O3A'] and res_name != 'RIA':
427 +
428 + # RIA is a residue made up of 2 riboses and 2 phosphates,
429 + # so it has an O2A atom between the C2A and C1 'atoms,
430 + # and it also has an OP2 atom attached to one of its phosphates
431 + # (see chains 6fyx_1_1, 6zu9_1_1, 6fyy_1_1, 6gsm_1_1 , 3jaq_1_1 and 1yfg_1_A)
432 + # we do not modify the atom names of RIA residue
433 +
425 if atom.get_name() == 'PA': 434 if atom.get_name() == 'PA':
426 atom_name = 'P' 435 atom_name = 'P'
427 if atom.get_name() == 'O1A': 436 if atom.get_name() == 'O1A':
...@@ -1511,11 +1520,7 @@ class Pipeline: ...@@ -1511,11 +1520,7 @@ class Pipeline:
1511 if self.HOMOLOGY and not os.path.isdir(path_to_3D_data + "rna_mapped_to_Rfam"): 1520 if self.HOMOLOGY and not os.path.isdir(path_to_3D_data + "rna_mapped_to_Rfam"):
1512 # for the portions mapped to Rfam 1521 # for the portions mapped to Rfam
1513 os.makedirs(path_to_3D_data + "rna_mapped_to_Rfam") 1522 os.makedirs(path_to_3D_data + "rna_mapped_to_Rfam")
1514 - ''' 1523 +
1515 - if (not self.HOMOLOGY) and not os.path.isdir(path_to_3D_data + "rna_only"):
1516 - # extract chains of pure RNA
1517 - os.makedirs(path_to_3D_data + "rna_only")
1518 - '''
1519 if (not self.HOMOLOGY) and not os.path.isdir(path_to_3D_data + "rna_only"): 1524 if (not self.HOMOLOGY) and not os.path.isdir(path_to_3D_data + "rna_only"):
1520 # extract chains of pure RNA 1525 # extract chains of pure RNA
1521 os.makedirs(path_to_3D_data + "rna_only") 1526 os.makedirs(path_to_3D_data + "rna_only")
......
This diff is collapsed. Click to expand it.