foldkit.af3_result.AF3Result#

class foldkit.af3_result.AF3Result[source]#

Bases: object

__init__()#

Methods

__init__()

get_contact_probs([chain1, chain2, tokens1, ...])

Return the contact probs score.

get_ipae([chain1, chain2, tokens1, tokens2, agg])

Return the interface pae (predicted alignment error) score.

get_ipsae(chain1, chain2[, pae_cutoff, d0])

Return the asymmetric ipSAE score.

get_iptm([chain1, chain2])

Return the interchain ptm (iptm) score.

get_pae([chain, tokens, agg])

Return the pae (predicted alignment error) score.

get_plddt([chain, atoms, agg])

Return the plddt score.

get_ptm([chain])

Return the ptm score.

load_af3_result(result_dir[, id])

Loads a new single AF3 Result from AF3 output directory (result_dir), with optional name (id)

load_compressed_result(result_dir)

load_webserver_result(result_dir, sample[, ...])

Generate an AF3Result file for one of the 5 samples from a run on the AF3 webserver.

Attributes

atom_chain_ids: ndarray | None = None#
chain_pair_iptm: ndarray | None = None#
chain_ptm: ndarray | None = None#
chains: list[str] | None = None#
cif_chains: ndarray | None = None#
cif_path: Path | None = None#
cif_residues: ndarray | None = None#
contact_probs: ndarray | None = None#
full_json_path: Path | None = None#
get_contact_probs(chain1=None, chain2=None, tokens1=None, tokens2=None, agg=<function mean>)[source]#

Return the contact probs score.

Parameters:
  • chain1 (str, optional) – If provided, computes the contact probs for this specific pair of chains. Only optional if tokens1 and tokens2 are provided

  • chain2 (str, optional) – If provided, computes the contact probs for this specific pair of chains. Only optional if tokens1 and tokens2 are provided

  • tokens1 (list[int], optional) –

    If provided, computes the contact probs for this specific pair of token lists.

    Only optional if chain1 and chain2 are provided

  • tokens2 (list[int], optional) –

    If provided, computes the contact probs for this specific pair of token lists.

    Only optional if chain1 and chain2 are provided

  • agg (callable, default=np.mean) – Aggregation function to apply to the selected values.

Return type:

float

Returns:

float – Aggregated contact probs score.

Raises:

ValueError – If neither chain and tokens are provided, both are provided, or if either argument is invalid based on the data

get_ipae(chain1=None, chain2=None, tokens1=None, tokens2=None, agg=<function mean>)[source]#

Return the interface pae (predicted alignment error) score.

Parameters:
  • chain1 (str, optional) – If provided, computes the ipae for this specific pair of chains. Only optional if tokens1 and tokens2 are provided

  • chain2 (str, optional) – If provided, computes the ipae for this specific pair of chains. Only optional if tokens1 and tokens2 are provided

  • tokens1 (list[int], optional) –

    If provided, computes the ipae for this specific pair of token lists.

    Only optional if chain1 and chain2 are provided

  • tokens2 (list[int], optional) –

    If provided, computes the ipae for this specific pair of token lists.

    Only optional if chain1 and chain2 are provided

  • agg (callable, default=np.mean) – Aggregation function to apply to the selected values.

Return type:

float

Returns:

float – Aggregated ipae score.

Raises:

ValueError – If neither chain and tokens are provided, both are provided, or if either argument is invalid based on the data

get_ipsae(chain1, chain2, pae_cutoff=10, d0='d0res')[source]#

Return the asymmetric ipSAE score.

Parameters:
  • chain1 (str) – Computes the ipSAE for this specific pair of chains. Note that the score is asymmetric so the order of chains matters.

  • chain2 (str) – Computes the ipSAE for this specific pair of chains. Note that the score is asymmetric so the order of chains matters.

  • pae_cutoff (float, default=10) – PAE cutoff (in Angstroms) passed through to the ipSAE calculation.

  • d0 (str, default=d0res) – d0 used for calculation. Options are: d0res: d0 determined by number of residues in 2nd chain with PAE<cutoff d0chn: sum of chain lengths d0dom: d0 = total number of residues in both chains with any interchain PAE<cutoff

Return type:

float

Returns:

float – ipSAE score.

get_iptm(chain1=None, chain2=None)[source]#

Return the interchain ptm (iptm) score.

Parameters:
  • chain1 (str, optional) – If provided, computes the iptm for this specific pair of chains. Otherwise, returns the global iptm score for all pairs of chains

  • chain2 (str, optional) – If provided, computes the iptm for this specific pair of chains. Otherwise, returns the global iptm score for all pairs of chains

Return type:

float

Returns:

float – iptm score.

Raises:

ValueError – If chain is invalid based on the data

get_pae(chain=None, tokens=None, agg=<function mean>)[source]#

Return the pae (predicted alignment error) score.

Parameters:
  • chain (str, optional) – If provided, computes the pae for this specific chain. If None, returns the score across all tokens (residues) in the structure.

  • tokens (list[int], optional) – If provided, computes the pae for specific tokens. If None, returns the score across all tokens (residues) in the structure. Cannot be used in combination with “chain”

  • agg (callable, default=np.mean) – Aggregation function to apply to the selected values.

Return type:

float

Returns:

float – Aggregated pae score.

Raises:

ValueError – If both chain and tokens are provided, or if either argument is invalid based on the data

get_plddt(chain=None, atoms=None, agg=<function mean>)[source]#

Return the plddt score.

Parameters:
  • chain (str, optional) – If provided, computes the plddt for this specific chain. If None, returns the score across all tokens (residues) in the structure.

  • atoms (list[int], optional) – If provided, computes the plddt for specific atoms. If None, returns the score across all atoms in the structure. Cannot be used in combination with “chain”

  • agg (callable, default=np.mean) – Aggregation function to apply to the selected values.

Return type:

float

Returns:

float – Aggregated plddt score.

Raises:

ValueError – If both chain and atoms are provided, or if either argument is invalid based on the data

get_ptm(chain=None)[source]#

Return the ptm score.

Parameters:

chain (str, optional) – If provided, computes the ptm for this specific chain. If None, returns the global score across all chains in the structure.

Return type:

float

Returns:

float – ptm score.

Raises:

ValueError – If chain is invalid based on the data

global_iptm: float | None = None#
global_ptm: float | None = None#
id: str = None#
static load_af3_result(result_dir, id=None)[source]#

Loads a new single AF3 Result from AF3 output directory (result_dir), with optional name (id)

Return type:

AF3Result

Parameters:
  • result_dir (str)

  • id (str | None)

static load_compressed_result(result_dir)[source]#
Return type:

AF3Result

Parameters:

result_dir (str)

static load_webserver_result(result_dir, sample, seed=None, id_stem=None)[source]#

Generate an AF3Result file for one of the 5 samples from a run on the AF3 webserver.

Inputs: result_dir: path to directory storing results. sample: which sample to load seed: Model seed. If unset, will try to infer these from a request file in result_dir. id_stem: Job name. If unset, will try to infer these from a request file in result_dir.

Return type:

AF3Result

Parameters:
  • result_dir (str)

  • sample (int)

  • seed (int | None)

  • id_stem (str | None)

pae: ndarray | None = None#
plddt: ndarray | None = None#
residue_chain_ids: ndarray | None = None#
summary_json_path: Path | None = None#