openfold.data.templates

Functions for getting templates and calculating template features.

Classes

CustomHitFeaturizer(mmcif_dir, ...[, ...])

Featurizer for templates given in folder.

HhsearchHitFeaturizer(mmcif_dir, ...[, ...])

HmmsearchHitFeaturizer(mmcif_dir, ...[, ...])

PrefilterResult(valid, error, warning)

SingleHitResult(features, error, warning)

TemplateHitFeaturizer(mmcif_dir, ...[, ...])

An abstract base class for turning template hits to features.

TemplateSearchResult(features, errors, warnings)

Functions

Exceptions

AlignRatioError

An error indicating that the hit align ratio to the query was too small.

CaDistanceError

An error indicating that a CA atom distance exceeds a threshold.

DateError

An error indicating that the hit date was after the max allowed date.

DuplicateError

An error indicating that the hit was an exact subsequence of the query.

LengthError

An error indicating that the hit was too short.

NoAtomDataInTemplateError

An error indicating that template mmCIF didn't contain atom positions.

NoChainsError

An error indicating that template mmCIF didn't have any chains.

PrefilterError

A base class for template prefilter exceptions.

QueryToTemplateAlignError

An error indicating that the query can't be aligned to the template.

SequenceNotInTemplateError

An error indicating that template mmCIF didn't contain the sequence.

TemplateAtomMaskAllZerosError

An error indicating that template mmCIF had all atom positions masked.

exception AlignRatioError

Bases: PrefilterError

An error indicating that the hit align ratio to the query was too small.

exception CaDistanceError

Bases: Error

An error indicating that a CA atom distance exceeds a threshold.

exception DateError

Bases: PrefilterError

An error indicating that the hit date was after the max allowed date.

exception DuplicateError

Bases: PrefilterError

An error indicating that the hit was an exact subsequence of the query.

exception LengthError

Bases: PrefilterError

An error indicating that the hit was too short.

exception NoAtomDataInTemplateError

Bases: Error

An error indicating that template mmCIF didn’t contain atom positions.

exception NoChainsError

Bases: Error

An error indicating that template mmCIF didn’t have any chains.

exception PrefilterError

Bases: Exception

A base class for template prefilter exceptions.

exception QueryToTemplateAlignError

Bases: Error

An error indicating that the query can’t be aligned to the template.

exception SequenceNotInTemplateError

Bases: Error

An error indicating that template mmCIF didn’t contain the sequence.

exception TemplateAtomMaskAllZerosError

Bases: Error

An error indicating that template mmCIF had all atom positions masked.

class CustomHitFeaturizer(mmcif_dir, max_template_date, max_hits, kalign_binary_path, release_dates_path=None, obsolete_pdbs_path=None, strict_error_check=False, _shuffle_top_k_prefiltered=None, _zero_center_positions=True)

Bases: TemplateHitFeaturizer

Featurizer for templates given in folder. Chain of interest has to be chain A and of same sequence length as input sequence.

Parameters:
  • mmcif_dir (str)

  • max_template_date (str)

  • max_hits (int)

  • kalign_binary_path (str)

  • release_dates_path (str | None)

  • obsolete_pdbs_path (str | None)

  • strict_error_check (bool)

  • _shuffle_top_k_prefiltered (int | None)

  • _zero_center_positions (bool)

get_templates(query_sequence, hits)

Computes the templates for given query sequence (more details above).

Parameters:
Return type:

TemplateSearchResult

class HhsearchHitFeaturizer(mmcif_dir, max_template_date, max_hits, kalign_binary_path, release_dates_path=None, obsolete_pdbs_path=None, strict_error_check=False, _shuffle_top_k_prefiltered=None, _zero_center_positions=True)

Bases: TemplateHitFeaturizer

Parameters:
  • mmcif_dir (str)

  • max_template_date (str)

  • max_hits (int)

  • kalign_binary_path (str)

  • release_dates_path (str | None)

  • obsolete_pdbs_path (str | None)

  • strict_error_check (bool)

  • _shuffle_top_k_prefiltered (int | None)

  • _zero_center_positions (bool)

get_templates(query_sequence, hits)

Computes the templates for given query sequence (more details above).

Parameters:
Return type:

TemplateSearchResult

class HmmsearchHitFeaturizer(mmcif_dir, max_template_date, max_hits, kalign_binary_path, release_dates_path=None, obsolete_pdbs_path=None, strict_error_check=False, _shuffle_top_k_prefiltered=None, _zero_center_positions=True)

Bases: TemplateHitFeaturizer

Parameters:
  • mmcif_dir (str)

  • max_template_date (str)

  • max_hits (int)

  • kalign_binary_path (str)

  • release_dates_path (str | None)

  • obsolete_pdbs_path (str | None)

  • strict_error_check (bool)

  • _shuffle_top_k_prefiltered (int | None)

  • _zero_center_positions (bool)

get_templates(query_sequence, hits)
Parameters:
Return type:

TemplateSearchResult

class PrefilterResult(valid: bool, error: str | None, warning: str | None)
Parameters:
  • valid (bool)

  • error (str | None)

  • warning (str | None)

error: str | None
valid: bool
warning: str | None
class SingleHitResult(features: Mapping[str, Any] | None, error: str | None, warning: str | None)
Parameters:
error: str | None
features: Mapping[str, Any] | None
warning: str | None
class TemplateHitFeaturizer(mmcif_dir, max_template_date, max_hits, kalign_binary_path, release_dates_path=None, obsolete_pdbs_path=None, strict_error_check=False, _shuffle_top_k_prefiltered=None, _zero_center_positions=True)

Bases: ABC

An abstract base class for turning template hits to features.

Parameters:
  • mmcif_dir (str)

  • max_template_date (str)

  • max_hits (int)

  • kalign_binary_path (str)

  • release_dates_path (str | None)

  • obsolete_pdbs_path (str | None)

  • strict_error_check (bool)

  • _shuffle_top_k_prefiltered (int | None)

  • _zero_center_positions (bool)

abstract get_templates(query_sequence, hits)

Computes the templates for a given query sequence

Parameters:
Return type:

TemplateSearchResult

class TemplateSearchResult(features: Mapping[str, Any], errors: Sequence[str], warnings: Sequence[str])
Parameters:
errors: Sequence[str]
features: Mapping[str, Any]
warnings: Sequence[str]
empty_template_feats(n_res)
generate_release_dates_cache(mmcif_dir, out_path)
Parameters:
  • mmcif_dir (str)

  • out_path (str)

get_custom_template_features(mmcif_path, query_sequence, pdb_id, chain_id='A', kalign_binary_path=None)
Parameters:
  • mmcif_path (str)

  • query_sequence (str)

  • pdb_id (str)

  • chain_id (str | None)

  • kalign_binary_path (str | None)