Skip to content

confidence

Module for filtering alphafold structures on confidence.

ConfidenceFilterQuery dataclass

Query for filtering AlphaFoldDB structures based on confidence.

Parameters:

Name Type Description Default
confidence Percentage

The confidence threshold for filtering residues. Residues with a pLDDT (b-factor) above this value are considered high confidence.

70.0
min_residues PositiveInt

The minimum number of high-confidence residues required to keep the structure.

0
max_residues PositiveInt

The maximum number of high-confidence residues required to keep the structure.

10000000

ConfidenceFilterResult dataclass

Result of filtering AlphaFoldDB structures based on confidence (pLDDT).

Parameters:

Name Type Description Default
input_file str

The name of the mmcif/PDB file that was processed.

required
count PositiveInt

The number of residues with a pLDDT above the confidence threshold.

required
filtered_file Path | None

The path to the filtered mmcif/PDB file, if passed filter.

None

filter_file_on_confidence(file, query, filtered_dir, copy_method='copy')

Filter a single AlphaFoldDB structure file (.pdb[.gz], .cif[.gz]) based on confidence.

Parameters:

Name Type Description Default
file Path

The path to the PDB file to filter.

required
query ConfidenceFilterQuery

The confidence filter query.

required
filtered_dir Path

The directory to save the filtered PDB file.

required
copy_method CopyMethod

How to copy when no residues have to be removed.

'copy'

Returns:

Type Description
ConfidenceFilterResult

result with filtered_file property set to Path where filtered PDB file is saved. or None if structure was filtered out.

filter_files_on_confidence(alphafold_pdb_files, query, filtered_dir, copy_method='copy', scheduler_address=None)

Filter AlphaFoldDB structures based on confidence.

Parameters:

Name Type Description Default
alphafold_pdb_files list[Path]

List of mmcif/PDB files from AlphaFoldDB to filter.

required
query ConfidenceFilterQuery

The confidence filter query containing the confidence thresholds.

required
filtered_dir Path

Directory where the filtered mmcif/PDB files will be saved.

required
copy_method CopyMethod

How to copy when a direct copy is possible.

'copy'
scheduler_address SchedulerAddress

The address of the Dask scheduler. If not provided, will create a local cluster. If set to sequential will run tasks sequentially.

None

Returns:

Type Description
list[ConfidenceFilterResult]

For each mmcif/PDB files returns whether it was filtered or not, and number of residues with pLDDT above the confidence threshold.

filter_out_low_confidence_residues(structure, allowed_residues)

Filter out residues from the structure that do not have high confidence.

Parameters:

Name Type Description Default
structure Structure

The AlphaFoldDB structure to filter.

required
allowed_residues set[int]

The set of residue sequence numbers to keep.

required

Returns:

Type Description
Structure

A new AlphaFoldDB structure with low confidence residues removed.

filter_structure_on_confidence(structure, file, query, filtered_dir, copy_method='copy')

Filter a single AlphaFoldDB structure file (.pdb[.gz], .cif[.gz]) based on confidence.

Parameters:

Name Type Description Default
structure Structure

The AlphaFoldDB structure to filter, already read from file into memory.

required
file Path

The path to the PDB file to filter.

required
query ConfidenceFilterQuery

The confidence filter query.

required
filtered_dir Path

The directory to save the filtered PDB file.

required
copy_method CopyMethod

How to copy when no residues have to be removed.

'copy'

Returns:

Type Description
ConfidenceFilterResult

result with filtered_file property set to Path where filtered PDB file is saved. or None if structure was filtered out.

find_high_confidence_residues(structure, confidence)

Find residues in the structure with pLDDT confidence above the given threshold.

Parameters:

Name Type Description Default
structure Structure

The AlphaFoldDB structure to search.

required
confidence float

The confidence threshold (pLDDT) to use for filtering.

required

Yields:

Type Description
Generator[int]

The sequence numbers of residues with pLDDT above the confidence threshold.