lisc.collect_counts

lisc.collect_counts(terms_a, inclusions_a=None, exclusions_a=None, labels_a=None, terms_b=None, inclusions_b=None, exclusions_b=None, labels_b=None, db='pubmed', field='TIAB', api_key=None, collect_coocs=True, logging=None, directory=None, collect_info=True, verbose=False, **eutils_kwargs)[source]

Collect count and term co-occurrence data from EUtils.

Parameters
terms_alist of list of str

Search terms.

inclusions_alist of list of str, optional

Inclusion words for search terms.

exclusions_alist of list of str, optional

Exclusion words for search terms.

labels_alist of str, optional

Labels for the search terms.

terms_blist of list of str, optional

Secondary list of search terms.

inclusions_blist of list of str, optional

Inclusion words for the second list of search terms.

exclusions_blist of list of str, optional

Exclusion words for the second list of search terms.

labels_blist of str

Labels for the second list of search terms.

dbstr, optional, default: ‘pubmed’

Which database to access from EUtils.

fieldstr, optional, default: ‘TIAB’

Field to search for term within. Defaults to ‘TIAB’, which is Title/Abstract.

api_keystr, optional

An API key for a NCBI account.

collect_coocsbool, optional, default: True

Whether to collect co-occurence data. If False, only collects the counts for first term list.

logging{None, ‘print’, ‘store’, ‘file’}, optional

What kind of logging, if any, to do for requested URLs.

directorystr or SCDB, optional

Folder or database object specifying the save location.

collect_infobool, optional, default: True

Whether to collect database information, to be added to meta data.

verbosebool, optional, default: False

Whether to print out updates.

**eutils_kwargs

Additional settings for the EUtils API.

Returns
co_occurences2d array

The numbers of articles found for each combination of terms. Only returned if collect_coocs is True.

counts1d array or list of 1d array

Number of articles for each term independently.

meta_datadict

Meta data from the data collection.

Notes

The collection does an exact word search for search terms.

The HTML page returned by the EUtils search includes a ‘count’ field. This field contains the number of articles with both terms. This is extracted.

Examples

Collect counts and co-occurrences for a single set of two search terms:

>>> coocs, counts, meta_data = collect_counts([['frontal lobe'], ['temporal lobe']])

Collect counts and co-occurrences for two sets of search terms:

>>> coocs, counts, meta_data = collect_counts(terms_a=[['frontal lobe'], ['temporal lobe']],
...                                           terms_b=[['attention'], ['perception']])

Examples using lisc.collect_counts

Counts with Functions

Counts with Functions