enrichment_api package
Subpackages
- enrichment_api.tests package
- Submodules
- enrichment_api.tests.conftest module
- enrichment_api.tests.test_enrichment_api module
test_enrichment_api_permissions()
test_enrichment_models()
test_enrichment_models_missing_study()
test_enrichment_test_missing_dataset_id()
test_enrichment_test_missing_gene_symbols()
test_enrichment_test_missing_study()
test_enrichment_test_with_gene_score()
test_enrichment_test_with_gene_score_with_zero_range()
test_enrichment_test_with_gene_set()
test_enrichment_test_with_gene_symbols()
- enrichment_api.tests.test_enrichment_builder module
- enrichment_api.tests.test_enrichment_helper_simple module
test_get_default_background_model()
test_get_default_background_model_default()
test_get_selected_counting_models()
test_get_selected_counting_models_default()
test_get_selected_counting_models_default_with_counting()
test_get_selected_person_set_collections()
test_get_selected_person_set_collections_default()
test_get_study_background()
test_get_study_enrichment_config()
test_gpf_fixture()
- enrichment_api.tests.test_enrichment_serializer module
- enrichment_api.tests.test_t4c8_enrichment module
- Module contents
Submodules
enrichment_api.enrichment_builder module
- class enrichment_api.enrichment_builder.BaseEnrichmentBuilder[source]
Bases:
GPFTool
Base class for enrichment builders.
- class enrichment_api.enrichment_builder.EnrichmentBuilder(enrichment_helper: EnrichmentHelper, gene_scores_db: GeneScoresDb, study: WDAEStudy)[source]
Bases:
BaseEnrichmentBuilder
Build enrichment tool test.
- build(gene_syms: list[str] | None, gene_score: dict[str, Any] | None, background_id: str | None, counting_id: str | None) list[dict[str, Any]] [source]
Build enrichment test result
- 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.
- create_enrichment_description(gene_set_id: str | None, gene_score: dict[str, Any] | None, gene_syms: list[str] | None) str [source]
Build enrichment result description.
- static make_tool(study: WDAEAbstractStudy) GPFTool | None [source]
enrichment_api.enrichment_helper module
- class enrichment_api.enrichment_helper.BaseEnrichmentHelper[source]
Bases:
GPFTool
Base helper class to create enrichment helper WDAE study.
- class enrichment_api.enrichment_helper.EnrichmentHelper(grr: GenomicResourceRepo, study: WDAEStudy)[source]
Bases:
BaseEnrichmentHelper
Helper Base helper class to create enrichment helper WDAE study.
- 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_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.
- static make_tool(study: WDAEAbstractStudy) GPFTool | None [source]
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_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.
- class enrichment_api.views.EnrichmentTestView[source]
Bases:
QueryBaseView
View for running enrichment testing.
- enrichment_api.views.create_enrichment_builder(gpf_instance: WGPFInstance, study: WDAEAbstractStudy) BaseEnrichmentBuilder [source]
Create an enrichment builder for the given dataset.
- enrichment_api.views.create_enrichment_helper(gpf_instance: WGPFInstance, study: WDAEAbstractStudy) BaseEnrichmentHelper [source]
Create an enrichment builder for the given dataset.