Skip to content

Commit 7b2c4ac

Browse files
authored
Merge pull request #347 from bigict/data
feat: residue_constants.is_std -> bool
2 parents f758567 + c84b8ee commit 7b2c4ac

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

profold2/common/residue_constants.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ def make_bond_key(atom1_name, atom2_name):
954954
rna_gap_idx = -1
955955
del restype_from_idx
956956

957-
def moltype(mol_idx):
957+
def moltype(mol_idx: int) -> int:
958958
if dna_from_idx <= mol_idx <= dna_to_idx or mol_idx == dna_gap_idx: # dna gap .
959959
return DNA
960960
elif rna_from_idx <= mol_idx <= rna_to_idx or mol_idx == rna_gap_idx: # rna gap *
@@ -967,7 +967,7 @@ def moltype(mol_idx):
967967
unk_restype_index = restype_num # Catch-all index for unknown restypes.
968968

969969

970-
def is_aa(restype):
970+
def is_aa(restype: int) -> bool:
971971
return moltype(restype) == PROT
972972

973973

@@ -1076,6 +1076,11 @@ def sequence_to_onehot(
10761076
unk_dnatype = 'DX'
10771077
unk_rnatype = 'X'
10781078

1079+
1080+
def is_std(resname: str) -> bool:
1081+
return restype_3to1.get(resname, unk_restype) == unk_restype
1082+
1083+
10791084
resnames = [restype_1to3[(r, moltype(i))]
10801085
for i, r in enumerate(restypes)] + [(unk_restype, PROT)]
10811086
resname_to_idx = {resname: i for i, resname in enumerate(resnames)}

0 commit comments

Comments
 (0)