ó
šxTc           @   sK   d  d l  m Z d e f d „  ƒ  YZ d Z d „  Z d „  Z d „  Z d S(	   iÿÿÿÿ(   t   commont   QueryParamsc           B   s&   e  Z d  Z d „  Z e d „  ƒ Z RS(   s+   
    Parameters for performing a query
    c         C   s   | |  _  | |  _ d  S(   N(   t   databaset   format(   t   selfR   R   (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyt   __init__   s    	c         C   s+   | d k r t  d ‚ n  |  d d d | ƒ S(	   Nt   pdbt   pdbmlt   mmcift   fastas    Unknown format '%s' for PDB dataR   R   (   R   R   R   R	   (   t
   ValueError(   t   clsR   (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyt   PDB   s    (   t   __name__t
   __module__t   __doc__R   t   classmethodR   (    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyR      s   	s   EBI DbFetch servicec           C   s,   t  j d d ƒ s( t d t t ƒ ‚ n  d  S(   Nt   urls$   http://www.ebi.ac.uk/cgi-bin/dbfetchs   Cannot contact %s(   R    t	   is_onlinet   RuntimeErrort   strR   (    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyt   check   s    c         C   s   t  d |  g d | ƒ S(   Nt   identifierst   params(   t   fetch_multiple(   t
   identifierR   (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyt   fetch_single    s    c         C   sk   t  j d d d i | j d 6d j t |  ƒ ƒ d 6| j d 6d d	 6ƒ } | j j d
 ƒ rg d | _ n  | S(   NR   s*   http://www.ebi.ac.uk/Tools/dbfetch/dbfetcht   datat   dbt   ,t   idR   t   rawt   stylet   ERRORt    (   R    t   DownloadR   t   joint   setR   R   t
   startswith(   R   R   t   result(    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyR   %   s    	

N(   t   phaser.pipeline.proxyR    t   objectR   t   NAMER   R   R   (    (    (    sK   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/dbfetch.pyt   <module>   s
   		