dae.genotype_storage package

Subpackages

Submodules

dae.genotype_storage.genotype_storage module

class dae.genotype_storage.genotype_storage.GenotypeStorage(storage_config: dict[str, Any])[source]

Bases: ABC

Base class for genotype storages.

abstract build_backend(study_config: dict, genome: ReferenceGenome, gene_models: GeneModels) Any[source]

Construct a query backend for this genotype storage.

abstract classmethod get_storage_types() set[str][source]

Return the genotype storage type.

is_read_only() bool[source]
property read_only: bool
abstract shutdown() GenotypeStorage[source]

Frees all resources used by the genotype storage to work.

abstract start() GenotypeStorage[source]

Allocate all resources needed for the genotype storage to work.

classmethod validate_and_normalize_config(config: dict) dict[source]

Normalize and validate the genotype storage configuration.

When validation passes returns the normalized and validated annotator configuration dict.

When validation fails, raises ValueError.

All genotype storage configurations are required to have:

  • “storage_type” - which storage type this configuration is used for;

  • “id” - the ID of the genotype storage instance that will be created.

dae.genotype_storage.genotype_storage_registry module

class dae.genotype_storage.genotype_storage_registry.GenotypeStorageRegistry[source]

Bases: object

Registry for genotype storages.

This class could accept genotype storages config from a GPF instance configuration and instantiate and register all genotype storages defined in this configuration. To do this, one could use GenotypeStorageRegistry.register_storages_configs().

To create and register single genotype storage using its configuration you can use GenotypeStorageRegistry.register_storage_config().

When you have already created an instance of genotype storage, you can use GenotypeStorageRegistry.register_genotype_storage() to register it.

get_all_genotype_storage_ids() list[str][source]

Return list of all registered genotype storage IDs.

get_all_genotype_storages() list[GenotypeStorage][source]

Return list of registered genotype storages.

get_default_genotype_storage() GenotypeStorage[source]

Return the default genotype storage if one is defined.

Otherwise, return None.

get_genotype_storage(storage_id: str) GenotypeStorage[source]

Return genotype storage with specified storage_id.

If the method can not find storage with the specified ID, it will raise ValueError exception.

register_default_storage(genotype_storage: GenotypeStorage) None[source]

Register a genotype storage and make it the default storage.

register_genotype_storage(storage: GenotypeStorage) GenotypeStorage[source]

Register a genotype storage instance.

register_storage_config(storage_config: dict[str, Any]) GenotypeStorage[source]

Create a genotype storage using storage config and registers it.

register_storages_configs(genotype_storages_config: dict[str, Any]) None[source]

Create and register all genotype storages defined in config.

When defining a GPF instance, we specify a genotype_storage section in the configuration. If you pass this whole configuration section to this method, it will create and register all genotype storages defined in that configuration section.

shutdown() None[source]

Module contents

dae.genotype_storage.get_genotype_storage_factory(storage_type: str) Callable[[Dict[str, Any]], GenotypeStorage][source]

Find and return a factory function for creation of a storage type.

If the specified storage type is not found, this function raises ValueError exception.

Returns:

the genotype storage factory for the specified storage type.

Raises:

ValueError – when can’t find a genotype storage factory for the specified storage type.

dae.genotype_storage.get_genotype_storage_types() List[str][source]

Return the list of all registered genotype storage factory types.

dae.genotype_storage.register_genotype_storage_factory(storage_type: str, factory: Callable[[Dict[str, Any]], GenotypeStorage]) None[source]

Register additional genotype storage factory.

By default all genotype storage factories should be registered at [dae.genotype_storage.factories] extenstion point. All registered factories are loaded automatically. This function should be used if you want to bypass extension point mechanism and register addition genotype storage factory programatically.