atomium.pdb

Contains functions for dealing with the .mmtf file format.

atomium.pdb.add_atom_to_non_polymer(line, model, res_id, aniso_dict)[source]

Takes an .pdb ATOM or HETATM record, converts it, and adds it to a non-polymer dictionary.

Parameters:
  • line (dict) – the line to read.
  • model (dict) – the model to update.
  • res_id (str) – the molecule ID to add to.
  • aniso_dict (dict) – lookup dictionary for anisotropy information.
atomium.pdb.add_atom_to_polymer(line, model, chain_id, res_id, aniso_dict)[source]

Takes an .pdb ATOM or HETATM record, converts it, and adds it to a polymer dictionary.

Parameters:
  • line (dict) – the line to read.
  • model (dict) – the model to update.
  • chain_id (str) – the chain ID to add to.
  • res_id (str) – the molecule ID to add to.
  • aniso_dict (dict) – lookup dictionary for anisotropy information.
atomium.pdb.assembly_lines_to_assembly_dict(lines)[source]

Takes the lines representing a single biological assembly and turns them into an assembly dictionary.

Parameters:lines (list) – The REMARK lines to read.
Return type:dict
atomium.pdb.atom_line_to_dict(line, aniso_dict)[source]

Converts an ATOM or HETATM record to an atom dictionary.

Parameters:
  • line (str) – the record to convert.
  • aniso_dict (dict) – the anisotropy dictionary to use.
Return type:

dict

atomium.pdb.atom_to_anisou_line(a, name, res_name, chain_id, res_id, insert)[source]

Converts an Atom to an ANISOU record.

Parameters:
  • a (Atom) – The Atom to pack.
  • name (str) – The atom name to use.
  • res_name (str) – The residue name to use.
  • chain_id (str) – The chain ID to use.
  • res_id (str) – The residue ID to use.
  • insert (str) – The residue insert code to use.
Return type:

str

atomium.pdb.extract_assembly_remark(pdb_dict, geometry_dict)[source]

Takes a dict and adds assembly information to it by parsing REMARK 350 lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • geometry_dict (dict) – the dict to update.
atomium.pdb.extract_authors(pdb_dict, description_dict)[source]

Takes a dict and adds header information to it by parsing the AUTHOR line.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • description_dict (dict) – the dict to update.
atomium.pdb.extract_header(pdb_dict, description_dict)[source]

Takes a dict and adds header information to it by parsing the HEADER line.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • description_dict (dict) – the dict to update.
atomium.pdb.extract_keywords(pdb_dict, description_dict)[source]

Takes a dict and adds header information to it by parsing the KEYWDS line.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • description_dict (dict) – the dict to update.
atomium.pdb.extract_resolution_remark(pdb_dict, quality_dict)[source]

Takes a dict and adds resolution information to it by parsing REMARK 2 lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • quality_dict (dict) – the dict to update.
atomium.pdb.extract_rvalue_remark(pdb_dict, quality_dict)[source]

Takes a dict and adds resolution information to it by parsing REMARK 3 lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • quality_dict (dict) – the dict to update.
atomium.pdb.extract_source(pdb_dict, experiment_dict)[source]

Takes a dict and adds source information to it by parsing SOURCE lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • experiment_dict (dict) – the dict to update.
atomium.pdb.extract_technique(pdb_dict, experiment_dict)[source]

Takes a dict and adds technique information to it by parsing EXPDTA lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • experiment_dict (dict) – the dict to update.
atomium.pdb.extract_title(pdb_dict, description_dict)[source]

Takes a dict and adds header information to it by parsing the TITLE lines.

Parameters:
  • pdb_dict (dict) – the dict to read.
  • description_dict (dict) – the dict to update.
atomium.pdb.get_last_ter_line(model_lines)[source]

Gets the index of the last TER record in a list of records. 0 will be returned if there are none.

Parameters:model_lines (list) – the lines to search.
Return type:int
atomium.pdb.id_from_line(line)[source]

Creates a residue ID from an atom line.

Parameters:line (str) – the ATOM or HETATM line record.
Return type:str
atomium.pdb.make_aniso(model_lines)[source]

Creates a mapping of chain IDs to anisotropy, by parsing ANISOU records.

Parameters:pdb_dict (dict) – the .pdb dictionary to read.
Return type:dict
atomium.pdb.make_sequences(pdb_dict)[source]

Creates a mapping of chain IDs to sequences, by parsing SEQRES records.

Parameters:pdb_dict (dict) – the .pdb dictionary to read.
Return type:dict
atomium.pdb.merge_lines(lines, start, join=' ')[source]

Gets a single continuous string from a sequence of lines.

Parameters:
  • lines (list) – The lines to merge.
  • start (int) – The start point in each record.
  • join (str) – The string to join on.
Return type:

str

atomium.pdb.pdb_dict_to_data_dict(pdb_dict)[source]

Converts an .pdb dictionary into an atomium data dictionary, with the same standard layout that the other file formats get converted into.

Parameters:pdb_dict (dict) – the .pdb dictionary.
Return type:dict
atomium.pdb.pdb_string_to_pdb_dict(filestring)[source]

Takes a .pdb filestring and turns into a dict which represents its record structure. Only lines which aren’t empty are used.

The resultant dictionary has line types as the keys, which point to the lines as its value. So {"TITLE": ["TITLE line 1", "TITLE line 2"]} etc.

The exceptions are the REMARK records, where there is a sub-dictionary with REMARK numbers as keys, and the structure records themselves which are just arranged into lists - one for each model.

Parameters:filestring (str) – the .pdb filestring to process.
Return type:dict
atomium.pdb.structure_to_pdb_string(structure)[source]

Converts a AtomStructure to a .pdb filestring.

Parameters:structure (AtomStructure) – the structure to convert.
Return type:str
atomium.pdb.update_description_dict(pdb_dict, data_dict)[source]

Creates the description component of a standard atomium data dictionary from a .pdb dictionary.

Parameters:
  • pdb_dict (dict) – The .pdb dictionary to read.
  • data_dict (dict) – The data dictionary to update.
atomium.pdb.update_dict(d, key, value)[source]

Takes a dictionary where the values are lists, and adds a value to one of the lists at the specific key. If the list doesn’t exist, it creates it first.

The dictionary is changed in place.

Parameters:
  • d (dict) – the dictionary to update.
  • key (str) – the location of the list.
  • value (str) – the value to add to the list.
atomium.pdb.update_experiment_dict(pdb_dict, data_dict)[source]

Creates the experiment component of a standard atomium data dictionary from a .pdb dictionary.

Parameters:
  • pdb_dict (dict) – The .pdb dictionary to update.
  • data_dict (dict) – The data dictionary to update.
atomium.pdb.update_geometry_dict(pdb_dict, data_dict)[source]

Creates the geometry component of a standard atomium data dictionary from a .pdb dictionary.

Parameters:
  • pdb_dict (dict) – The .pdb dictionary to update.
  • data_dict (dict) – The data dictionary to update.
atomium.pdb.update_quality_dict(pdb_dict, data_dict)[source]

Creates the quality component of a standard atomium data dictionary from a .pdb dictionary.

Parameters:
  • pdb_dict (dict) – The .pdb dictionary to update.
  • data_dict (dict) – The data dictionary to update.