Pubmed Tools (pubmedtools) package provides functions forsearching and retrieving articles from the PubMed databaseusing Biopython and NCBI Entrez Direct.
Project description
PubmedTools (pubmedtools)
PubmedTools (pubmedtools) package provides functions for searching and retrieving articles from the PubMed database using Biopython and NCBI Entrez Direct. This is not an official NCBI library and has no direct affiliation with the organization.
Features
pubmedtoos.search.biopython_search
: Searches the PubMed database using a Biopython Entrez module (Bio.Entrez).pubmedtoos.search.edirect_search
: Searches the PubMed database using the official Entrez Direct tool.pubmedtoos.prepenv.edirect_folder
: Prepares the Entrez Direct folder for use with the edirect_search function.
Installation
You can install PubmedTools using pip:
pip install pubmedtools
Functions
search
pubmedtools.search.biopython_search
Searches the PubMed database using a given term and retrieves the abstract, title, publication date, authors, MeSH terms, and other terms related to each article. This function use the Bio.Entrez module from Biopython. The search is limited to 10,000 results.
Parameters
term
: str- The search term to be used in the query.
email
: str, optional- Email address to be used in case the Entrez server needs to contact you.
api_key
: str, optional- API key to access the Entrez server.
batch_size
: int, optional- Number of articles to be downloaded per iteration. Default is 1000.
verbose
: bool, optional- Whether to print progress messages. Default is True.
Returns
- pandas.DataFrame
- A DataFrame with columns 'pmid', 'ti', 'ab', 'fau', 'dp', 'mh', and 'ot'.
- Each row contains information related to a single article retrieved from the search term query.
Raises
Exception
- If the search returns more than 10,000 results, which is the limit of
this function.
In this case, the user should use the pubmedtools.search.edirect_search
function.
pubmedtools.search.edirect_search
Searches the PubMed database using a given term and retrieves the abstract, title, publication date, authors, MeSH terms, and other terms related to each article. This function use the official NCBI Entrez Direct tool.
Parameters
query
: str- The query to be searched in PubMed.
api_key
: str, optional- The NCBI API key. If not provided, the search will be performed without the API key.
Returns
- pandas.DataFrame
- A pandas DataFrame containing the search results.
Notes
- This function works with Linux and Windows systems using WSL (Windows Subsystem for Linux).
Raises
- Exception
- If the operating system is not recognized.
prepenv
pubmedtools.prepenv.edirect_folder
Function to prepare the edirect folder for pubmed_search_edirect. Checks in pubmedtools package path if the edirect folder exists and contains the necessary files. If not, it downloads and extracts the required files.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pubmedtools-0.0.0.2.tar.gz
.
File metadata
- Download URL: pubmedtools-0.0.0.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad1bd3682227122ba6ebed5bba3b0f1ed27d00c43f980be4828f1bc672ac817 |
|
MD5 | 40556028dec10c5b16b340c83eff6484 |
|
BLAKE2b-256 | 98f0d9778fd39479d9395c6801612fb664ac8b0db32b7eac54c07d3d0f2593da |
File details
Details for the file pubmedtools-0.0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pubmedtools-0.0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089e2a7e15f723e8d6d248642a0c14dbc2357323ea33a79e656b7319b1eb999f |
|
MD5 | 2d3e9dc365d0a9e3675600fd6af28bdb |
|
BLAKE2b-256 | 218544c0cbd927f09e89461e9165d038038fc5116b21be039a01c14b781142d8 |