Skip to content

Commit ea41682

Browse files
authored
Update data_pipeline.py (#288)
1 parent e249290 commit ea41682

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

alphafold3_pytorch/data/data_pipeline.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,18 @@ def make_msa_features(
175175

176176
polymer_residue_index = -1
177177

178+
chemtype_constants_cache = {}
179+
178180
for idx, (chemtype, residue_index) in enumerate(
179181
zip(chain_chemtype, chain_residue_index)
180182
):
181183
is_polymer = chemtype < ligand_chemtype_index
182184
is_ligand = not is_polymer
183185

184-
chem_residue_constants = get_residue_constants(res_chem_index=chemtype)
186+
if chemtype not in chemtype_constants_cache:
187+
chemtype_constants_cache[chemtype] = get_residue_constants(res_chem_index=chemtype)
188+
189+
chem_residue_constants = chemtype_constants_cache[chemtype]
185190

186191
# NOTE: For modified polymer residues, we only increment the polymer residue index
187192
# when the current (atomized) modified polymer residue's atom sequence ends.

0 commit comments

Comments
 (0)