Skip to content

io

infill_chain_idx(chain_idx)

Infill the chain index tensor to fill in the gaps.

pdb_to_xyz(filename)

Parse a PDB file and return a tensor containing 3D coordinates of atoms.

Parameters:

Name Type Description Default
filename str

Path to a PDB file.

required

Returns:

Name Type Description
atom_xyz torch.Tensor

A xyz coordinate tensor. Shape (n_residues, MAX_N_ATOMS_PER_RESIDUE, 3).

atom_mask torch.BoolTensor

A mask tensor. 1 if the corresponding atom exists, 0 otherwise. Shape (n_residues, MAX_N_ATOMS_PER_RESIDUE)

chain_idx torch.LongTensor

A LongTensor containing chain indices per residue. Shape (n_residues,)

chain_ids List[str]

A list of unique chain IDs in the order of integers appearing in the chain_idx tensor.

seq Dict[str, str]

A dictionary mapping chain IDs to amino acid sequences.

Note

MAX_N_ATOMS_PER_RESIDUE is set to 15 by default.

to_pdb(filename, coords, sequences, chain_ids, atoms=['N', 'CA', 'C', 'O', 'CB'])

Save coordinates to a PDB file.

Parameters:

Name Type Description Default
filename str

Path to the output PDB file.

required
coords np.array

Coordinates of shape (5, L, 3), where the first dimension denotes the atom type.

required
atoms List

Defaults to ["N", "CA", "C", "O", "CB"].

['N', 'CA', 'C', 'O', 'CB']