Skip to content

ss

Module for dealing with secondary structure.

SecondaryStructureFilterQuery dataclass

Query object to filter on secondary structure.

Parameters:

Name Type Description Default
abs_min_helix_residues PositiveInt | None

Minimum number of residues in helices (absolute).

None
abs_max_helix_residues PositiveInt | None

Maximum number of residues in helices (absolute).

None
abs_min_sheet_residues PositiveInt | None

Minimum number of residues in sheets (absolute).

None
abs_max_sheet_residues PositiveInt | None

Maximum number of residues in sheets (absolute).

None
ratio_min_helix_residues Ratio | None

Minimum number of residues in helices (relative).

None
ratio_max_helix_residues Ratio | None

Maximum number of residues in helices (relative).

None
ratio_min_sheet_residues Ratio | None

Minimum number of residues in sheets (relative).

None
ratio_max_sheet_residues Ratio | None

Maximum number of residues in sheets (relative).

None

is_actionable()

Check if the secondary structure query has any actionable filters.

Returns:

Type Description
bool

True if any of the filters are set, False otherwise.

SecondaryStructureFilterResult dataclass

Result of filtering on secondary structure.

Parameters:

Name Type Description Default
stats SecondaryStructureStats

The secondary structure statistics.

required
passed bool

Whether the structure passed the filtering criteria.

False

SecondaryStructureStats dataclass

Statistics about the secondary structure of a protein.

Parameters:

Name Type Description Default
nr_residues PositiveInt

Total number of residues in the structure.

required
nr_helix_residues PositiveInt

Number of residues in helices.

required
nr_sheet_residues PositiveInt

Number of residues in sheets.

required
helix_ratio Ratio

Ratio of residues in helices.

required
sheet_ratio Ratio

Ratio of residues in sheets.

required

filter_file_on_secondary_structure(file_path, query)

Filter a structure file based on secondary structure criteria.

Parameters:

Name Type Description Default
file_path Path

The path to the structure file to analyze.

required
query SecondaryStructureFilterQuery

The filtering criteria to apply.

required

Returns:

Type Description
SecondaryStructureFilterResult

Filtering statistics and whether file passed.

filter_files_on_secondary_structure(file_paths, query)

Filter multiple structure files based on secondary structure criteria.

Parameters:

Name Type Description Default
file_paths Iterable[Path]

A list of paths to the structure files to analyze.

required
query SecondaryStructureFilterQuery

The filtering criteria to apply.

required

Yields:

Type Description
Generator[tuple[Path, SecondaryStructureFilterResult]]

For each file returns the filtering statistics and whether structure passed.

filter_on_secondary_structure(structure, query)

Filter a structure based on secondary structure criteria.

Parameters:

Name Type Description Default
structure Structure

The gemmi Structure object to analyze.

required
query SecondaryStructureFilterQuery

The filtering criteria to apply.

required

Returns:

Type Description
SecondaryStructureFilterResult

Filtering statistics and whether structure passed.

nr_of_residues_in_helix(structure)

Count the number of residues in alpha helices.

Requires structure to have secondary structure information.

Parameters:

Name Type Description Default
structure Structure

The gemmi Structure object to analyze.

required

Returns:

Type Description
int

The number of residues in alpha helices.

nr_of_residues_in_sheet(structure)

Count the number of residues in beta sheets.

Requires structure to have secondary structure information.

Parameters:

Name Type Description Default
structure Structure

The gemmi Structure object to analyze.

required

Returns:

Type Description
int

The number of residues in beta sheets.

nr_of_residues_in_total(structure)

Count the total number of residues in the structure.

Parameters:

Name Type Description Default
structure Structure

The gemmi Structure object to analyze.

required

Returns:

Type Description
int

The total number of residues in the structure.