pubmed.pl -- connect to publication services at pubmed

A simple library for communicating with pubmed publications. Currently allows (a) searching on conjunctions and disjunctions, (b) fetching the details of a pubmed id(s) (c) the publications citing a paper and (d) simple reporting of multiple fetched information. It requires the curl executable to be in the path. Only tested on Linux. It is being developed on SWI-Prolog 6.1.8 but should also work on Yap Prolog.

author
- Nicos Angelopoulos
version
- 0.0.3, 2012/08/15
See also
- http://bioinformatics.nki.nl/~nicos/sware/pubmed
- http://www.ncbi.nlm.nih.gov/books/NBK25500/
- examples.pl file in the packs directory
- sources at http://bioinformatics.nki.nl/~nicos/sware/packs/pubmed-0.0.3.tgz
pubmed_search (+STerm, -Ids)
Short form of pubmed_search( +STerm, -Ids, [] ).
pubmed_search (+STerm, -Ids, Options)
Search in pubmed for terms in the search term STerm. In this, conjunction is marked by , (comma) and disjunction by ; (semi-column). '-' pair terms are considered as Key-Value and interpreted as Value[Key] in the query. List are thought to be flat conjoint search terms with no pair values in them which are interpreted by pubmed also as OR operations. (See example below.) Known keys are : journal, pdat. The predicate constructs a query that is posted via the http API provided by NCBI (http://www.ncbi.nlm.nih.gov/books/NBK25500/). Options can be a single term or list of terms from :
?-
    St = (journal=science,[breast,cancer],pdat=2008),
    pubmed_search( St, Ids, [verbose(true),qtranslation(QTrans)] ),
    length( Ids, Len ), write( number_of:Len ), nl.

http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmax=100&term=science\[journal\]+AND+breast+cancer+AND+2008\[pdat\]
process_create(path(curl),[-o,/tmp/pl_13858_1,http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmax=100&term=science\[journal\]+AND+breast+cancer+AND+2008\[pdat\]],[])
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3008    0  3008    0     0   3585      0 --:--:-- --:--:-- --:--:--  4641
tmp_file(/tmp/pl_13858_1)
number_of:6
St = (journal=science, [breast, cancer], pdat=2008),
Ids = ['19008416', '18927361', '18787170', '18487186', '18239126', '18239125'],
QTrans = ['("Science"[Journal] OR "Science (80- )"[Journal] OR "J Zhejiang Univ Sci"[Journal]) AND ("breast neoplasms"[MeSH Terms] OR ("breast"[All Fields] AND "neoplasms"[All Fields]) OR "breast neoplasms"[All Fields] OR ("breast"[All Fields] AND "cancer"[All Fields]) OR "breast cancer"[All Fields]) AND 2008[pdat]'],
Len = 6.


?-
    date(Date), pubmed_search( prolog, Ids ), length( Ids, Len ), write( number_of:Len ), nl.

number_of:100
Date = date(2012, 7, 10),
Ids = ['22586414', '22462194', '22215819', '21980276', '21499053', '21353661', '20123506', '20123505', '19408879'|...],
Len = 100.

?-
    date(Date), pubmed_search( prolog, Ids, retmax(200) ),
    length( Ids, Len ), write( number_of:Len ), nl.

number_of:120
Date = date(2012, 7, 10),
Ids = ['22586414', '22462194', '22215819', '21980276', '21499053', '21353661', '20123506', '20123505', '19408879'|...],
Len = 120.
pubmed_summary_display (+Ids)
Short for pubmed_summary_display( Ids, _Summary, [] ).
pubmed_summary_display (+Ids, -Summary)
Short for pubmed_summary_display( Ids, Summary, [] ).
pubmed_summary_display (+Ids, -Summary, +Opts)
A wrapper around pubmed_summary_info/3. It call this predicate with same arguments before displaying the Summary information. Opts can be a single term option or a list of such terms. In addition to pubmed_summary_info/3 options this wrapper also recognises the term :
?-
     date(Date), pubmed_search((programming,'Prolog'), Ids), Ids = [A,B,C|_], pubmed_summary_display( [A,B,C] ).

----
0:22215819
[Evaluating bacterial gene-finding HMM structures as probabilistic logic programs.]
[Mørk S,Holmes I]
----
1:21980276
[War of ontology worlds: mathematics, computer code, or Esperanto?]
[Rzhetsky A,Evans JA]
----
2:15360781
[Medical expert systems developed in j.MD, a Java based expert system shell: application in clinical laboratories.]
[Van Hoof V,Wormek A,Schleutermann S,Schumacher T,Lothaire O,Trendelenburg C]
----
Date = date(2012, 7, 10),
Ids = ['22215819', '21980276', '15360781', '11809317', '9783213', '9293715', '9390313', '8996790', '15048396'|...],
A = '22215819',
B = '21980276',
C = '15360781'.

pubmed_cited_by (+Id, -Ids)
Redirects to pubmed_cited_by( Id, Ids, [] ).
pubmed_cited_by (+Id, -Ids, +Options)
Ids is the list of pubmed ids that cite Id. Options is a term option or list of terms from the following;
?-
     date(D), pubmed_cited_by( 12075665, By ).

D = date(2012, 7, 9),
By = ['19497389'].
pubmed_summary_info (+Id, -Results, +Opts)
Results are the summary information for pubmed id Id. The predicate communicates with pubmed via the http interface with curl. Results are deposited in xml files which are subsequently parsed to produce the termed Results. Id can also be a list of Ids in which case the result is a list of Id-Results pairs.

Options is a single term, or list of the following terms:

?-
  date(Date),  Opts = names(['Author','PmcRefCount','Title']),
  pubmed_summary_info( 12075665, Results, Opts ),
  write( date:Date ), nl, member( R, Results ), write( R ), nl, fail.

date:date(2012,7,9)
Author-[Kemp GJ,Angelopoulos N,Gray PM]
Title-[Architecture of a mediator for a bioinformatics database federation.]
Source-[IEEE Trans Inf Technol Biomed]
Pages-[116-22]
PubDate-[2002 Jun]
Volume-[6]
Issue-[2]
ISSN-[1089-7771]
PmcRefCount-[1]
PubType-[Journal Article]
FullJournalName-[IEEE transactions on information technology in biomedicine : a publication of the IEEE Engineering in Medicine and Biology Society]
false.