nimare.annotate.ontology¶
Automated annotation tools for existing ontologies.
-
extract_cogpo
()[source]¶ Predict Cognitive Paradigm Ontology [1] labels with ATHENA classifiers [2].
Warning
This function is not yet implemented.
References
[1] Turner, Jessica A., and Angela R. Laird. “The cognitive paradigm ontology: design and application.” Neuroinformatics 10.1 (2012): 57-66. https://doi.org/10.1007/s12021-011-9126-x [2] Riedel, Michael Cody, et al. “Automated, efficient, and accelerated knowledge modeling of the cognitive neuroimaging literature using the ATHENA toolkit.” Frontiers in neuroscience 13 (2019): 494. https://doi.org/10.3389/fnins.2019.00494
-
extract_cogat
(text_df, id_df=None, text_column='abstract')[source]¶ Extract Cognitive Atlas [1] terms and count instances using regular expressions.
Parameters: - text_df ((D x 2)
pandas.DataFrame
) – Pandas dataframe with two columns: ‘id’ and the text. D = document. - id_df ((T x 3)
pandas.DataFrame
) – Cognitive Atlas ontology dataframe with three columns: ‘id’ (unique identifier for term), ‘alias’ (natural language expression of term), and ‘name’ (preferred name of term; currently unused). T = term. - text_column (
str
, optional) – Name of column in text_df that contains text. Default is ‘abstract’.
Returns: - counts_df ((D x T)
pandas.DataFrame
) – Term counts for documents in the corpus. - rep_text_df ((D x 2)
pandas.DataFrame
) – Text DataFrame with terms replaced with their CogAt IDs.
References
[1] Poldrack, Russell A., et al. “The cognitive atlas: toward a knowledge foundation for cognitive neuroscience.” Frontiers in neuroinformatics 5 (2011): 17. https://doi.org/10.3389/fninf.2011.00017 - text_df ((D x 2)
-
expand_counts
(counts_df, rel_df, weights=None)[source]¶ Perform hierarchical expansion of counts across labels.
Parameters: - counts_df ((D x T)
pandas.DataFrame
) – Term counts for a corpus. T = term, D = document. - rel_df (
pandas.DataFrame
) – Long-form DataFrame of term-term relationships with three columns: ‘input’, ‘output’, and ‘rel_type’. - weights (
dict
) – Dictionary of weights per relationship type. E.g., {‘isKind’: 1}. Unspecified relationship types default to 0.
Returns: weighted_df – Term counts for a corpus after hierarchical expansion.
Return type: (D x T)
pandas.DataFrame
- counts_df ((D x T)
-
class
CogAtLemmatizer
(ontology_df=None)[source]¶ Replace synonyms and abbreviations with Cognitive Atlas [R51a14fd76a1a-1] identifiers in text.
Parameters: ontology_df ( pandas.DataFrame
, optional) – DataFrame with three columns (id, name, alias) and one row for each alias (e.g., synonym or abbreviation) for each term in the Cognitive Atlas. If None, loads ontology file from resources folder.-
ontology_
¶ Ontology in DataFrame form.
Type: pandas.DataFrame
References
[R51a14fd76a1a-1] Poldrack, Russell A., et al. “The cognitive atlas: toward a knowledge foundation for cognitive neuroscience.” Frontiers in neuroinformatics 5 (2011): 17. https://doi.org/10.3389/fninf.2011.00017 Methods
transform
(self, text[, convert_uk])Replace terms in text with unique Cognitive Atlas identifiers. -