Skip to content

Commit

Permalink
Fetch entity ID and Identical chains
Browse files Browse the repository at this point in the history
  • Loading branch information
prubach committed Nov 19, 2021
1 parent c9234ed commit 87de50d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="spyprot",
version='0.7.4',
version='0.7.6',
author="INTERDISCIPLINARY LABORATORY of BIOLOGICAL SYSTEMS MODELLING, University of Warsaw, Warsaw, Poland",
author_email="[email protected], [email protected]",
description="This package provides a set of tools for accessing protein databases and manipulating PDB/CIF files.",
Expand Down
30 changes: 30 additions & 0 deletions spyprot/fetchChainInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,36 @@ def __init__(self, pdbcode, chain):
break


class IdenticalChainsAndEntityId(PDBeSolrSearch):
'''
Find identical chains to a given one
example:
a = IdenticalChainsAndEntityId("2jlo",chain="A").get()
Parameters
==========
pdbcode: string - PDB ID
Returns
==========
(entity_id, [chains])
'''

def __init__(self, pdbcode, chain):
super().__init__()

self.results = (None, None)
documents = self.exec_query("pdb_id,entity_id,chain_id,assembly_composition", [('pdb_id', pdbcode)])

for i in range(len(documents)):
chain_id = documents[i]['chain_id']
ent_id = documents[i]['entity_id']
if chain in chain_id:
self.results = (ent_id, sorted(chain_id))
break


class SimilarChains(PDBeSolrSearch):
'''
Find similar chains to a given one with sequence identity given as parameter
Expand Down
9 changes: 8 additions & 1 deletion test_fetch_chain.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from spyprot.fetchChainInfo import SimilarChains, UniqueChains, IdenticalChains, ReleasedPDBs, SearchException, \
UniprotInfo
UniprotInfo, IdenticalChainsAndEntityId
from datetime import datetime


Expand All @@ -10,6 +10,13 @@ def test_fetchChainInfo_IdenticalChains():
assert str(f.get()) == "['X', 'Y', 'Z']"


def test_fetchChainInfo_IdenticalChainsAndEntityId():
f = IdenticalChainsAndEntityId('6wm4', 'Y')
ent_id, chains = f.get()
assert int(ent_id) == 9
assert str(chains) == "['X', 'Y', 'Z']"


def test_fetchChainInfo_UniqueChains():
f = UniqueChains('6wm4')
assert str(sorted(f.get())) == str(
Expand Down

0 comments on commit 87de50d

Please sign in to comment.