Back to index

python-biopython  1.60
Classes | Functions
Bio.ExPASy.ScanProsite Namespace Reference

Classes

class  Record
class  Parser
class  ContentHandler

Functions

def scan
def read

Function Documentation

def Bio.ExPASy.ScanProsite.read (   handle)

Definition at line 48 of file ScanProsite.py.

00048 
00049 def read(handle):
00050     "Parse search results returned by ScanProsite into a Python object"
00051     content_handler = ContentHandler()
00052     saxparser = Parser()
00053     saxparser.setContentHandler(content_handler)
00054     saxparser.parse(handle)
00055     record = content_handler.record
00056     return record
00057 
00058 # The functions below are considered private

def Bio.ExPASy.ScanProsite.scan (   seq = "",
  mirror = 'http://www.expasy.org',
  output = 'xml',
  keywords 
)
Execute a ScanProsite search.

mirror:      The ScanProsite mirror to be used
             (default: http://www.expasy.org).
seq:         The query sequence, or UniProtKB (Swiss-Prot,
             TrEMBL) accession
output:      Format of the search results
             (default: xml)

Further search parameters can be passed as keywords; see the
documentation for programmatic access to ScanProsite at
http://www.expasy.org/tools/scanprosite/ScanPrositeREST.html
for a description of such parameters.

This function returns a handle to the search results returned by
ScanProsite. Search results in the XML format can be parsed into a
Python object, by using the Bio.ExPASy.ScanProsite.read function.

Definition at line 19 of file ScanProsite.py.

00019 
00020 def scan(seq="", mirror='http://www.expasy.org', output='xml', **keywords):
00021     """Execute a ScanProsite search.
00022 
00023     mirror:      The ScanProsite mirror to be used
00024                  (default: http://www.expasy.org).
00025     seq:         The query sequence, or UniProtKB (Swiss-Prot,
00026                  TrEMBL) accession
00027     output:      Format of the search results
00028                  (default: xml)
00029     
00030     Further search parameters can be passed as keywords; see the
00031     documentation for programmatic access to ScanProsite at
00032     http://www.expasy.org/tools/scanprosite/ScanPrositeREST.html
00033     for a description of such parameters.
00034 
00035     This function returns a handle to the search results returned by
00036     ScanProsite. Search results in the XML format can be parsed into a
00037     Python object, by using the Bio.ExPASy.ScanProsite.read function.
00038     """
00039     parameters = {'seq': seq,
00040                   'output': output}
00041     for key, value in keywords.iteritems():
00042         if value is not None:
00043             parameters[key] = value
00044     command = urllib.urlencode(parameters)
00045     url = "%s/cgi-bin/prosite/PSScan.cgi?%s" % (mirror, command)
00046     handle = urllib.urlopen(url)
00047     return handle