Skip to content

Modifying asym chain name rule #290

@Bae-SungHan

Description

@Bae-SungHan

Hi

I'd like to suggest new asym chain naming rule while saving predicted structure as mmcif files.
In current version, asym chain is named as like;

i + 1: chr(i + 65) for i in range(len(feature_context.chains))

The problem occurs when the number of entity is over 26, the number of alphabet.
For 27th to 32th entities, the name of the given chain is special characters such like [ \ ] ^ _ ` instead of lowercase alphabet letters.
I think it's not what you intended.
So I want to suggest to change the chain naming part as below;

import string
import itertools

def alphabet_generator():
    N = 1
    while True:
        for case in ["upper", "lower"]:
            letters = (
                string.ascii_uppercase if case == "upper" else string.ascii_lowercase
            )
            for chars in itertools.product(letters, repeat=N):
                yield "".join(chars)
        N += 1

...

generator = alphabet_generator()
asym_entity_names={i + 1: next(generator) for i in range(len(feature_context.chains))}

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions