Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 763d6289e1351f2d34257ce697a3ccb7 > files > 445

biopython-doc-1.47-2mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Bio.EUtils.HistoryClient</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Bio-module.html">Package&nbsp;Bio</a> ::
        <a href="Bio.EUtils-module.html">Package&nbsp;EUtils</a> ::
        Module&nbsp;HistoryClient
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Bio.EUtils.HistoryClient-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module HistoryClient</h1><p class="nomargin-top"><span class="codelink"><a href="Bio.EUtils.HistoryClient-pysrc.html">source&nbsp;code</a></span></p>
<p>Search and retreive information using the EUtils history.</p>
  <p>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.</p>
  <p>See DBIdsClient if you want to get information about a set of known 
  database identifiers.</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> Bio.EUtils <span class="py-keyword">import</span> HistoryClient
<span class="py-prompt">&gt;&gt;&gt; </span>client = HistoryClient.HistoryClient()
<span class="py-prompt">&gt;&gt;&gt; </span>cancer = client.search(<span class="py-string">&quot;cancer&quot;</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> len(cancer)
<span class="py-output">1458353</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt;</span></pre>
  <p>That's quite a few hits.  Most people would like to see the first few 
  records then try to refine the search.</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> cancer[:5].efetch(retmode = <span class="py-string">&quot;text&quot;</span>, rettype = <span class="py-string">&quot;docsum&quot;</span>).read()</pre>
  <p>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]</p>
  <p>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]</p>
  <p>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]</p>
  <p>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]</p>
  <p>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]</p>
  <p>&gt;&gt;&gt;</p>
  <p>Now refine the query to publications in the last day</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> Bio <span class="py-keyword">import</span> EUtils
<span class="py-prompt">&gt;&gt;&gt; </span>recent_cancer = client.search(<span class="py-string">&quot;#%s&quot;</span> % (cancer.query_key,),
<span class="py-more">... </span>                              daterange = EUtils.WithinNDays(1))
<span class="py-prompt">&gt;&gt;&gt; </span>len(recent_cancer)
<span class="py-output">106</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt;</span></pre>
  <p>Still quite a few.  What's the last one about? &gt;&gt;&gt; for k, v 
  in recent_cancer[-1].summary().dataitems.allitems(): ...     print k, 
  &quot;=&quot;, v ...</p>
  <p>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'} &gt;&gt;&gt;</p>
  <p>Here's an interesting one.  Which articles are related to this one but
  are not about cancer?  First, get the related articles.</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>neighbors = recent_cancer[-1].neighbor_links()
<span class="py-prompt">&gt;&gt;&gt; </span>dbids = neighbors.linksetdbs[<span class="py-string">&quot;pubmed_pubmed&quot;</span>].dbids
<span class="py-prompt">&gt;&gt;&gt; </span>len(dbids)
<span class="py-output">10296</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt;</span></pre>
  <p>Upload that back to the server</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>related_result = client.post(dbids)
<span class="py-prompt">&gt;&gt;&gt;</span>
<span class="py-prompt">&gt;&gt;&gt; </span>non_cancer = client.search(<span class="py-string">&quot;#%s NOT #%s&quot;</span> % (related_result.query_key,
<span class="py-more">... </span>                                            cancer.query_key))
<span class="py-prompt">&gt;&gt;&gt; </span>len(non_cancer)
<span class="py-output">4000</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt;</span></pre>
  <p>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.</p>
  <p>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.</p>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.HistoryCookie-class.html" class="summary-name">HistoryCookie</a><br />
      Data needed to get back to the history
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.HistoryLookup-class.html" class="summary-name">HistoryLookup</a><br />
      Look up information about a search in history
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.HistoryRecord-class.html" class="summary-name">HistoryRecord</a><br />
      Get information about a single record in a history
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.SequenceHistoryFetchMixin-class.html" class="summary-name">SequenceHistoryFetchMixin</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.SequenceHistoryRecord-class.html" class="summary-name">SequenceHistoryRecord</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.PublicationHistoryFetchMixin-class.html" class="summary-name">PublicationHistoryFetchMixin</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.PublicationHistoryRecord-class.html" class="summary-name">PublicationHistoryRecord</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.BaseHistoryRecordSet-class.html" class="summary-name">BaseHistoryRecordSet</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.SequenceHistoryRecordSet-class.html" class="summary-name">SequenceHistoryRecordSet</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.PublicationHistoryRecordSet-class.html" class="summary-name">PublicationHistoryRecordSet</a>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="Bio.EUtils.HistoryClient.HistoryClient-class.html" class="summary-name">HistoryClient</a>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_get_recordset_constructor"></a><span class="summary-sig-name">_get_recordset_constructor</span>(<span class="summary-sig-arg">db</span>,
        <span class="summary-sig-arg">dbtype</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Bio.EUtils.HistoryClient-pysrc.html#_get_recordset_constructor">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Sep 15 09:26:23 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>