Quick Start Guide

This guide will help you get started with Metapub quickly.

Retrieving Article by PMID

from metapub import PubMedFetcher

fetch = PubMedFetcher()
article = fetch.article_by_pmid('12345678')

print(f"Title: {article.title}")
print(f"Abstract: {article.abstract}")
print(f"DOI: {article.doi}")
print(f"Publication Date: {article.year}")

Finding Full Text with FindIt

from metapub import FindIt

# Try to find full text for a paper
src = FindIt('12345678')  # PMID

if src.url:
    print(f"Full text available at: {src.url}")
else:
    print(f"Could not find full text: {src.reason}")

Working with MedGen

from metapub import MedGenFetcher

mg = MedGenFetcher()

# Search for a condition
concepts = mg.concepts_for_term('diabetes')

for concept in concepts:
    print(f"CUI: {concept.cui}")
    print(f"Name: {concept.name}")
    print(f"Definition: {concept.definition}")

Command Line Tools

Metapub includes several command line utilities:

# Convert between IDs
convert pmid2doi 12345678
convert doi2pmid 10.1038/nature12373

# Get article information
pubmed_article 12345678

# Check NCBI health
ncbi_health_check

Next Steps