1
2
3
4
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
19 The function scanprosite1 is OBSOLETE; please see the
20 Bio.ExPASy.ScanProsite module for this functionality.
21 """
22
23 import urllib
24
25
26 -def get_prodoc_entry(id, cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry'):
27 """get_prodoc_entry(id,
28 cgi='http://www.expasy.ch/cgi-bin/get-prodoc-entry') -> handle
29
30 Get a handle to a PRODOC entry at ExPASy in HTML format.
31
32 For a non-existing key XXX, ExPASy returns an HTML-formatted page
33 containing this line:
34 'There is no PROSITE documentation entry XXX. Please try again.'
35 """
36
37 handle = urllib.urlopen("%s?%s" % (cgi, id))
38 return handle
39
40 -def get_prosite_entry(id,
41 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry'):
42 """get_prosite_entry(id,
43 cgi='http://www.expasy.ch/cgi-bin/get-prosite-entry') -> handle
44
45 Get a handle to a PROSITE entry at ExPASy in HTML format.
46
47 For a non-existing key XXX, ExPASy returns an HTML-formatted page
48 containing this line:
49 'There is currently no PROSITE entry for XXX. Please try again.'
50 """
51 handle = urllib.urlopen("%s?%s" % (cgi, id))
52 return handle
53
54 -def get_prosite_raw(id, cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl'):
55 """get_prosite_raw(id,
56 cgi='http://www.expasy.ch/cgi-bin/get-prosite-raw.pl')
57 -> handle
58
59 Get a handle to a raw PROSITE or PRODOC entry at ExPASy.
60
61 For a non-existing key, ExPASy returns nothing.
62 """
63 handle = urllib.urlopen("%s?%s" % (cgi, id))
64 return handle
65
67 """Get a handle to a raw SwissProt entry at ExPASy.
68
69 For an ID of XXX, fetches http://www.uniprot.org/uniprot/XXX.txt
70 (as per the http://www.expasy.ch/expasy_urls.html documentation).
71
72
73 For a non-existing key XXX, ExPASy returns an HTML Error 404 page.
74
75 This function used to take a cgi option to specify the URL, but that
76 is no longer supported. This is because prior to November 2009 we
77 used to use http://www.expasy.ch/cgi-bin/get-sprot-raw.pl?XXX
78 However, at the time of writting this returns FASTA format instead
79 (probably an ExPASy/UniProt oversight). Under the new URL scheme,
80 we cannot just append "?XXX" to the cgi argument.
81 """
82 if cgi :
83 import warnings
84 warnings.warn("The cgi argument in get_sprot_raw is not "
85 "supported anymore", DeprecationWarning)
86 return urllib.urlopen("http://www.uniprot.org/uniprot/%s.txt" % id)
87
88 -def sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None,
89 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful'):
90 """sprot_search_ful(text, make_wild=None, swissprot=1, trembl=None,
91 cgi='http://www.expasy.ch/cgi-bin/sprot-search-ful') -> handle
92
93 Search SwissProt by full text.
94
95 """
96 variables = {'SEARCH' : text}
97 if make_wild:
98 variables['makeWild'] = 'on'
99 if swissprot:
100 variables['S'] = 'on'
101 if trembl:
102 variables['T'] = 'on'
103 options = urllib.urlencode(variables)
104 fullcgi = "%s?%s" % (cgi, options)
105 handle = urllib.urlopen(fullcgi)
106 return handle
107
108 -def sprot_search_de(text, swissprot=1, trembl=None,
109 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de'):
110 """sprot_search_de(text, swissprot=1, trembl=None,
111 cgi='http://www.expasy.ch/cgi-bin/sprot-search-de') -> handle
112
113 Search SwissProt by name, description, gene name, species, or
114 organelle.
115
116 """
117 variables = {'SEARCH' : text}
118 if swissprot:
119 variables['S'] = 'on'
120 if trembl:
121 variables['T'] = 'on'
122 options = urllib.urlencode(variables)
123 fullcgi = "%s?%s" % (cgi, options)
124 handle = urllib.urlopen(fullcgi)
125 return handle
126
127 -def scanprosite1(seq=None, id=None, exclude_frequent=None,
128 cgi='http://www.expasy.org/cgi-bin/scanprosite/scanprosite?1'):
129 """scanprosite1(seq=None, id=None, exclude_frequent=None,
130 cgi='http://www.expasy.org/cgi-bin/scanprosite/scanprosite?1') -> handle
131
132 Scan a sequence for a Prosite pattern. Either a sequence or a SwissProt/
133 trEMBL sequence can be passed. exclude_frequent specifies whether to
134 exclude patterns with high probability.
135
136 """
137 import warnings
138 warnings.warn("Bio.ExPASy.scanprosite1() has been deprecated, and we" \
139 +" intend to remove it in a future release of Biopython."\
140 +" Please use the Bio.ExPASy.ScanProsite module instead,"\
141 +" as described in the Tutorial.",
142 DeprecationWarning)
143 variables = {}
144 if seq:
145 variables['SEQ'] = seq
146 if id:
147 variables['ID'] = id
148 if exclude_frequent:
149 variables['box'] = 'ok'
150 options = urllib.urlencode(variables)
151 handle = urllib.urlopen(cgi, options)
152 return handle
153