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

add sequence position

parent b889570f
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ with open("README.md", "r") as f: ...@@ -5,7 +5,7 @@ with open("README.md", "r") as f:
setup( setup(
name="BioHelpers_FABER", name="BioHelpers_FABER",
version="0.1.13", version="0.1.14",
description="Small collection of useful scripts for the computational work with RNA Data.", description="Small collection of useful scripts for the computational work with RNA Data.",
url="https://gitlab.jsc.fz-juelich.de/faber1/biohelpers", url="https://gitlab.jsc.fz-juelich.de/faber1/biohelpers",
package_dir={"": "src"}, package_dir={"": "src"},
......
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: BioHelpers-FABER Name: BioHelpers-FABER
Version: 0.1.12 Version: 0.1.13
Summary: Small collection of useful scripts for the computational work with RNA Data. Summary: Small collection of useful scripts for the computational work with RNA Data.
Home-page: https://gitlab.jsc.fz-juelich.de/faber1/biohelpers Home-page: https://gitlab.jsc.fz-juelich.de/faber1/biohelpers
Author: Christian Faber Author: Christian Faber
......
...@@ -491,6 +491,32 @@ def numberOfResidues(file: str) -> int: ...@@ -491,6 +491,32 @@ def numberOfResidues(file: str) -> int:
return int(len(res)) return int(len(res))
def get_sequence_position(filename: str) -> tuple:
"""Show all the non-het Residues in a given pdb file and the associated position in the native molecule.
:param filename: Filename of PDB
:type filename: str
:return: Tuple of list with positions and sequence as string
:rtype: tuple
"""
chain = pdb.PDBParser().get_structure("id", filename)[0].get_chains()
chain = next(chain)
residues = chain.get_residues()
r1 = next(residues)
r2 = next(residues)
numb = [r1.id[1], r2.id[1]]
sequ = [r1.get_resname(), r2.get_resname()]
for r in residues:
if r.id[0] == " ":
sequ.append(r.get_resname())
if abs(numb[-1] - r.id[1]) > 1:
numb.append(r.id[1])
numb.append(r.id[1])
else:
numb[-1] = r.id[1]
return (numb, "".join(sequ))
if __name__ == "__main__": if __name__ == "__main__":
print("------------------") print("------------------")
print(" gmap 1.0 - sub module ") print(" gmap 1.0 - sub module ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment