Query
Documentation
- class pandasaurus.query.Query(seed_list: List[str], enrichment_property_list: List[str] | None = None, force_fail: bool = False)[source]
Query class is responsible for generating a pandas DataFrame that enriches the seed list with synonyms and all inferred subClassOf relationships between terms in the seed. It also allows queries over the DataFrame.
- enriched_df
DataFrame that is enriched with synonyms and inferred relationships between terms in
- the seed. It will be used in further filtered queries.
- ancestor_enrichment(step_count: str) DataFrame [source]
Perform ancestor enrichment analysis with a specified number of hops.
- Parameters:
step_count (str) – The number of hops to consider when enriching terms.
- Returns:
A DataFrame containing enriched terms and associated information.
- Return type:
pd.DataFrame
This method conducts an ancestor enrichment analysis on a set of seed terms, considering the specified number of hops in the ontology graph. The analysis retrieves terms that are ancestors of the seed terms within the specified number of hops and compiles the results into a DataFrame.
The step_count parameter controls the depth of the analysis. A smaller step_count limits the analysis to immediate ancestors, while a larger value includes more distant ancestors.
- contextual_slim_enrichment(context: List[str]) DataFrame [source]
Returns a DataFrame that is enriched with synonyms and inferred relationships between terms in the seed list and in an extended seed list. The extended seed list consists of terms from the seed list and all terms satisfied by some set of existential restrictions in the ubergraph (e.g. part_of some ‘kidney’).
- Parameters:
context – Organ/tissue/multicellular anatomical structure list to determine the redundant graph via
CURIE. (existential restrictions. It must be a valid) –
- Returns:
Enriched DataFrame
- full_slim_enrichment(slim_list: List[str]) DataFrame [source]
Returns a DataFrame that is enriched with synonyms and inferred relationships between terms in the seed list and in an extended seed list. The extended seed list consists of terms from the seed list and terms from given slim lists, classes tagged with some specified ‘subset’ axiom, with inferred terms via transitive subClassOf queries.
- Parameters:
slim_list –
List ‘subset’ tags that consists of classes tagged with some specified ‘subset’ axiom
- Returns:
Enriched DataFrame
- get_most_specific_objects(predicate: str, ontology: str)[source]
- Parameters:
predicate – Relationship that wanted to be explored
ontology – PURL of obo ontologies in Ubergraph.
Examples
- Example Ontology PURLs:
Returns:
- get_most_specific_subjects(predicate: str, ontology: str)[source]
- Parameters:
predicate – Relationship that wanted to be explored
ontology – PURL of obo ontologies in Ubergraph.
Examples
- Example Ontology PURLs:
Returns:
- minimal_slim_enrichment(slim_list: List[str]) DataFrame [source]
Returns a DataFrame that is enriched with synonyms and inferred relationships between terms in the seed list and in an extended seed list. The extended seed list consists of terms from the seed list and terms from given slim lists, classes tagged with some specified ‘subset’ axiom.
- Parameters:
slim_list – List ‘subset’ tags that consists of classes tagged with some specified ‘subset’ axiom
- Returns:
Enriched DataFrame
- parent_enrichment()[source]
Perform parent enrichment analysis.
This method is a convenience wrapper around the ancestor_enrichment method, specifically designed to perform parent enrichment analysis. Parent enrichment analysis considers only immediate parent terms of the seed terms in the ontology graph (i.e., one-hop ancestors).
- Returns:
A DataFrame containing enriched parent terms and associated information.
- Return type:
pd.DataFrame
This method simplifies the process of conducting parent enrichment analysis by calling the ancestor_enrichment method with a step_count of 1, which limits the analysis to immediate parent terms of the seed terms.
- query(column_name: str, query_term: str) DataFrame [source]
Returns filtered dataframe via join on column to subject of enriched_df, looking up of object name or synonym via query of name_lookup.
- Parameters:
column_name – Column name
query_term – Object label or synonym
- Returns:
Filtered DataFrame
- simple_enrichment() DataFrame [source]
Returns a DataFrame that is enriched with synonyms and inferred relationships between terms in the seed. Subject and object terms are members of the seed terms.
- Returns:
Enriched DataFrame