atomium.files.utilities

This module contains various utility functions for dealing with files.

atomium.files.utilities.determine_file_type(path, filestring)[source]

Takes a file path and contents, and uses them to work out which of the known filetypes it should be interpreted as. File extensions will always be believed, and if that can’t be used, contents will be examined and a guess made.

Parameters:
  • path (str) – The structure file path.
  • filestring (str) – The structure file contents.
Return type:

str

atomium.files.utilities.open(path, *args, **kwargs)[source]

Opens a structure file at the given path on disk. Supported filetypes are .pdb, .cif, and .xyz - if another file extension (or no extension) is given, atomium will use the filecontents to try and guess the format.

Parameters:path (str) – The location of the file on disk.
Return type:Container