curategpt.wrappers.literature package

Submodules

curategpt.wrappers.literature.bioc_wrapper module

Chat with a KB.

class curategpt.wrappers.literature.bioc_wrapper.BiocWrapper(source_locator=None, local_store=None, extractor=None, _label_adapter=None)

Bases: BaseWrapper

A wrapper over a bioc source file.

This provides an exhaustive list of objects.

default_object_type = 'AnnotatedPublication'
property label_adapter: BasicOntologyInterface

Get the label adapter.

name: ClassVar[str] = 'bioc'
objects(collection=None, object_ids=None, **kwargs)

Return all objects in the view.

Parameters:
  • collection (Optional[str])

  • object_ids (Optional[Iterable[str]]) – Optional list of IDs to fetch

  • kwargs

Return type:

Iterator[Dict]

Returns:

curategpt.wrappers.literature.eutils_wrapper module

Chat with a KB.

class curategpt.wrappers.literature.eutils_wrapper.EUtilsWrapper(source_locator=None, local_store=None, extractor=None, eutils_client=None, session=<factory>, _uses_cache=False)

Bases: BaseWrapper, ABC

A wrapper to provide a search facade over NCBI Biosample.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

eutils_client: Client = None
eutils_db: ClassVar[str] = None

Search an external source and return the results.

Parameters:
  • text (str)

  • kwargs

Return type:

List[Dict]

Returns:

fetch_tool: ClassVar[str] = 'efetch'
id_prefix: ClassVar[str] = None
name: ClassVar[str] = '__eutils__'
objects_by_ids(object_ids)

Return objects by their IDs.

Parameters:

object_ids (List[str])

Return type:

List[Dict]

Returns:

objects_from_dict(results)
Return type:

List[Dict]

session: Session
set_cache(name)
Return type:

None

curategpt.wrappers.literature.pmc_wrapper module

EUtils-based wrapper for studies in NCBI.

class curategpt.wrappers.literature.pmc_wrapper.PMCWrapper(source_locator=None, local_store=None, extractor=None, eutils_client=None, session=<factory>, _uses_cache=False)

Bases: EUtilsWrapper

A wrapper to provide a search facade over PMC via eutils.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

default_object_type = 'Reference'
eutils_db: ClassVar[str] = 'pmc'
fetch_tool: ClassVar[str] = 'esummary'
id_prefix: ClassVar[str] = 'pmc'
name: ClassVar[str] = 'pmc'
objects_from_dict(results)
Return type:

List[Dict]

curategpt.wrappers.literature.pubmed_wrapper module

Chat with a KB.

class curategpt.wrappers.literature.pubmed_wrapper.PubmedWrapper(source_locator=None, local_store=None, extractor=None, eutils_client=None, session=<factory>, where=None, email=None, ncbi_key=None, is_fetch_full_text=None, _uses_cache=None)

Bases: BaseWrapper

A wrapper to provide a search facade over PubMed.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

This can be used to restrict search to a journal; first find the journal: https://www.ncbi.nlm.nih.gov/nlmcatalog/?term=%22Case+Reports+in+Genetics%22

E.g.

NLM Title Abbreviation: Case Rep Genet

Add this to the where clause:

{“ta”: “Case Rep Genet”}

On the command line:

curategpt view search -V pubmed -I "where: {ta: Case Rep Genet}" "leukodystrophy and ischemia"
email: Optional[str] = None
eutils_client: Client = None

Search an external source and return the results.

Parameters:
  • text (str)

  • kwargs

Return type:

List

Returns:

fetch_full_text(object_id)
Return type:

Optional[str]

fetch_pmcid(pmid)
Return type:

Optional[str]

is_fetch_full_text: Optional[bool] = None
name: ClassVar[str] = 'pubmed'
ncbi_key: Optional[str] = None
objects_by_ids(object_ids)

Return objects by their IDs.

Parameters:

object_ids (List[str])

Return type:

List[Dict]

Returns:

pmc_full_text(object_id)
Return type:

Optional[str]

pmc_xml(pmc_id)

Get the text of one PubMed Central entry.

Don’t parse further here - just get the raw response. :type pmc_id: str :param pmc_id: List of PubMed IDs, or string with single PMID :rtype: str :return: the text of a single entry as XML

session: Session
set_cache(name)
Return type:

None

where: Optional[Dict] = None
curategpt.wrappers.literature.pubmed_wrapper.extract_all_text(element)
curategpt.wrappers.literature.pubmed_wrapper.extract_text_from_xml(xml_content)

curategpt.wrappers.literature.wikipedia_wrapper module

Chat with a KB.

class curategpt.wrappers.literature.wikipedia_wrapper.WikipediaWrapper(source_locator=None, local_store=None, extractor=None)

Bases: BaseWrapper

A wrapper to provide a search facade over Wikipedia.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

Search an external source and return the results.

Parameters:
  • text (str)

  • kwargs

Return type:

List

Returns:

name: ClassVar[str] = 'wikipedia'

Module contents

class curategpt.wrappers.literature.BiocWrapper(source_locator=None, local_store=None, extractor=None, _label_adapter=None)

Bases: BaseWrapper

A wrapper over a bioc source file.

This provides an exhaustive list of objects.

default_object_type = 'AnnotatedPublication'
property label_adapter: BasicOntologyInterface

Get the label adapter.

name: ClassVar[str] = 'bioc'
objects(collection=None, object_ids=None, **kwargs)

Return all objects in the view.

Parameters:
  • collection (Optional[str])

  • object_ids (Optional[Iterable[str]]) – Optional list of IDs to fetch

  • kwargs

Return type:

Iterator[Dict]

Returns:

class curategpt.wrappers.literature.PubmedWrapper(source_locator=None, local_store=None, extractor=None, eutils_client=None, session=<factory>, where=None, email=None, ncbi_key=None, is_fetch_full_text=None, _uses_cache=None)

Bases: BaseWrapper

A wrapper to provide a search facade over PubMed.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

This can be used to restrict search to a journal; first find the journal: https://www.ncbi.nlm.nih.gov/nlmcatalog/?term=%22Case+Reports+in+Genetics%22

E.g.

NLM Title Abbreviation: Case Rep Genet

Add this to the where clause:

{“ta”: “Case Rep Genet”}

On the command line:

curategpt view search -V pubmed -I "where: {ta: Case Rep Genet}" "leukodystrophy and ischemia"
email: Optional[str] = None
eutils_client: Client = None

Search an external source and return the results.

Parameters:
  • text (str)

  • kwargs

Return type:

List

Returns:

fetch_full_text(object_id)
Return type:

Optional[str]

fetch_pmcid(pmid)
Return type:

Optional[str]

is_fetch_full_text: Optional[bool] = None
name: ClassVar[str] = 'pubmed'
ncbi_key: Optional[str] = None
objects_by_ids(object_ids)

Return objects by their IDs.

Parameters:

object_ids (List[str])

Return type:

List[Dict]

Returns:

pmc_full_text(object_id)
Return type:

Optional[str]

pmc_xml(pmc_id)

Get the text of one PubMed Central entry.

Don’t parse further here - just get the raw response. :type pmc_id: str :param pmc_id: List of PubMed IDs, or string with single PMID :rtype: str :return: the text of a single entry as XML

session: Session
set_cache(name)
Return type:

None

where: Optional[Dict] = None
class curategpt.wrappers.literature.WikipediaWrapper(source_locator=None, local_store=None, extractor=None)

Bases: BaseWrapper

A wrapper to provide a search facade over Wikipedia.

This is a dynamic wrapper: it can be used as a search facade, but cannot be ingested in whole.

Search an external source and return the results.

Parameters:
  • text (str)

  • kwargs

Return type:

List

Returns:

name: ClassVar[str] = 'wikipedia'