TEMPy.protein.structure_parser

class TEMPy.protein.structure_parser.PDBParser[source]

A class to read PDB files either directly from the pdb or a structure instance from Biopython

static fetch_PDB(structure_id, local_filename, hetatm=False, water=False)[source]

Fetch PDB file from the PDB and create Structure instance based upon it.

Uses the Gemmi library to parse the input PDB file.

Parameters:
  • structure_id – structure_id code of pdb file

  • local_filename – Filename for locally saved the fetched pdb file

  • hetatm – If True, HETATM atoms are included in the Structure instance returned after parsing. If False, HETATM atoms are ignored.

  • water – If True, HETATM, water atoms are included in the Structure instance instance returned after parsing. If False, HETATM atoms are ignored.

Returns:

Parsed structure.

Return type:

Structure instance

static read_PDB_file(structure_id, filename, hetatm=False, water=False, chain=None)[source]

Read PDB file and create Structure instance.

Uses the Gemmi library to parse the input PDB file.

Parameters:
  • structure_id – structure_id code of pdb file

  • filename – Filename (path) of pdb file

  • hetatm – If True, HETATM atoms are included in the Structure instance returned after parsing. If False, HETATM atoms are ignored.

  • water – If True, HETATM, water atoms are included in the Structure instance instance returned after parsing. If False, HETATM atoms are ignored.

Returns:

Parsed structure.

Return type:

Structure instance

static write_sasd_to_pdb(dens_map, sasds, pdb)[source]

Write solvent accessible distances to a PDB file.

The output text file has the default name "./Jwalk_results/{pdb_code}_crosslinks.pdb", where pdb_code is, for example, 3agy for PDB file with name 3agy.pdb.

Parameters:
  • dens_map – Solvent accessible surface on masked array

  • sasds – Dictionary of sasds

  • pdb – pdb file sasds were calculated on

static write_sasd_to_txt(sasds, pdb)[source]

Write solvent accessible distances to a text (.txt) file.

The output text file has the default name "./Jwalk_results/{pdb_code}_crosslinks.pdb", where pdb_code is, for example, 3agy for PDB file with name 3agy.pdb.

Parameters:
  • sasds – Dictionary of sasds

  • pdb – PDB file sasds were calculated on

class TEMPy.protein.structure_parser.mmCIFParser(filename)[source]

Class for parsing mmCIF files using the GEMMI library.

All functions contained in the mmCIFParser class are “staticmethods”, meaning an object does not need to initiated before using the methods, as shown in the code examples.

static fetch_mmCIF(structure_id, local_filename, hetatm=False, water=False)[source]

Fetch an mmCIF file from the Protein Data Bank, and use it to generate a Structure instance.

Uses the Gemmi library to parse the input PDB file.

Parameters:
  • structure_id – structure_id code of pdb file, e.g. 3agy

  • local_filename – Filename for locally saved the fetched mmCIF file

  • hetatm – If True, HETATM atoms are included in the Structure instance returned after parsing. If False, HETATM atoms are ignored.

  • water – If True, HETATM, water atoms are included in the Structure instance instance returned after parsing. If False, HETATM atoms are ignored.

Returns:

Parsed structure.

Return type:

Structure instance

static read_mmCIF_file(filename, hetatm=False, water=False)[source]

Read an mmCIF file to generate a Structure instance.

Uses the Gemmi library to parse the input PDB file.

Parameters:
  • filename – Path to the input file

  • hetatm – If True, HETATM atoms are included in the Structure instance returned after parsing. If False, HETATM atoms are ignored.

  • water – If True, HETATM, water atoms are included in the Structure instance instance returned after parsing. If False, HETATM atoms are ignored.

Returns:

Parsed structure.

Return type:

Structure instance