pestifer.molecule.stateinterval module

A “state interval” is a representation of a run of frames within a finitely resolved trajectory, all of which are in the same state. Each trajectory frame is represented as a counting integer index, and the state interval is defined by a pair of indices that represent the start and end of the interval. The state is a string that describes the state of the system over that interval, such as “RESOLVED” or “MISSING”. The state interval can also include additional metadata such as a build flag, selection name, and PDB file name.

class pestifer.molecule.stateinterval.StateInterval(*args, state: str, bounds: list[int], build: bool = False, selname: str = None, pdb: str = None, sacres: Residue = None)[source]

Bases: BaseObj

A simple class to represent a state interval with a start and end time. This is useful for tracking the state of an object over a period of time.

bounds: list[int]
build: bool
declare_buildable() None[source]

Declare this object as buildable. This method sets the build attribute to True.

increment_rightbound(increment: int = 1) None[source]

Increment the right bound of the interval by a specified amount.

Parameters:

increment (int, optional) – The amount to increment the right bound by (default is 1).

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': False}

Configuration for pydantic.BaseModel.

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

num_items() int[source]

Get the number of items in the interval.

Returns:

The number of items in the interval.

Return type:

int

pdb: str
sacres: Residue
selname: str
state: str
class pestifer.molecule.stateinterval.StateIntervalList(initlist: Iterable[T] = ())[source]

Bases: BaseObjList[StateInterval]

A list of StateInterval objects. This class extends BaseObjList to manage a collection of StateInterval instances.

add_interval(interval: StateInterval) None[source]

Inserts a StateInterval into the calling instance.

Parameters:

interval (StateInterval) – the StateInterval to be inserted into the calling instance

describe() str[source]

Abstract method to describe the contents of the BaseObjList. Subclasses should implement this method to provide a meaningful description.

num_items() int[source]

Returns the number of items in the bounds list based on index calculation

Returns:

The number of items in the bounds list.

Return type:

int

classmethod process_itemlist(itemlist: list[object] = None, state_func: Callable = None)[source]

Process an item to extract StateInterval instances.

Parameters:
  • item (Any, optional) – The item to process (default is None).

  • state_func (function, optional) – A function to determine the state of the item (default is None).

Returns:

A list of StateInterval instances.

Return type:

StateIntervalList