dae.gene_profile package

Submodules

dae.gene_profile.convert_gene_profile_to_duckdb module

dae.gene_profile.convert_gene_profile_to_duckdb.main(gpf_instance: GPFInstance | None = None, argv: list[str] | None = None) None[source]

Simple gpdb converter from sqlite to duckdb.

dae.gene_profile.db module

class dae.gene_profile.db.GeneProfileDB(configuration: Box | dict | None, dbfile: str)[source]

Bases: object

Class for managing the gene profile database.

Uses SQLite for DB management and supports loading and storing to filesystem. Has to be supplied a configuration and a path to which to read/write the SQLite DB.

PAGE_SIZE = 50
get_gp(gene_symbol: str) GPStatistic | None[source]

Query a GP by gene_symbol and return the row as statistic.

Returns None if gene_symbol is not found within the DB.

gp_from_table_row(row: dict) dict[source]

Build an GPStatistic from internal DB row.

gp_from_table_row_single_view(row: dict) GPStatistic[source]

Create an GPStatistic from single view row.

list_symbols(page: int, symbol_like: str | None = None) list[str][source]

Perform paginated query and return list of gene symbols.

Parameters:

page - Which page to fetch. symbol_like - Which gene symbol to search for, supports incomplete search

query_gps(page: int, symbol_like: str | None = None, sort_by: str | None = None, order: str | None = None) list[source]

Perform paginated query and return list of GPs.

Parameters:

page - Which page to fetch. symbol_like - Which gene symbol to search for, supports incomplete search sort_by - Column to sort by order - “asc” or “desc”

class dae.gene_profile.db.GeneProfileDBWriter(configuration: Box | dict | None, dbfile: str)[source]

Bases: object

Class for managing the gene profile database.

Uses SQLite for DB management and supports loading and storing to filesystem. Has to be supplied a configuration and a path to which to read/write the SQLite DB.

classmethod build_configuration(configuration: Box | dict | None) dict[source]

Perform a transformation on a given configuration.

The configuration is transformed to an internal version with more specific information on order and ranks.

drop_gp_table() None[source]
gp_table_exists() bool[source]

Checks if gp table exists

insert_gp(gp: GPStatistic, connection: DuckDBPyConnection | None = None) None[source]

Insert a GP into the DB.

insert_gps(gps: list[GPStatistic]) None[source]

Insert multiple GPStatistics into the DB.

update_gps_with_values(gs_values: dict[str, Any]) None[source]

Update gp statistic with values

dae.gene_profile.exporter module

dae.gene_profile.exporter.cli_export(argv: list[str] | None = None, gpf_instance: GPFInstance | None = None) None[source]

CLI for exporting GP data.

dae.gene_profile.generate_gene_profile module

dae.gene_profile.generate_gene_profile.add_variant_count(variant: FamilyVariant, variant_counts: dict[str, Any], person_set: str, statistic_id: str, effect_types: set[str] | None) None[source]

Increment count for specific variant.

dae.gene_profile.generate_gene_profile.calculate_table_values(instance: GPFInstance, variant_counts: dict[str, Any], dataset_id: str, filters: Box) dict[str, Any][source]

Calculate GP variant counts and return a SQLite update mapping.

dae.gene_profile.generate_gene_profile.collect_variant_counts(variant_counts: dict[str, Any], variants: Iterable[FamilyVariant], dataset_id: str, config: Box, person_ids: dict[str, Any], *, denovo_flag: bool) None[source]

Collect variant gene counts for a given dataset.

dae.gene_profile.generate_gene_profile.count_variant(v: FamilyVariant, dataset_id: str, variant_counts: dict[str, Any], config: Box, person_ids: dict[str, Any], *, denovo_flag: bool) None[source]

Count variant.

dae.gene_profile.generate_gene_profile.generate_gp(gpf_instance: GPFInstance, gene_symbol: str, collections_gene_sets: list[tuple[str, GeneSet]]) tuple[str, GPStatistic][source]

Generate GP.

dae.gene_profile.generate_gene_profile.main(gpf_instance: GPFInstance | None = None, argv: list[str] | None = None) None[source]

Entry point for the generate GP script.

dae.gene_profile.statistic module

class dae.gene_profile.statistic.GPStatistic(gene_symbol: str, gene_sets: List[str], gene_scores: dict, variant_counts: dict)[source]

Bases: object

Class representing GP statistics.

Used as a medium between the DB and the API.

to_json()[source]

Module contents