Skip to content
Snippets Groups Projects
gap_handling.rst 11.19 KiB

Handling Gaps

This chapter describes the gap classes and functionality attached to them. These classes / functions are used within the modelling pipeline.

Gap classes

Describes a structural gap, i.e. a loop to be modeled. The gap may either be terminal or between two defined regions. The gap stores information of the last residue before and the first residue after the gap as well as the sequence of gap. Gaps at the N- and C-terminals can be defined by passing invalid residue handles to before or after.

param before:

Fills :attr:`before`

type before:

:class:`ost.mol.ResidueHandle`

param after:

Fills :attr:`after`

type after:

:class:`ost.mol.ResidueHandle`

param seq:

Fills :attr:`seq`

type seq:

:class:`str`

raises:

A :exc:`RuntimeError` if both residues are invalid or when both are valid and:

  • residues are from different chains (if both valid)
  • before is located after after
  • seq has a length which is inconsistent with the gap

Represents a :class:`list` of :class:`StructuralGap`.

Gap Extender classes

The extender classes work on a given :class:`StructuralGap` and provide an Extend() function to propose new gaps for loop modelling. The function returns False if no new extension possible.

The extender cycles through the following steps:

   -
  --
   --
 ---
  ---
   ---
----
 ----
  ----
   ----
param gap: The gap which will be extended by :meth:`Extend`.
param seqres: The full sequence of the chain, the gap is associated with.
type gap: :class:`StructuralGap`
type seqres: :class:`str` / :class:`ost.seq.SequenceHandle`
raises: An exception if a terminal gap is used to construct this.

Cycles as GapExtender, but continues even if another gap was encountered.

param gap:

The gap which will be extended by :meth:`Extend`.

param seqres:

The full sequence of the chain, the gap is associated with.

param max_length:
  • If -1, all possible non-terminal gaps are returned.
  • If >= 0, this restricts the max. gap-length (w/o termini) producable by :meth:`Extend`.
type gap:

:class:`StructuralGap`

type seqres:

:class:`str` / :class:`ost.seq.SequenceHandle`

type max_length:

:class:`int`

raises:

An exception if a terminal gap is used to construct this.

The extender scores possible gap extensions and returns them in order of their score when :meth:`Extend` is called. The score is penalized according to length and according to certain (well conserved) regions in the structure as defined by penalties. score = num_gap_extensions * extension_penalty + sum( penalties [i] ) (i = resnum - 1 of residues in extension)

param gap:

The gap which will be extended by :meth:`Extend`.

type gap:

:class:`StructuralGap`

param extension_penalty:

Penalty for length of gap.

type extension_penalty:

:class:`float`

param penalties:

Penalty for each residue added to gap.

type penalties:

:class:`list` of :class:`float`

param seqres:

The full sequence of the chain, the gap is associated with.

type seqres:

:class:`str` / :class:`ost.seq.SequenceHandle`

param max_length:
  • If -2, :class:`GapExtender` is used instead of :class:`FullGapExtender` (i.e. it stops at gaps and termini).
  • If -1, all possible non-terminal gaps are returned.
  • If >= 0, this restricts the max. gap-length (w/o termini) producable by :meth:`Extend`.
type max_length:

:class:`int`

raises:

An exception if a terminal gap is used to construct this.

Implements the underlying extension scheme of the :class:`GapExtender`. It is not associated to any structural data, it just spits out the residue numbers according to the extension scheme described above.

param n_num: N residue number to start with
param c_num: C residue number to start with
type n_num: :class:`int`
type c_num: :class:`int`

Gap Handling Functions