Package Bio :: Module ExPASy
[hide private]
[frames] | no frames]

Source Code for Module Bio.ExPASy

  1  # Copyright 2000 by Jeffrey Chang.  All rights reserved. 
  2  # This code is part of the Biopython distribution and governed by its 
  3  # license.  Please see the LICENSE file that should have been included 
  4  # as part of this package. 
  5   
  6  """ 
  7  This module provides code to access resources at ExPASy over the WWW. 
  8  http://www.expasy.ch/ 
  9   
 10   
 11  Functions: 
 12  get_prodoc_entry  Interface to the get-prodoc-entry CGI script. 
 13  get_prosite_entry Interface to the get-prosite-entry CGI script. 
 14  get_prosite_raw   Interface to the get-prosite-raw CGI script. 
 15  get_sprot_raw     Interface to the get-sprot-raw CGI script. 
 16  sprot_search_ful  Interface to the sprot-search-ful CGI script. 
 17  sprot_search_de   Interface to the sprot-search-de CGI script. 
 18  scanprosite1      Interface to the scanprosite CGI script. 
 19  """ 
 20   
 21  import urllib 
 22   
 23   
24 -def get_prodoc_entry(id, cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry'):
25 """get_prodoc_entry(id, 26 cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry') -> handle 27 28 Get a handle to a PRODOC entry at ExPASy in HTML format. 29 30 For a non-existing key XXX, ExPASy returns an HTML-formatted page 31 containing this line: 32 'There is no PROSITE documentation entry XXX. Please try again.' 33 """ 34 # Open a handle to ExPASy. 35 handle = urllib.urlopen("%s?%s" % (cgi, id)) 36 return handle
37
38 -def get_prosite_entry(id, 39 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry'):
40 """get_prosite_entry(id, 41 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry') -> handle 42 43 Get a handle to a PROSITE entry at ExPASy in HTML format. 44 45 For a non-existing key XXX, ExPASy returns an HTML-formatted page 46 containing this line: 47 'There is currently no PROSITE entry for XXX. Please try again.' 48 """ 49 handle = urllib.urlopen("%s?%s" % (cgi, id)) 50 return handle
51
52 -def get_prosite_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl'):
53 """get_prosite_raw(id, 54 cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl') 55 -> handle 56 57 Get a handle to a raw PROSITE or PRODOC entry at ExPASy. 58 59 For a non-existing key, ExPASy returns nothing. 60 """ 61 handle = urllib.urlopen("%s?%s" % (cgi, id)) 62 return handle
63
64 -def get_sprot_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-sprot-raw.pl'):
65 """get_sprot_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-sprot-raw.pl') 66 -> handle 67 68 Get a handle to a raw SwissProt entry at ExPASy. 69 70 For a non-existing key XXX, ExPASy returns an HTML-formatted page 71 containing this line: 72 'XXX is not a valid identifier.' 73 """ 74 handle = urllib.urlopen("%s?%s" % (cgi, id)) 75 return handle
76
77 -def sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 78 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful'):
79 """sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None, 80 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful') -> handle 81 82 Search SwissProt by full text. 83 84 """ 85 variables = {'SEARCH' : text} 86 if make_wild: 87 variables['makeWild'] = 'on' 88 if swissprot: 89 variables['S'] = 'on' 90 if trembl: 91 variables['T'] = 'on' 92 options = urllib.urlencode(variables) 93 fullcgi = "%s?%s" % (cgi, options) 94 handle = urllib.urlopen(fullcgi) 95 return handle
96
97 -def sprot_search_de(text, swissprot=1, trembl=None, 98 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de'):
99 """sprot_search_de(text, swissprot=1, trembl=None, 100 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de') -> handle 101 102 Search SwissProt by name, description, gene name, species, or 103 organelle. 104 105 """ 106 variables = {'SEARCH' : text} 107 if swissprot: 108 variables['S'] = 'on' 109 if trembl: 110 variables['T'] = 'on' 111 options = urllib.urlencode(variables) 112 fullcgi = "%s?%s" % (cgi, options) 113 handle = urllib.urlopen(fullcgi) 114 return handle
115
116 -def scanprosite1(seq=None, id=None, exclude_frequent=None, 117 cgi='http://www.expasy.org/cgi-bin/scanprosite/scanprosite?1'):
118 """scanprosite1(seq=None, id=None, exclude_frequent=None, 119 cgi='http://www.expasy.org/cgi-bin/scanprosite/scanprosite?1') -> handle 120 121 Scan a sequence for a Prosite pattern. Either a sequence or a SwissProt/ 122 trEMBL sequence can be passed. exclude_frequent specifies whether to 123 exclude patterns with high probability. 124 125 """ 126 variables = {} 127 if seq: 128 variables['SEQ'] = seq 129 if id: 130 variables['ID'] = id 131 if exclude_frequent: 132 variables['box'] = 'ok' 133 options = urllib.urlencode(variables) 134 handle = urllib.urlopen(cgi, options) 135 return handle
136