Skip to content

Commit ddc24dc

Browse files
authored
Update inputs.py (#91)
1 parent 673989d commit ddc24dc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

alphafold3_pytorch/inputs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,10 +1465,11 @@ def pdb_input_to_molecule_input(pdb_input: PDBInput, training: bool = True) -> M
14651465

14661466
molecule_type_row_idx = slice(molecule_idx, molecule_idx + num_atoms)
14671467

1468-
is_molecule_types[molecule_type_row_idx, IS_BIOMOLECULE_INDICES] = False
1468+
# NOTE: we reset all type annotations e.g., since ions are initially considered ligands
1469+
is_molecule_types[molecule_type_row_idx] = False
14691470

14701471
if num_atoms == 1:
1471-
# NOTE: we manually set the molecule ID of ions to the `gap` ID
1472+
# NOTE: we manually set the molecule ID of ions to a dedicated category
14721473
molecule_ids[molecule_idx] = MOLECULE_METAL_ION_ID
14731474
is_mol_type_index = IS_METAL_ION_INDEX
14741475
else:
@@ -1568,7 +1569,7 @@ def pdb_input_to_molecule_input(pdb_input: PDBInput, training: bool = True) -> M
15681569
ligand_offset += chain_len
15691570

15701571
# ensure mmCIF polymer-ligand (i.e., protein/RNA/DNA-ligand) and ligand-ligand bonds
1571-
# (and bonds less than 2.4 Å) are installed in `MoleculeInput` during training onlytraining
1572+
# (and bonds less than 2.4 Å) are installed in `MoleculeInput` during training only
15721573
# per the AF3 supplement (Table 5, `token_bonds`)
15731574
bond_atom_indices = defaultdict(int)
15741575
for bond in biomol.bonds:
@@ -1619,6 +1620,7 @@ def pdb_input_to_molecule_input(pdb_input: PDBInput, training: bool = True) -> M
16191620
f"Could not find a matching token index for token1 {ptnr1_atom_id} due to: {e}. "
16201621
"Skipping installing the current bond associated with this token."
16211622
)
1623+
continue
16221624
try:
16231625
col_idx = get_token_index_from_composite_atom_id(
16241626
biomol,
@@ -1633,6 +1635,7 @@ def pdb_input_to_molecule_input(pdb_input: PDBInput, training: bool = True) -> M
16331635
f"Could not find a matching token index for token2 {ptnr1_atom_id} due to: {e}. "
16341636
"Skipping installing the current bond associated with this token."
16351637
)
1638+
continue
16361639
token_bonds[row_idx, col_idx] = True
16371640
token_bonds[col_idx, row_idx] = True
16381641
bond_atom_indices[ptnr1_atom_id] += 1

0 commit comments

Comments
 (0)