Skip to content

Instantly share code, notes, and snippets.

View pengzhangzhi's full-sized avatar
:bowtie:
thinking

Fred pengzhangzhi

:bowtie:
thinking
View GitHub Profile
def renum_pdb_str(pdb_str, Ls=None, renum=True, offset=1):
from string import ascii_uppercase, ascii_lowercase
assert len(Ls) == 2
Ls = [int(i) for i in Ls]
alphabet_list = list(ascii_uppercase+ascii_lowercase)
if Ls is not None:
L_init = 0
new_chain = {}
for L,c in zip(Ls, alphabet_list):
new_chain.update({i:c for i in range(L_init,L_init+L)})