files: Reading and writing files

fetch_file(url, name, session, minimum_file_size=None, save_dir='', save_name='', uncompress=False, ignore_cache=False)

This is a helper routine for fetching files using an http url. It caches fetched files, uses cached files when available, and supports decompressing files.

A fetched non-local file that doesn’t get cached will be
removed when Chimera exits
If ‘ignore_cache’ is True, then cached files will not be used,
but the fetched file will still be cached.
fetch_from_database(id, dbname, session)

Fetch a database entry with a specified id code and return a list of models. The models are not added to the scene. The allowed databases are those registered with the register_fetch_database() routine.

register_fetch_database(dbname, fetch_func, example_id, home_page, info_url, session)

Register a database so that files can be fetched using the fetch_from_database() routine. The fetching function takes a single argument, the entry identifier (a string) and returns a list of models.

file_readers(session)

Return a list of file readers, each reader being represented by 3-tuple consisting of a file type name, a list of recognized suffixes, and a function that opens that file type give a path. The funtion returns a list of models which have not been added to the scene.

open_files(paths, session, set_camera=None)

Open data files and add the models created to the scene. The file types are recognized using the file suffix as listed in the list returned by file_readers().

open_map(map_path, session)

Open a density map file having any of the known density map formats.

open_session(path, session)

Open a session file. The current session is closed.

read_python(path, session)

Read a Python file and execute the code.

save_image(path, session, width=None, height=None, format=None, supersample=None, log_info=True)

Save an image of the current graphics window contents.

save_session(session)

Save a session file using the session file path of the last loaded session, or if no session has been loaded then show a dialog to get the save path.

open_autopack_results(path, session)

Open an Autopack results files (.apr suffix) and create surfaces for each component of the model.

read_swc(path, session)

Read a Stockley-Wheal-Cannon (SWC) format traced neuron file and create a fake molecule model using atoms and bonds to represent the neuron.

restore_session(path, session)

Restore a session.

save_session(path, session)

Save a session.

session_state(session, attributes_only=False)

Create a dictionary representing a session including molecule models, surface models, density map models and scenes. This dictionary is written to a Python file as a session. It contains only basic Python types: numbers, strings, booleans, tuples, lists, dictionaries.

Previous topic

commands: Commands and keyboard shortcuts

Next topic

geometry: Points and coordinate systems

This Page