3 Search PubMed records
getPubmed function utilizes europepmc to easily get PubMed records by searching paper abstracts.
It has three arguments:
-
term: the query terms, e.g. gene names or pathway names -
add_term: supplementary terms that every record must also match (optional) -
num: the maximum number of records returned for each term, default is 100
For example, if you want to find papers about genes “Tp53”, “Brca1”, and “Tet2” in the context of mouse stem cell research:
term <- c("Tp53", "Brca1", "Tet2")
add_term <- c("stem cell", "mouse")
l <- getPubmed(term, add_term, num = 30)
names(l)## [1] "Tp53" "Brca1" "Tet2"
head(l$Tp53, 5)## # A tibble: 5 × 28
## id source pmid pmcid doi title authorString journalTitle pubYear
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 42725759 MED 42725759 PMC135… 10.1… TP53… Qin G, Yeun… Adv Sci (We… 2026
## 2 42278500 MED 42278500 PMC132… 10.3… Wild… Cart JB, Zh… Int J Mol S… 2026
## 3 41814002 MED 41814002 PMC129… 10.1… CDK4… Chan ICC, Z… Nat Genet 2026
## 4 42069772 MED 42069772 PMC133… 10.1… NELF… Su X, Yang … Nat Commun 2026
## 5 42562776 MED 42562776 <NA> 10.1… Neur… Wan Y, Gao … J Neuropath… 2026
## # ℹ 19 more variables: journalIssn <chr>, pageInfo <chr>, pubType <chr>,
## # isOpenAccess <chr>, inEPMC <chr>, inPMC <chr>, citedByCount <int>,
## # hasReferences <chr>, hasTextMinedTerms <chr>, hasDbCrossReferences <chr>,
## # hasPDF <chr>, hasBook <chr>, hasSuppl <chr>, hasLabsLinks <chr>,
## # hasTMAccessionNumbers <chr>, firstPublicationDate <chr>,
## # firstIndexDate <chr>, issue <chr>, journalVolume <chr>
Set num to a larger value to get all records:
all <- getPubmed(term, add_term, num = 666666)The result is a list of data frames (one per term), which can be exported to one Excel file directly: