DatabaseStorageManager

class DatabaseStorageManager(hdf5_filepath, storage_name, force_new=False)[source]

Database hdf5 storage manager.

Constructor for storage manager.

Parameters
  • hdf5_filepath (str) – Path to hdf5 file

  • storage_name (str) – Storage database name. Must match the one in storage file.

  • force_new (bool) – If file exists the override it for new construction

Attributes

active_elements

Active storage elements that can be used.

element_state

Cached states per storage element.

has_accs

True if database storage contains sequence accessions, False otherwise.

has_align

True if database storage contains alignments, False otherwise.

has_repseq

True if database storage contains reference sequences, False otherwise.

has_tax

True if database storage contains reference taxonomy, False otherwise.

has_tree

True if database storage contains reference phylogeny, False otherwise.

hdf5_filepath

Path to hdf5 file.

repseq_ids

The rids present in the storage.

state

State of the storage manager.

storage_name

Storage database name/label.

summary

Cached storage database summary table.

taxon_ids

The tids present in the storage.

Methods

commit_to_storage(element_key, product_generator)

This is a primary function that commit changes to the storage.

compress_storage([complevel, complib, overwrite])

Compresses the storage file using the required parameters.

get_element_data_by_ids(element_key, ids)

Get partial data from storage element by ids.

get_index_by_element(element_key[, condition])

Get index of target storage element.

imprint_database(stamp_dict)

This is the final function that _local constructor must call.

initiate_memory_cache([level])

Load various elements based on level from storage to the memory for rapid data access.

retrieve_data_by_element(element_key[, …])

Retrieves data from storage element as whole or in chunks.

shutdown()

Shutdown the database and mark cache clean for garbage collector.

validate_storage(hdf5_filepath, storage_name)

Validates storage hdf5 file.