Skip to main content

A typed Python module and CLI to fetch PubMed papers affiliated with pharma/biotech companies.

Project description

📚 My PubMed Package

A Python CLI & library to search PubMed, filter pharmaceutical/biotech papers, and export results to CSV.


🚀 Features

Search PubMed with a query (full syntax supported).
Fetch research papers and extract metadata.
Identify pharmaceutical/biotech-affiliated authors using heuristics.
Save results to CSV or print them in the terminal.
Command-line interface (CLI) for easy execution.
Python module for programmatic use.
Lightweight & easy to install (only depends on requests).


🛠 Installation

Install from PyPI

You can install the package directly from PyPI using:

pip install my-pubmed-package

This installs both the Python library and the CLI tool (get-papers-list).


🎮 CLI Usage

After installation, you can run the CLI tool:

get-papers-list "machine learning in drug discovery" -d -f results.csv

Command Options

Option Description
query (Required) The PubMed search query. Full syntax supported.
-d, --debug Enable verbose debug logs.
-f <filename>, --file <filename> Save output to CSV. If omitted, prints results to the console.
-h, --help Display help message.

Example:

get-papers-list "cancer immunotherapy" -d -f papers.csv

✅ Fetches 50 papers
✅ Filters those with pharma/biotech affiliations
✅ Saves the output in papers.csv


📄 Example Output

CSV File (results.csv) Example:

PubmedID,Title,Publication Date,Non-academic Author(s),Company Affiliation(s),Corresponding Author Email
39941149,"Discovery of TRPV4-Targeting Small Molecules",2025-Feb-06,"Yu Wang","State Key Laboratory of Pathogen and Biosecurity","coen.vanhasselt@lacdr.leidenuniv.nl"
39935140,"Disorganization of Small-World Functional Networks",2025-Feb,"","Department of Radiology, Tongde Hospital of Zhejiang Province",""
39930345,"C-H Aminoalkylation of 5-Membered Heterocycles",2025-Feb-11,"Cyndi Qixin He; Marion H Emmert","Process Research and Development, Merck & Co., Inc.","parthapatrim.roy@gcu.ac.in"

Terminal Output Example (if no -f is provided):

--- Pharma/Biotech Papers ---
PubmedID: 39941149
Title: Discovery of TRPV4-Targeting Small Molecules
Publication Date: 2025-Feb-06
Non-academic Author(s): Yu Wang
Company Affiliation(s): State Key Laboratory of Pathogen and Biosecurity
Corresponding Author Email: coen.vanhasselt@lacdr.leidenuniv.nl
--------------------------------------------------

🖥 Programmatic Usage

You can also use my-pubmed-package as a Python module:

from my_pubmed_package.pubmed_module import search_pubmed_ids, fetch_pubmed_details_bulk

# Search PubMed for PMIDs
pmids = search_pubmed_ids("heart attack therapy", retmax=10, verbose=True)

# Fetch metadata
articles = fetch_pubmed_details_bulk(pmids, verbose=True)

# Print first result
print(articles[0])

🔄 Updating the Package

To update to the latest version:

pip install --upgrade my-pubmed-package

🛠 Troubleshooting

1️⃣ get-papers-list: command not found

If the CLI is not recognized, try running it with:

poetry run get-papers-list "cancer immunotherapy" -d -f results.csv

OR:

python -m my_pubmed_package.cli "cancer immunotherapy" -d -f results.csv

2️⃣ No PMIDs found

Try using broader search queries or visit PubMed to refine.


📜 License

This project is licensed under the MIT License.


🎉 Thank You!

If you find this package useful, star it on GitHub and share it with others! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my_pubmed_package-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

my_pubmed_package-0.1.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file my_pubmed_package-0.1.1.tar.gz.

File metadata

  • Download URL: my_pubmed_package-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0

File hashes

Hashes for my_pubmed_package-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ed8a953721c750d6a072d7e3504190ee1557de6e8e3b87856054ac8f5c86909
MD5 0efa258dcf345bfc6c88cae6f60caaba
BLAKE2b-256 3c9ed48de82ee784b816feaa0a394301ce99349e2189d855e652b0bb6169aa1c

See more details on using hashes here.

File details

Details for the file my_pubmed_package-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: my_pubmed_package-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.11.8 Darwin/23.5.0

File hashes

Hashes for my_pubmed_package-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0620c209fb3a057753f54ed365ba2642063b2984ca8f0fe4cca1113ffbcd5fd
MD5 a6718183c6a8349f3842bd494b096f87
BLAKE2b-256 53014446d483c108cb37b2ca086e129b40f36333d1d5de26d2c5d67a3b43c750

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page