Entrez
Julia interface to Entrez Utilities API.
For executables that use this package to search PubMed, see the sister package PubMedMiner
Import Module
using BioMedQuery.Entrez
The following E-utils functions have been implemented:
The following utility functions are available to handle and store NCBI responses
- EParse - Convert XML response to Julia Dict
- Saving NCBI Responses to XML
- Saving EFetch to a SQLite database
- Saving EFetch to a MySQL database
The following utility functions are available to query the database
ESearch
#
BioMedQuery.Entrez.esearch
— Method.
esearch(search_dict)
Request list of UIDs matiching a query - see NCBI Entrez:Esearch
Arguments
search_dic::Dict
: dictionary specifying search criteria
Output
::String
: XML response from NCBI
Example
search_dic = Dict("db"=>"pubmed", "term" => search_term,
"retstart" => 0, "retmax"=>5, "tool" =>"BioJulia",
"email" => "email")
esearch_response = esearch(search_dic)
Note
- email must be a valid email address (otherwise pubmed will block you)
- search_term corresponds to a valid PubMed Search. It may contain one or more filtering criteria using AND/OR.
For instance:
search_term = (asthma[MeSH Terms]) AND ("2001/01/29"[Date - Publication] : "2010"[Date - Publication])
.
EFetch
#
BioMedQuery.Entrez.efetch
— Method.
efetch(fetch_dic, id_list)
Retrieve data records from a list of UIDs - see NCBI Entrez: EFetch
Arguments
fetch_dic::Dict
- Dictionary specifying fetch criteriaid_list::Array
- List of ids e.g those embedded in response from esearch
Results
::String
- XML response from NCBI
Example
# get the list of ids
if !haskey(esearch_dict, "IdList")
error("Error: IdList not found")
end
ids = []
for id_node in esearch_dict["IdList"][1]["Id"]
push!(ids, id_node)
end
# define the fetch dictionary
fetch_dic = Dict("db"=>"pubmed","tool" =>"BioJulia",
"email" => email, "retmode" => "xml", "rettype"=>"null")
# fetch
efetch_response = efetch(fetch_dic, ids)
ELink
#
BioMedQuery.Entrez.elink
— Method.
elink(elink_dict)
Lists, checks or returns UIDs linked to an input list of UIDs in the same or different Entrez database. For more info see NCBI Entrez:ELink
Arguments
elink_dict::Dict
: dictionary specifying elink inputs as credentials, ids...
Output
::String
: XML response from NCBI
Example
pmid = "19304878"
elink_dict = Dict("dbfrom" =>"pubmed", "id" => pmid,
"linkname" => "pubmed_pubmed", "email"=>email)
elink_response = elink(elink_dict)
ESummary
#
BioMedQuery.Entrez.esummary
— Method.
esummary(esummary_dict)
Return document summaries for a list of input UIDs. For more info see NCBI Entrez:ESummary
Arguments
esummary_dict::Dict
: dictionary specifying esummary inputs as credentials, ids...
Output
::String
: XML response from NCBI
Example
pmid = "30367"
esummary_dict = Dict("db" =>"pubmed", "id" => pmid, "email"=>email)
esummary_response = esummary(esummary_dict)
EParse
#
BioMedQuery.Entrez.eparse
— Method.
eparse(response::String)
Converts NCBI XML response into a Julia dictionary
Saving NCBI Responses to XML
You can save directly the XML String to file using the XMLconvert Package
Example
XMLconvert.xmlASCII2file(efetch_response, "./efetch.xml")
Saving EFetch to a SQLite database
save_efetch_sqlite(efetch_dict, db_config, verbose)
Saving EFetch to a MySQL database
save_efetch_mysql(efetch_dict, db_config, verbose)
The following schema has been used to store the results. If you are interested in having this module store additional fields, feel free to open an issue
All PMIDs
#
BioMedQuery.Entrez.DB.all_pmids
— Method.
all_pmids(db)
Return all PMIDs stored in the article table of the input database
All MESH descriptors for an article
#
BioMedQuery.Entrez.DB.get_article_mesh
— Method.
get_article_mesh(db, pmid)
Get the all mesh-descriptors associated with a give article