Skip to content
Snippets Groups Projects
Commit 17cd201f authored by Christian Faber's avatar Christian Faber
Browse files

bugs, and bugs

parent 2df21f06
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
1p6v.pdb 0 → 100644
This diff is collapsed.
......@@ -8,11 +8,12 @@ from matplotlib.patches import Rectangle
def main():
test_pdb = Cmap()
test_pdb.load_native_pdb("2n1q.pdb", start_from_one=False)
test_pdb.load_native_pdb("1l9a.pdb", start_from_one=False, added_tail=0)
print(test_pdb.positioning, test_pdb.l, test_pdb.contacts["native"].shape)
test_pdb.load_contacts_from_restraints("simrna_2n1q_L0.5.res", "DCA")
print(test_pdb.get_unmodelled_regions())
test_pdb.load_contacts_from_restraints("simrna_1l9a_L0.5.res", "DCA")
print(test_pdb.ppvs["DCA"])
# print(test_pdb.get_unmodelled_regions(), test_pdb.ppvs["DCA"])
fig, ax = show_contact_map(test_pdb, ["DCA"], mark_match=True)
plt.show()
......
......@@ -5,7 +5,7 @@ with open("README.md", "r") as f:
setup(
name="BioHelpers_FABER",
version="0.1.21",
version="0.1.22",
description="Small collection of useful scripts for the computational work with RNA Data.",
url="https://gitlab.jsc.fz-juelich.de/faber1/biohelpers",
package_dir={"": "src"},
......
Metadata-Version: 2.1
Name: BioHelpers-FABER
Version: 0.1.20
Version: 0.1.21
Summary: Small collection of useful scripts for the computational work with RNA Data.
Home-page: https://gitlab.jsc.fz-juelich.de/faber1/biohelpers
Author: Christian Faber
......
......@@ -53,6 +53,7 @@ class Cmap:
reference: str = "nitrogen",
contact_threshold: float = 9.5,
start_from_one: bool = True,
added_tail: int = 0,
) -> None:
"""Method to load the experimental PDB file for comparison
......@@ -68,6 +69,8 @@ class Cmap:
self.positioning = [e - shift for e in self.positioning]
self.positioning.insert(0, 0)
self.positioning.insert(0, 0)
self.positioning.append(added_tail + self.positioning[-1])
self.positioning.append(self.positioning[-1])
self.l = self.positioning[-1]
chain = next(pdb.PDBParser().get_structure(id, filename)[0].get_chains())
bm.cleanup_chain(chain)
......@@ -79,8 +82,8 @@ class Cmap:
self.contacts["native"] = np.zeros((self.l, self.l))
for c in bm.arr_to_contact_list(self.native_contacts):
self.contacts["native"][
self.num_to_id(c[0]),
self.num_to_id(c[1]),
self.num_to_id(c[0]) - 1,
self.num_to_id(c[1]) - 1,
] = 1
self.pdb_id = id
......@@ -164,7 +167,7 @@ class Cmap:
:return: Residue ID
:rtype: int
"""
ids = iter(self.positioning)
ids = iter(self.positioning[2:])
ids_pairwise = zip(ids, ids)
id_range = list(chain.from_iterable((range(a, b + 1) for a, b in ids_pairwise)))
return id_range[position]
......@@ -148,15 +148,15 @@ def show_contact_map(
native_contacts_list = bm.arr_to_contact_list(cm.contacts["native"])
for um in cm.get_unmodelled_regions():
rect1 = Rectangle(
(cm.num_to_id(1), um[0]),
width=cm.positioning[-1] - cm.positioning[0] + 1,
(1, um[0]),
width=cm.positioning[-1] - 1,
height=(um[1] - um[0] + 1),
color="#eb5f73",
alpha=0.5,
)
rect2 = Rectangle(
(um[0], cm.num_to_id(1)),
height=cm.positioning[-1] - cm.positioning[0] + 1,
(um[0], 1),
height=cm.positioning[-1] - 1,
width=(um[1] - um[0] + 1),
color="#eb5f73",
alpha=0.5,
......@@ -165,8 +165,8 @@ def show_contact_map(
ax.add_patch(rect2)
if show_native:
ax.scatter(
[e[0] + cm.positioning[0] for e in native_contacts_list],
[e[1] + cm.positioning[0] for e in native_contacts_list],
[e[0] for e in native_contacts_list],
[e[1] for e in native_contacts_list],
label="Native",
)
for i, con_name in enumerate(con_list):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment