Skip to content

utils

chain_id_generator

chain_id_generator() -> Generator[str, None, None]

Provide a generator which produces all combinations of chain ID strings

Returns The generator producing a maximum 2 character string where single characters are exhausted, first in uppercase, then in lowercase

Source code in symdesign/structure/utils.py
17
18
19
20
21
22
23
24
25
26
27
28
29
def chain_id_generator() -> Generator[str, None, None]:
    """Provide a generator which produces all combinations of chain ID strings

    Returns
        The generator producing a maximum 2 character string where single characters are exhausted,
            first in uppercase, then in lowercase
    """
    # Todo
    #  Some PDB file use numeric chains... so chain 1 for instance couldn't be parsed correctly
    return (first + second for modification in ['upper', 'lower']
            for first in [''] + list(getattr(available_letters, modification)())
            for second in list(getattr(available_letters, 'upper')()) +
            list(getattr(available_letters, 'lower')()))

parse_stride

parse_stride(stride_file, **kwargs)

From a Stride file, parse information for residue level secondary structure assignment

Sets

self.secondary_structure

Source code in symdesign/structure/utils.py
52
53
54
55
56
57
58
59
60
61
def parse_stride(stride_file, **kwargs):
    """From a Stride file, parse information for residue level secondary structure assignment

    Sets:
        self.secondary_structure
    """
    with open(stride_file, 'r') as f:
        stride_output = f.readlines()

    return ''.join(line[24:25] for line in stride_output if line[0:3] == 'ASG')