Skip to content

Commit

Permalink
Merge pull request #67 from 3dem/revert-63-label-seq-id
Browse files Browse the repository at this point in the history
Revert "Fix for issue #51"
  • Loading branch information
jamaliki authored Aug 28, 2023
2 parents 6f9cc1b + dfea5e3 commit b69278d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions model_angelo/utils/save_pdb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b69278d

Please sign in to comment.