Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Sequence Coord API #46

Open
wants to merge 12 commits into
base: staging
Choose a base branch
from
Open
554 changes: 554 additions & 0 deletions pyproject.toml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion rcsbapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

class Config:
DATA_API_TIMEOUT: int = 60
SEARCH_API_REQUESTS_PER_SECOND: int = 10
SUPPRESS_AUTOCOMPLETE_WARNING: bool = False

SEARCH_API_REQUESTS_PER_SECOND: int = 10

SEQ_API_TIMEOUT: int = 60

def __setattr__(self, name, value):
"""Verify attribute exists when a user tries to set a configuration parameter, and ensure proper typing.
Raises an error if user accidentally tries to create a new, unused attribute (e.g., due to a typo or misspelling),
Expand Down
6 changes: 6 additions & 0 deletions rcsbapi/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@ class Const:
})


@dataclass(frozen=True)
class SeqConst:
API_ENDPOINT: str = "https://sequence-coordinates.rcsb.org"


seq_const = SeqConst()
const = Const()
1 change: 0 additions & 1 deletion rcsbapi/data/data_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def exec(self) -> Dict[str, Any]:
if len(self._input_ids) > batch_size:
batched_ids = self._batch_ids(batch_size)
response_json: Dict[str, Any] = {}
# count = 0
for id_batch in batched_ids:
query = re.sub(r"\[([^]]+)\]", f"{id_batch}".replace("'", '"'), self._query)
part_response = requests.post(
Expand Down
16 changes: 16 additions & 0 deletions rcsbapi/sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""RCSB PDB Sequence Coordinates API."""
from rcsbapi.sequence.seq_schema import SeqSchema

SEQ_SCHEMA = SeqSchema()

from rcsbapi.sequence.seq_query import Alignments, GroupAlignments, Annotations, GroupAnnotations, GroupAnnotationsSummary, AnnotationFilterInput # noqa: E402

__all__ = [
"AnnotationFilterInput",
"SeqSchema",
"alignments",
"annotations",
"group_alignments",
"group_annotations",
"group_annotations_summary",
]
Loading
Loading