enrichment_api package

Subpackages

Submodules

enrichment_api.enrichment_builder module

class enrichment_api.enrichment_builder.BaseEnrichmentBuilder(enrichment_helper: EnrichmentHelper, study: WDAEStudy)[source]

Bases: object

Base class for enrichment builders.

abstract build(gene_syms: Iterable[str], background_id: str | None, counting_id: str | None) list[dict[str, Any]][source]
class enrichment_api.enrichment_builder.EnrichmentBuilder(enrichment_helper: EnrichmentHelper, study: WDAEStudy)[source]

Bases: BaseEnrichmentBuilder

Build enrichment tool test.

build(gene_syms: Iterable[str], background_id: str | None, counting_id: str | None) list[dict[str, Any]][source]
build_results(gene_syms: Iterable[str], background_id: str | None, counting_id: str | None) list[dict[str, Any]][source]

Build and return a list of enrichment results.

Returns:

A list of dictionaries representing the enrichment results.

enrichment_api.enrichment_helper module

class enrichment_api.enrichment_helper.EnrichmentHelper(grr: GenomicResourceRepo, study: WDAEStudy)[source]

Bases: object

Helper class to create enrichment tool for a genotype data.

calc_enrichment_test(psc_id: str, gene_syms: Iterable[str], effect_groups: Iterable[str] | Iterable[Iterable[str]], background_id: str | None = None, counter_id: str | None = None) dict[str, dict[str, EnrichmentResult]][source]

Perform enrichment test for a genotype data.

collect_genotype_data_backgrounds() list[BaseEnrichmentBackground][source]

Collect enrichment backgrounds configured for a genotype data.

create_background(background_id: str) BaseEnrichmentBackground[source]

Construct and return an enrichment background.

create_counter(counter_id: str) CounterBase[source]

Create counter for a genotype data.

get_default_background_model() str[source]

Return default background model field from the enrichment config. If it is missing, default to the first selected background model.

get_default_counting_model() str[source]
get_selected_counting_models() list[str][source]

Return selected counting models field from the enrichment config. If it is missing, default to the counting field.

get_selected_person_set_collections() str[source]

Return selected person set collections field from the enrichment config. If it is missing, default to the first available person set collection in the provided study.

enrichment_api.enrichment_serializer module

class enrichment_api.enrichment_serializer.EnrichmentSerializer(enrichment_config: dict[str, Any], results: list[dict[str, Any]])[source]

Bases: EffectTypesMixin

Serializer for enrichment tool results.

serialize() list[dict][source]
serialize_all(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult) dict[str, Any][source]
serialize_common_filter(grouping_results: dict[str, dict[str, EnrichmentSingleResult]], effect_type: str, _result: EnrichmentSingleResult, gender: list[str] | None = None) dict[str, Any][source]

Serialize common filter.

serialize_enrichment_result(result: EnrichmentSingleResult) dict[str, Any][source]

Serialize enrichment result.

serialize_female(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult) dict[str, Any][source]
serialize_male(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult) dict[str, Any][source]
serialize_overlap_filter(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult, *, gender: list[str] | None = None, overlapped_genes: bool = False) dict[str, Any][source]

Serialize overlapped events filter.

serialize_people_groups(grouping_results: dict[str, Any]) dict[str, Any][source]

Serialize people group results.

serialize_rec(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult) dict[str, Any][source]

Serialize recurrent events.

serialize_rec_filter(grouping_results: dict[str, Any], effect_type: str, result: EnrichmentSingleResult, gender: list[str] | None = None) dict[str, Any][source]

Serialize recurrent events filter.

enrichment_api.urls module

enrichment_api.views module

class enrichment_api.views.EnrichmentModelsView[source]

Bases: QueryBaseView

Select enrichment models view.

get(_request: Request, dataset_id: str) Response[source]

Return enrichment configuration prepared for choosing.

class enrichment_api.views.EnrichmentTestView[source]

Bases: QueryBaseView

View for running enrichment testing.

enrichment_description(query: dict[str, Any]) str[source]

Build enrichment result description.

post(request: Request) Response[source]

Run the enrichment test and return the result.

Module contents