You are reading the documentation for version 3.1 of ProMod3. You may also want to read the documentation for: 3.0 1.3 2.0 2.1

Handling Gaps

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

Gap classes

class promod3.modelling.StructuralGap(before, after, seq)

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.

Parameters:
Raises:

A 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
GetChainIndex()
Returns:Index of chain, the gap is belonging to
Return type:int
GetChainName()
Returns:Name of chain, the gap is belonging to
Return type:str
GetChain()
Returns:Chain, the gap is belonging to
Return type:ost.mol.ChainHandle
IsNTerminal()
Returns:True, iff gap is N-terminal (i.e. before is invalid and after is valid)
Return type:bool
IsCTerminal()
Returns:True, iff gap is C-terminal (i.e. before is valid and after is invalid)
Return type:bool
IsTerminal()
Returns:True, iff gap is N- or C-terminal
Return type:bool
ShiftCTerminal()

Try to shift gap by one position towards C-terminal. Only possible if new gap is not terminal and it doesn’t try to shift the gap past another gap.

Returns:True, iff shift succeeded (gap is only updated in that case)
Return type:bool
ExtendAtNTerm()

Try to extend gap at N-terminal end of gap. Only possible if the gap is not at N-terminal and it doesn’t try to extend the gap past another gap.

Returns:True, iff extend succeeded (gap is only updated in that case)
Return type:bool
ExtendAtCTerm()

Try to extend gap at C-terminal end of gap. Only possible if the gap is not at C-terminal and it doesn’t try to extend the gap past another gap.

Returns:True, iff extend succeeded (gap is only updated in that case)
Return type:bool
GetLength()
Returns:Length of the gap.
Return type:int
Copy()
Returns:Copy of the gap.
Return type:StructuralGap
length

Alias for GetLength() (read-only, int)

seq

Sequence string for the gap (read-only, str)

before

Residue before the gap (read-only, ost.mol.ResidueHandle)

after

Residue after the gap (read-only, ost.mol.ResidueHandle)

full_seq

Full sequence, including stem residues (read-only)

class promod3.modelling.StructuralGapList

Represents a list of StructuralGap.

Gap Extender classes

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

class promod3.modelling.GapExtender(gap, seqres)

The extender cycles through the following steps:

   -
  --
   --
 ---
  ---
   ---
----
 ----
  ----
   ----
Parameters:
Raises:

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

Extend()

Tries to extend gap.

Returns:False, if the gap cannot be extended any further. This happens if it reaches a terminal or another insertion gap. Otherwise, the gap passed to the constructor is changed. The gaps are extended with ascending length and will always have valid termini.
Return type:bool
class promod3.modelling.FullGapExtender(gap, seqres, max_length=-1)

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

Parameters:
  • gap (StructuralGap) – The gap which will be extended by Extend().
  • seqres (str / ost.seq.SequenceHandle) – The full sequence of the chain, the gap is associated with.
  • max_length (int) –
    • If -1, all possible non-terminal gaps are returned.
    • If >= 0, this restricts the max. gap-length (w/o termini) producable by Extend().
Raises:

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

Extend()

Tries to extend gap.

Returns:False, if the gap cannot be extended without exceeding max_length. Otherwise, the gap passed to the constructor is changed. The gaps are extended with ascending length and will always have valid termini.
Return type:bool
class promod3.modelling.ScoringGapExtender(gap, extension_penalty, penalties, seqres, max_length=-2)

The extender scores possible gap extensions and returns them in order of their score when 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)

Parameters:
  • gap (StructuralGap) – The gap which will be extended by Extend().
  • extension_penalty (float) – Penalty for length of gap.
  • penalties (list of float) – Penalty for each residue added to gap.
  • seqres (str / ost.seq.SequenceHandle) – The full sequence of the chain, the gap is associated with.
  • max_length (int) –
    • If -2, GapExtender is used instead of 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 Extend().
Raises:

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

Extend()

Tries to extend gap.

Returns:False, if the gap cannot be extended any further. Otherwise, gap is changed and returned in ascending score. The updated gap will always have valid termini.
Return type:bool
class promod3.modelling.ShiftExtension(n_num, c_num)

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

Parameters:
  • n_num (int) – N residue number to start with
  • c_num (int) – C residue number to start with
Extend()
Returns:The next residue numbers for n_stem and c_stem
Return type:tuple

Gap Handling Functions

promod3.modelling.CountEnclosedGaps(mhandle, gap)
promod3.modelling.CountEnclosedInsertions(mhandle, gap)

Counts all gaps from mhandle which are fully enclosed by given gap. This is either all gaps or only insertions.

Parameters:
  • mhandle (ModellingHandle) – Modelling handle on which to apply change.
  • gap (StructuralGap) – Gap defining range in which gaps are to be removed.
Returns:

Number of gaps.

Return type:

int

promod3.modelling.ClearGaps(mhandle, gap)

Removes all gaps from mhandle which are fully enclosed by given gap.

Parameters:
  • mhandle (ModellingHandle) – Modelling handle on which to apply change.
  • gap (StructuralGap) – Gap defining range in which gaps are to be removed.
Returns:

Index of next gap in mhandle.gaps after removal. Returns -1 if last gap was removed or no gaps in mhandle.

Return type:

int

Raises:

A RuntimeError if any gap in mhandle.gaps is only partially enclosed by given gap.

promod3.modelling.InsertLoopClearGaps(mhandle, bb_list, gap)

Insert loop into model, update scoring environments and remove all gaps from mhandle which are fully enclosed by given gap (see InsertLoop() and ClearGaps()).

Parameters:
  • mhandle (ModellingHandle) – Modelling handle on which to apply change.
  • bb_list (BackboneList) – Loop to insert (backbone only).
  • gap (StructuralGap) – Gap defining range of loop to insert (must be consistent!).
Returns:

Index of next gap in mhandle.gaps after removal. Returns -1 if last gap was removed or no gaps in mhandle.

Return type:

int

Raises:

A RuntimeError if bb_list and gap are inconsistent or if any gap in mhandle.gaps is only partially enclosed by gap.

promod3.modelling.MergeGaps(mhandle, index)

Merges two gaps mhandle.gaps[index] and mhandle.gaps[index+1]. The residues in between the gaps are removed from mhandle.model and added to the new mhandle.gaps[index].

Parameters:
  • mhandle (ModellingHandle) – Modelling handle on which to apply change.
  • index (int) – Index of gap to merge with next one.
Raises:

A RuntimeError if indices out of range or if trying to merge gaps of different chains or an N-terminal gap with a C-terminal gap.

Contents

Search

Enter search terms or a module, class or function name.

Previous topic

Model Checking

Next topic

Handling Loop Candidates

You are here