Skip to content

Commit

Permalink
allow category in every spawn_child
Browse files Browse the repository at this point in the history
  • Loading branch information
edikedik committed Mar 21, 2024
1 parent f27a0a3 commit 4b58309
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 5 additions & 0 deletions lXtractor/chain/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ def spawn_child(
start: int,
end: int,
name: str | None = None,
category: str | None = None,
*,
subset_structures: bool = True,
tolerate_failure: bool = False,
Expand All @@ -543,6 +544,8 @@ def spawn_child(
:param start: Start coordinate.
:param end: End coordinate.
:param name: Name of a new chain.
:param category: Spawned child category. Any meaningful tag string that
could be used later to group similar children.
:param subset_structures: If ``True``, subset each structure in
:attr:`structures`. If ``False``, structures are not inherited.
:param tolerate_failure: If ``True``, a failure to subset a structure
Expand Down Expand Up @@ -589,6 +592,7 @@ def subset_structure(structure: ChainStructure) -> ChainStructure | None:
start,
end,
name,
category,
map_from=str_map_from,
map_closest=str_map_closest,
deep_copy=str_deep_copy,
Expand Down Expand Up @@ -623,6 +627,7 @@ def subset_structure(structure: ChainStructure) -> ChainStructure | None:
start,
end,
name,
category,
map_from=seq_map_from,
map_closest=seq_map_closest,
deep_copy=seq_deep_copy,
Expand Down
2 changes: 2 additions & 0 deletions lXtractor/chain/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,8 @@ def spawn_child(
:param start: Start of the sub-sequence.
:param end: End of the sub-sequence.
:param name: Spawned child sequence's name.
:param category: Spawned child category. Any meaningful tag string that
could be used later to group similar children.
:param map_from: Optionally, the map name the boundaries correspond to.
:param map_closest: Map to closest `start`, `end` boundaries
(see :meth:`map_boundaries`).
Expand Down
16 changes: 4 additions & 12 deletions lXtractor/chain/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import typing as t
from collections import abc
from dataclasses import dataclass
from pathlib import Path

import numpy as np
Expand Down Expand Up @@ -34,17 +33,6 @@
# TODO: subset and overlap with other structures/sequences


@dataclass
class PDB_Chain:
"""
A container to hold the data of a single structural chain.
"""

id: str
chain: str
structure: GenericStructure | None


def _validate_chain(structure: GenericStructure):
if structure.is_empty or structure.is_singleton:
return
Expand Down Expand Up @@ -537,6 +525,7 @@ def spawn_child(
start: int,
end: int,
name: str | None = None,
category: str | None = None,
*,
map_from: str | None = None,
map_closest: bool = True,
Expand All @@ -553,6 +542,8 @@ def spawn_child(
:param start: Start coordinate.
:param end: End coordinate.
:param name: The name of the spawned sub-structure.
:param category: Spawned child category. Any meaningful tag string that
could be used later to group similar children.
:param map_from: Optionally, the map name the boundaries correspond to.
:param map_closest: Map to closest `start`, `end` boundaries
(see :meth:`map_boundaries`).
Expand Down Expand Up @@ -580,6 +571,7 @@ def spawn_child(
start,
end,
name,
category,
map_from=map_from,
map_closest=map_closest,
deep_copy=deep_copy,
Expand Down

0 comments on commit 4b58309

Please sign in to comment.