From dfea5e301d9eba33a73617c9f7680b093dd3360d Mon Sep 17 00:00:00 2001 From: Kiarash Jamali Date: Mon, 28 Aug 2023 14:41:17 +0100 Subject: [PATCH] Revert "Fix for issue #51" --- model_angelo/utils/save_pdb_utils.py | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/model_angelo/utils/save_pdb_utils.py b/model_angelo/utils/save_pdb_utils.py index 702ba25..e61ac8d 100644 --- a/model_angelo/utils/save_pdb_utils.py +++ b/model_angelo/utils/save_pdb_utils.py @@ -2,7 +2,6 @@ import os import pickle from typing import List, Union -from copy import deepcopy import numpy as np import pandas as pd @@ -70,17 +69,6 @@ def points_to_xyz(path_to_save, points, zyx_order=False): f.write(f"C {point[2]} {point[1]} {point[0]}\n") -def save_structure_to_cif(structure, path_to_save: str): - io = MMCIFIO() - io.set_structure(structure) - # These are switched, as pointed out by Tristan Croll - auth_seq_id = deepcopy(io.dic["_atom_site.label_seq_id"]) - label_seq_id = deepcopy(io.dic["_atom_site.auth_seq_id"]) - io.dic["_atom_site.label_seq_id"] = label_seq_id - io.dic["_atom_site.auth_seq_id"] = auth_seq_id - io.save(path_to_save) - - def points_to_pdb(path_to_save, points): struct = StructureBuilder() struct.init_structure("1") @@ -92,7 +80,9 @@ def points_to_pdb(path_to_save, points): struct.init_residue(f"ALA", " ", i, " ") struct.init_atom("CA", point, 0, 1, " ", "CA", "C") struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def ca_ps_to_pdb(path_to_save, ca_points, p_points): @@ -128,7 +118,9 @@ def ca_ps_to_pdb(path_to_save, ca_points, p_points): element="P", ) struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def chains_to_pdb(path_to_save, chains): @@ -143,7 +135,9 @@ def chains_to_pdb(path_to_save, chains): struct.init_residue(f"ALA", " ", j, " ") struct.init_atom("CA", point, 0, 1, " ", "CA", "C") struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def to_xyz(directory): @@ -214,7 +208,9 @@ def atom14_to_cif( ) res_counter += 1 struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def protein_to_cif( @@ -284,7 +280,9 @@ def protein_to_cif( ) res_counter += 1 struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def chain_atom14_to_cif( @@ -365,7 +363,9 @@ def chain_atom14_to_cif( res_counter += 1 struct = struct.get_structure() - save_structure_to_cif(struct, path_to_save) + io = MMCIFIO() + io.set_structure(struct) + io.save(path_to_save) def write_chain_report(