Logo Search packages:      
Sourcecode: python-biopython version File versions

Bio::EUtils::HistoryClient Namespace Reference


Detailed Description

Search and retreive information using the EUtils history.

EUtils has two major modes.  One uses history while the other uses
database identifiers.  This is a high-level interface for working with
the history.  You should use this module if you expect to work with
large or an unknown number of identifiers.

See DBIdsClient if you want to get information about a set of known
database identifiers.

>>> from EUtils import HistoryClient
>>> client = HistoryClient.HistoryClient()
>>> cancer = client.search("cancer")
>>> print len(cancer)
1458353
>>> 

That's quite a few hits.  Most people would like to see the first few
records then try to refine the search.

>>> print cancer[:5].efetch(retmode = "text", rettype = "docsum").read()

1:  Seow-Choen F.
Author's reply: Adjuvant therapy for rectal cancer cannot be based on the
results of other surgeons (Br J Surg 2002; 89: 946-947).
Br J Surg. 2003 Jan;90(1):121-122.
PMID: 12520589 [PubMed - as supplied by publisher]

2:  Mortensen N, Lindsey I.
Adjuvant therapy for rectal cancer cannot be based on the results of other
surgeons (Br J Surg 2002; 89: 946-947).
Br J Surg. 2003 Jan;90(1):121.
PMID: 12520588 [PubMed - as supplied by publisher]

3:  Osugi H, Takemura M, Higashino M, Takada N, Lee S, Kinoshita H.
A comparison of video-assisted thoracoscopic oesophagectomy and radical lymph
node dissection for squamous cell cancer of the oesophagus with open operation.
Br J Surg. 2003 Jan;90(1):108-13.
PMID: 12520585 [PubMed - in process]

4:  Tanaka M, Kitajima Y, Sato S, Miyazaki K.
Combined evaluation of mucin antigen and E-cadherin expression may help select
patients with gastric cancer suitable for minimally invasive therapy.
Br J Surg. 2003 Jan;90(1):95-101.
PMID: 12520583 [PubMed - in process]

5:  Diaz De Liano A, Oteiza Martinez F, Ciga MA, Aizcorbe M, Cobo F, Trujillo R.
Impact of surgical procedure for gastric cancer on quality of life.
Br J Surg. 2003 Jan;90(1):91-4.
PMID: 12520582 [PubMed - in process]

>>>

Now refine the query to publications in the last day

>>> recent_cancer = client.search("#%s" % (cancer.query_key,),
...                               daterange = EUtils.WithinNDays(1))
>>> len(recent_cancer)
106
>>>

Still quite a few.  What's the last one about?
>>> for k, v in recent_cancer[-1].summary().dataitems.allitems():
...     print k, "=", v
...

PubDate = 2002/12/01
Source = Nippon Shokakibyo Gakkai Zasshi
Authors = Kuroki T
Title = [Strategy against cancer in 21 century, with emphasis of cancer prevention and refractory cancer]
Volume = 99
Pages = 1423-7
EntrezDate = 2003/01/10
PubMedId = 12518389
MedlineId = 22406828
Lang = Japanese
PubType =
RecordStatus = PubMed - in process
Issue = 12
SO = 2002 Dec;99(12):1423-7
DOI =
JTA = KJY
ISSN = 0446-6586
PubId =
PubStatus = 4
Status = 6
HasAbstract = 0
ArticleIds = {'MedlineUID': u'22406828', 'PubMedId': u'12518389'}
>>> 

Here's an interesting one.  Which articles are related to this one but
are not about cancer?  First, get the related articles.


>>> neighbors = recent_cancer[-1].neighbor_links()
>>> dbids = neighbors.linksetdbs["pubmed_pubmed"].dbids
>>> len(dbids)
10296
>>> 

Upload that back to the server

>>> related_result = client.post(dbids)
>>>
>>> non_cancer = client.search("#%s NOT #%s" % (related_result.query_key,
...                                             cancer.query_key))
>>> len(non_cancer)
4000
>>>

The HistoryClient instance has an attribute named 'query_history'
which stores the searches done so far, keyed by the query_key value
assigned by the server.  The history on the server can expire.  If
that is detected during a search then previous results are invalidated
and removed from the query_history.  Future requests from invalidated
results will raise an error.

If a request is made from a search which has not been invalidated but
whose history has expired then queries like 'summary' will raise an
error.  Some other request (like 'dbids') may return success but
contain undefined information.


Classes

class  BaseHistoryRecordSet
class  HistoryClient
class  HistoryCookie
class  HistoryLookup
class  HistoryRecord
class  PublicationHistoryFetchMixin
class  PublicationHistoryRecord
class  PublicationHistoryRecordSet
class  SequenceHistoryFetchMixin
class  SequenceHistoryRecord
class  SequenceHistoryRecordSet

Functions

def _get_recordset_constructor


Generated by  Doxygen 1.6.0   Back to index