NuriKit v0.1.0b2
Loading...
Searching...
No Matches
nuri::TMAlign Class Reference

TM-align algorithm. More...

#include <nuri/tools/tm.h>

Public Types

enum class  InitFlags : std::uint32_t {
  kNone = 0x0 , kGaplessThreading = 0x1 , kSecStr = 0x2 , kLocal = 0x4 ,
  kLocalPlusSecStr = 0x8 , kFragmentGaplessThreading = 0x10 , kDefault
}
 Initialization flags for TM-align algorithm. More...

Public Member Functions

 TMAlign (ConstRef< Matrix3Xd > query, ConstRef< Matrix3Xd > templ)
 Prepare TM-align algorithm with the given structures.
ABSL_MUST_USE_RESULT bool initialize (InitFlags flags=InitFlags::kDefault)
 Initialize the TM-align algorithm.
ABSL_MUST_USE_RESULT bool initialize (InitFlags flags, ConstRef< ArrayXc > secx, ConstRef< ArrayXc > secy)
 Initialize the TM-align algorithm with user-provided secondary structures.
ABSL_MUST_USE_RESULT bool initialize (ConstRef< ArrayXi > y2x, bool keep_alignment=true)
 Initialize the TM-align algorithm with user-provided alignment.
bool initialized () const
std::pair< Isometry3d, double > tm_score (int l_norm=-1, double d0=-1)
 Calculate TM-score using the current alignment.
const ArrayXi & templ_to_query () const &
 Final alignment of the structures.
ArrayXi && templ_to_query () &&
 Final alignment of the structures (move version).
int l_ali () const
 Get the length of the aligned region.
double aligned_msd () const
 Get the mean square deviation of the aligned region.

Detailed Description

TM-align algorithm.

This is a ground-up reimplementation of TM-align algorithm based on the original TM-align code (version 20220412) by Yang Zhang. This implementation aims to reproduce the results of the original code while providing improved user interface and maintainability. Refer to the following paper for details of the algorithm.

Reference:

Here follows the full license text for the TM-align code:

TM-align: sequence-independent structure alignment of monomer proteins by
TM-score superposition. Please report issues to yangzhanglab@umich.edu
References to cite:
Y Zhang, J Skolnick. Nucl Acids Res 33, 2302-9 (2005)
DISCLAIMER:
Permission to use, copy, modify, and distribute the Software for any
purpose, with or without fee, is hereby granted, provided that the
notices on the head, the reference information, and this copyright
notice appear in all copies or substantial portions of the Software.
It is provided "as is" without express or implied warranty.
See also
tm_align()

Member Enumeration Documentation

◆ InitFlags

enum class nuri::TMAlign::InitFlags : std::uint32_t
strong

Initialization flags for TM-align algorithm.

Enumerator
kNone 
kGaplessThreading 

Enable gapless threading.

kSecStr 

Enable secondary structure-based alignment. Requires secondary structure assignment.

kLocal 

Enable alignment based on local superposition. This initialization is the most time-consuming method due to the exhaustive pairwise distance calculation.

kLocalPlusSecStr 

Enable local superposition with secondary structure-based alignment. Requires secondary structure assignment.

kFragmentGaplessThreading 

Enable fragment gapless threading.

kDefault 

Default initialization flags, combination of all initialization methods.

Constructor & Destructor Documentation

◆ TMAlign()

nuri::TMAlign::TMAlign ( ConstRef< Matrix3Xd > query,
ConstRef< Matrix3Xd > templ )

Prepare TM-align algorithm with the given structures.

Parameters
queryThe query structure.
templThe template structure.
Note
If any of the structures contain less than 5 residues, all initialization and alignment attempts will fail.

Member Function Documentation

◆ aligned_msd()

double nuri::TMAlign::aligned_msd ( ) const
inline

Get the mean square deviation of the aligned region.

Returns
The mean square deviation of the aligned region.

◆ initialize() [1/3]

ABSL_MUST_USE_RESULT bool nuri::TMAlign::initialize ( ConstRef< ArrayXi > y2x,
bool keep_alignment = true )

Initialize the TM-align algorithm with user-provided alignment.

Parameters
y2xA map of the template structure to the query structure. Negative values indicate that the corresponding residue in the template structure is not aligned to any residue in the query structure.
keep_alignmentWhether to keep the given alignment without pruning during realignment step (-i vs -I in the original TM-align program).
Returns
Whether the initialization was successful.
Note
If size of y2x is not equal to the length of the template structure or any value of y2x is larger than or equal to the length of the query structure, the behavior is undefined.

◆ initialize() [2/3]

ABSL_MUST_USE_RESULT bool nuri::TMAlign::initialize ( InitFlags flags,
ConstRef< ArrayXc > secx,
ConstRef< ArrayXc > secy )

Initialize the TM-align algorithm with user-provided secondary structures.

Parameters
flagsInitialization flags.
secxSecondary structure of the query structure.
secySecondary structure of the template structure.
Returns
Whether the initialization was successful.
Note
If none of kSecStr or kLocalPlusSecStr flags are set, secondary structures are ignored.

◆ initialize() [3/3]

ABSL_MUST_USE_RESULT bool nuri::TMAlign::initialize ( InitFlags flags = InitFlags::kDefault)

Initialize the TM-align algorithm.

Parameters
flagsInitialization flags.
Returns
Whether the initialization was successful.
Note
If any of kSecStr or kLocalPlusSecStr flags are set, the secondary structures of the input structures will be assigned using the approximate secondary structure assignment algorithm in the TM-align code.

◆ initialized()

bool nuri::TMAlign::initialized ( ) const
inline

◆ l_ali()

int nuri::TMAlign::l_ali ( ) const
inline

Get the length of the aligned region.

Returns
The length of the aligned region.

◆ templ_to_query() [1/2]

ArrayXi && nuri::TMAlign::templ_to_query ( ) &&
inline

Final alignment of the structures (move version).

Returns
A map of the template structure to the query structure. Negative values indicate that the corresponding residue in the template structure is not aligned to any residue in the query structure.
Note
TMAlign class is invalidated after this call.

◆ templ_to_query() [2/2]

const ArrayXi & nuri::TMAlign::templ_to_query ( ) const &
inline

Final alignment of the structures.

Returns
A map of the template structure to the query structure. Negative values indicate that the corresponding residue in the template structure is not aligned to any residue in the query structure.

◆ tm_score()

std::pair< Isometry3d, double > nuri::TMAlign::tm_score ( int l_norm = -1,
double d0 = -1 )

Calculate TM-score using the current alignment.

Parameters
l_normLength normalization factor. If negative, the length of the template structure is used.
d0Distance scale factor. If negative, the default value is calculated based on the length normalization factor.
Returns
A pair of best transformation matrix and TM-score. If the alignment failed for any reason, the TM-score is set to a negative value and the transformation matrix is left unspecified.

The documentation for this class was generated from the following file: