Skip to content
Snippets Groups Projects
Commit 3ee073fc authored by peguerin's avatar peguerin
Browse files

nice example of esarch

parent b93ffa89
No related branches found
No related tags found
No related merge requests found
library(rentrez)
## search Rana temporaria entreies in "Nucleotide" database from NCBI
## search returns a list of IDs
## retmax argument is to ask more than 20 (default value) results
query <- entrez_search(db="nucleotide", term="rana temporaria[ORGN] AND mitochondrion AND complete genome", retmax=99999)
## see the IDs of the queries
query$ids
## item i can search in nucleotide database
entrez_db_searchable('nucleotide')
## search the gene named "mhc" and species from "actinopterygii" class organism
query <- entrez_search(db="nucleotide",
term= "(MHC[GENE] OR (major histocompatibility
complex[MeSH])) AND actinopterygii[ORGN] AND 1992:2021[PDAT]",
retmax=99999)
search_year <- function(year, term){
query <- paste(term, " AND (", year, "[PDAT])")
entrez_search(db="nucleotide", term=query, retmax=0)$count
}
year <- 1992:2021
publications <- sapply(year,
search_year,
term="(MHC[GENE] OR (major histocompatibility complex[MeSH])) AND actinopterygii[ORGN]",
USE.NAMES=FALSE)
plot(year, publications, type="l", main="MHC actinopterygii")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment